dokku-mongodb-plugin icon indicating copy to clipboard operation
dokku-mongodb-plugin copied to clipboard

Auto-start on reboot

Open ignlg opened this issue 10 years ago • 8 comments

Everytime I reboot the server I need to execute:

$ ssh server dokku mongodb:start

Am I missing something?

ignlg avatar May 29 '14 14:05 ignlg

I'm having that issue too, and in addition to that I'm getting errors when I try to start it. Please advice

fabdrol avatar Jul 18 '14 14:07 fabdrol

I'm not sure about rebooting. I need to check with the dokku folks on how to handle that.

@fabdrol as far as the errors you are getting, can you let me know what they are?

jeffutter avatar Jul 18 '14 14:07 jeffutter

@jeffutter I actually just fixed that by reinstalling the plugin.. Seemed to have something to do with me trying to run it all on a 512mb RAM server.. (Worked better after setting up 4gb swap)

fabdrol avatar Jul 18 '14 14:07 fabdrol

I just ran into this issue.

I wrote an upstart script that will run dokku mongodb:start and also dokku mongodb:link <app> for each app I installed. I think solving this will involve some kind of upstart script as dokku itself is using an upstart script that listens for another to kick in. /etc/init/dokku-redeploy.conf

Another way might be if dokku has support for non app specific hooks.

metasansana avatar Sep 20 '14 18:09 metasansana

There are already 3+ issues similar to this. Any problems with resolving? #65 #51 Rebuilding all the apps for 10s of minutes because of this? Seriously? Makes plugin unusable.

ulitiy avatar Jul 27 '15 22:07 ulitiy

At least we can use dokku ps:restart, not rebuild

ulitiy avatar Jul 27 '15 22:07 ulitiy

I wish there was a good solution for this. Dokku doesn't support an "on boot" hook which is what would really be needed to make this smooth (maybe you can file an issue over there - this seems like a pretty valid usecase).

For now you can try adding an init script (the one below is for ubuntu systems running upstart) that will restart the mongodb container before dokku redeploys all apps (which it does with another init script - https://github.com/progrium/dokku/blob/master/plugins/00_dokku-standard/install#L14-L27).

/etc/init/dokku-mongodb.conf

description "Dokku MongoDB container"
start on starting dokku-redeploy
script
  sleep 2 # give docker some time
  sudo -i -u dokku /usr/local/bin/dokku mongodb:start
end script

I haven't tested this yet. I imagine it will be very tricky to make sure mongodb is actually started before dokku redeploys all of the apps. I think upstart starts things asynchronously, so even though this says to start right before dokku-redeploy starts, it may take longer to start up and thus be started after.

Anyway, if anyone wants to test this out and provide feedback that would be helpful.

jeffutter avatar Jul 28 '15 11:07 jeffutter

Issue #65 has another upstart script that may be more successful.

jeffutter avatar Jul 28 '15 11:07 jeffutter