Skip to content

Added flag -restart-container to allow restarting of docker containers. #27

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

Merged
merged 1 commit into from
Oct 7, 2014

Conversation

JustAdam
Copy link
Contributor

Continued from #24 (code is moved from master branch)

...

The main purpose of this patch is too be able to run docker-gen by itself in a container. Therefore I think it is vital that this functionality is built into docker-gen and not provided by an external dependency (script/program). The external dependency provides an additional tool to maintain (ensuring the docker end point is available, ensure API calls are up to date etc.) and package.

I would really like to see this patch accepted, as it would make docker-gen much more usable (certainly for me and cnf!).

I agree with the syntax being funky, and have thought a bit more about the additional flag, and perhaps it is the only way to go. If we can agree, I will rewrite the patch to include a new flag: -restart-container=CONTAINER_ID.
So either the flag or old flag, both or none can be specified and all behaves as it did before. If both are specified then it issues the restart and the notify.

@jwilder
Copy link
Collaborator

jwilder commented Oct 1, 2014

Ok. You've convinced me. Crafting an API request via shell commands is kind of ugly.

Instead of -restart-containers, I think -notify-sighup might be a better name since it's not really restarting containers but sending a SIGHUP for notification. This would also allow some flexibility to add -notify-sigusr1 or other signals in the future.

Not needed for this patch but I'll probably add the ability to pass -notify-sighup multiple times instead of using CSV as well.

@JustAdam JustAdam force-pushed the container-restart branch 2 times, most recently from c171be5 to 4140e3f Compare October 2, 2014 18:38
@JustAdam
Copy link
Contributor Author

JustAdam commented Oct 2, 2014

Here's the updated patch. Have coded it such that it will be trivial to pass in additional container IDs as well as signals.

@JustAdam
Copy link
Contributor Author

JustAdam commented Oct 2, 2014

Hmm, I am wondering whether to change config.NotifyContainers to a map[string]docker.Signal and then construct KillContainerOptions inside sendSignalToContainer(). Think that will make it easier to work with in future for additional signal type flags. But it will be a few days before I get to look at this again.

@JustAdam
Copy link
Contributor Author

JustAdam commented Oct 4, 2014

Patch updated.

@JustAdam
Copy link
Contributor Author

JustAdam commented Oct 7, 2014

Bump :-)

jwilder added a commit that referenced this pull request Oct 7, 2014
Added flag -restart-container to allow restarting of docker containers.
@jwilder jwilder merged commit a3948f8 into nginx-proxy:master Oct 7, 2014
@jwilder
Copy link
Collaborator

jwilder commented Oct 7, 2014

Thanks! @JustAdam

@JustAdam JustAdam deleted the container-restart branch October 8, 2014 17:46
@pwFoo
Copy link

pwFoo commented Dec 30, 2015

Hello @jwilder I would need "-notify-sigusr1" to graceful reload a config. Any chance to get this feature for docker-gen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants