Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Automatically restarting services when octohost reboots. #109
I need the services to automatically restart when the octohost server reboots.
I tried adding "--restart=always" to the launch command in octo. This works to some extend. The issue is that the port used changes, and the nginx config doesn't.
I would like a way for this to automatically update.
I was thinking I could somehow automatically run "octo services:clear && octo services:register".
This doesn't work however because "docker ps" lists the restarted container's image by it's sha, not it's name. I can work around that, but I would also have to have something trigger this command in the first place. It would have to run after docker has restarted the containers.
A design that sidesteps this problem is:
If octohost registered images with docker, and told them to start, and relied on a separate service watching docker to notice the starting container and trigger a change in consult config. This in turn would update the nginx config as it does now.
This way ... if the server restarts, the containers restart, and their "starting" event triggers the consult config to be updated again, and nginx is updated.
Other alternatives require polling to detect the discrepancy between the port known by consult and the one exposed by docker.
I have been thinking about this - I think a variation on this is likely to be the best way to make this happen:
What do you think?