New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically restarting services when octohost reboots. #109

Closed
NigelThorne opened this Issue Feb 13, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@NigelThorne
Contributor

NigelThorne commented Feb 13, 2015

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.

Thoughts?

@darron

This comment has been minimized.

Show comment
Hide comment
@darron

darron Mar 11, 2015

Member

I have been thinking about this - I think a variation on this is likely to be the best way to make this happen:

https://docs.docker.com/articles/host_integration/

For example:

description "{container-name} container"
author "Me"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
  /usr/bin/octo {container-name} start
end script

What do you think?

Member

darron commented Mar 11, 2015

I have been thinking about this - I think a variation on this is likely to be the best way to make this happen:

https://docs.docker.com/articles/host_integration/

For example:

description "{container-name} container"
author "Me"
start on filesystem and started docker
stop on runlevel [!2345]
respawn
script
  /usr/bin/octo {container-name} start
end script

What do you think?

@darron

This comment has been minimized.

Show comment
Hide comment
@darron

darron Mar 11, 2015

Member

Between these two commits:

octohost/octohost-cookbook@f175987

536ebd3

This may solve your problem.

Testing it myself.

Member

darron commented Mar 11, 2015

Between these two commits:

octohost/octohost-cookbook@f175987

536ebd3

This may solve your problem.

Testing it myself.

@darron

This comment has been minimized.

Show comment
Hide comment
@darron

darron May 12, 2015

Member

This is complete now with the latest release.

Member

darron commented May 12, 2015

This is complete now with the latest release.

@darron darron closed this May 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment