Cannot reload template file?
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?
docker container kill -s HUP nginx-gen
@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
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.
@buchdag what exactly impacts default.conf? Does it recognize if the template file changes?
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.
@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?
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.
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
@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?