Dokku launches Mongo after reboot

I played with Dokku on the server and used it to deploy MEAN applications. I really like this, but my only problem is that after rebooting the server (or crashing), Dokku does not restart the Mongo service. I need to manually log dokku mongodb:startin and then dokku MYAPP deployto restore it. Otherwise, I get a bad gateway error.

Thanks for any tips! I am new to this.

+4
source share
1 answer

This is a bug in the dokku-mongodb plugin. Dokku itself uses an Upstart script to run on boot. It installs on /etc/init/dokku-redeploy.confand looks like this:

description "Dokku app redeploy service"
start on filesystem and started docker
script
  sleep 2 # give docker some time
  sudo -i -u dokku /usr/local/bin/dokku ps:restartall
end script

I would suggest using something similar, perhaps:

description "Dokku MongoDB plugin redeploy service"

start on started dokku-redeploy
stop on runlevel [!12345]

setuid dokku
setgid dokku

exec /usr/local/bin/dokku mongodb:start
pre-stop exec /usr/local/bin/dokku mongodb:stop
+1
source

All Articles