Skip to content
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

Cannot reload template file? #297

Open
citymonitor opened this issue Dec 14, 2018 · 9 comments
Open

Cannot reload template file? #297

citymonitor opened this issue Dec 14, 2018 · 9 comments

Comments

@citymonitor
Copy link

Hi there,

I came across this question a few times, but no solution helped. I have the following setup:
https://gist.github.com/citymonitor/93c4d2faeeef2e9fdd2c517fc3e071e0

It's all running fine. But I don't get how to reload the config (recreate default.conf from nginx.tmpl).
I tried: docker-compose up -d --force-recreate --build but this didn't help.

Can anyone tell me how to do this?

@buchdag
Copy link
Member

buchdag commented Dec 14, 2018

docker container kill -s HUP nginx-gen

@citymonitor
Copy link
Author

@buchdag thanks a lot but how do I verify it is actually reloaded or how do I check for errors? It still seems to be the same

@buchdag
Copy link
Member

buchdag commented Dec 14, 2018

docker container logs nginx-gen

If docker-gen picked up changes that impact the generated default.conf you'll see an entry like this one: 2018/01/01 12:00:00 Generated '/etc/nginx/conf.d/default.conf' from X containers

If you see 2018/01/01 12:00:00 Contents of /etc/nginx/conf.d/default.conf did not change [...] it means that the change you made were not picked up by docker-gen or by the template your are using.

docker-gen won't generate the same file over again if there are no changes.

@citymonitor
Copy link
Author

@buchdag what exactly impacts default.conf? Does it recognize if the template file changes?

@buchdag
Copy link
Member

buchdag commented Dec 20, 2018

Your change to the template file have to result in changes to the default.conf file in your specific Docker environment.

For instance let's say you add some code the template file that generated additional configuration lines according to the value of a container environment variable called WHATEVER if and only if it is set. If you don't set the WHATEVER environment variable on any container, your change on the template file won't result in changes to the generated file.

No one but you can tell wether a change in the generated file should occur with a specific template file on your specific Docker environment with your own containers. And don't forget that docker-gen has option (like -only-exposed) that further restrain the containers it picks up.

@citymonitor
Copy link
Author

@buchdag thanks a lot I will try that! I've added an additional location entry in the template and it did not pick up anything.

Just one more thing: is it possible to add an additional, custom, static config to this running nginx instance somehow?

@buchdag
Copy link
Member

buchdag commented Dec 21, 2018

Your question is specific to jwilder/nginx-proxy, you should read that repo's doc and ask your question there if the answer is not in the doc.

@citymonitor
Copy link
Author

Thank you, I've posted in the group with the exact problem I'm trying to solve:
https://groups.google.com/forum/#!topic/nginx-proxy/bQ1xvRElJ4k

@solars
Copy link

solars commented Jan 7, 2019

@buchdag one more question, if I simply change a variable like
- LETSENCRYPT_HOST=domain1.com
to:
- LETSENCRYPT_HOST=domain1.com,domain2.com

the file is not reloaded. How can I reliably force this?

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

No branches or pull requests

3 participants