Failing to rebuild Discource on a 1GB Digitalocean instance

Hi. I’m using 1gb digitalocean droplet instance for hosting disource and realized I’ve messed up SMTP settings. I’ve edited them however ./launcher rebuild app leads to:

I, [2018-11-24T07:25:17.572770 #14] INFO -- : Terminating async processes

I, [2018-11-24T07:25:17.573220 #14] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/10/bin/postmaster -D /etc/postgresql/10/main pid: 69

2018-11-24 07:25:17.574 UTC [69] LOG: received fast shutdown request

I, [2018-11-24T07:25:17.575223 #14] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 185

185:signal-handler (1543044317) Received SIGTERM scheduling shutdown...

2018-11-24 07:25:17.580 UTC [69] LOG: aborting any active transactions

2018-11-24 07:25:17.589 UTC [69] LOG: worker process: logical replication launcher (PID 78) exited with exit code 1

2018-11-24 07:25:17.591 UTC [73] LOG: shutting down

2018-11-24 07:25:17.616 UTC [69] LOG: database system is shut down

185:M 24 Nov 07:25:17.645 # User requested shutdown...

185:M 24 Nov 07:25:17.649 * Saving the final RDB snapshot before exiting.

185:M 24 Nov 07:25:17.659 * DB saved on disk

185:M 24 Nov 07:25:17.659 # Redis is now ready to exit, bye bye...



Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake assets:precompile' failed with return #<Process::Status: pid 432 exit 137>

Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]

And honestly have no idea what’s going on. Does that have something to do that this is smallest droplet possible and I need more memory? I have no idea what this shutdown is about.

A common problem is doing too many rebuilds in a row and getting throttled by the rubygems repository, the database shutdown messages during the build look normal to me, it always shuts it down at the end before packaging and restarting the container. You could be running out of disk or ram maybe, try opening a second terminal window to your server and watching it with top or htop. watch -n 2 df -h in a separate window is also nice to keep an eye on free space

Look for more errors further up in the text, you can save all the output to a file by doing something like

script build.txt
./launcher rebuild app


For the future references - yep, it was memory and bundle exec rake assets:precompile is to blame.
I’ve just added 1GB swapfile and luckily this solved the problem.

1 Like

How did you bypass creating a swapfile during setup? It’s one of the steps which are automated for you.

1 Like

No idea to be honest - as far as I remember I was never asked explicitely about creating swapfile while creating droplet and bootstrapping discourse for the very first time.

Did you run the setup script or just do your config in app.yml? I did the latter when first starting out, and I don’t think that created a swap.

Until you run discourse-setup the app.yml doesn’t exist. In addition to creating the swap, discourse-setup asks all of the questions which create the app.yml.

It’s possible that this is a very old install which precedes discourse-setup, but it’s more likely swap creation was bypassed. When it wasn’t automated the swap creation was a manual step of the cloud install guide and AFAIK has always been a requirement for the 1GB install.

1 Like