Skip to content

Commit a1a6732

Browse files
prodrigestivillJrCs
authored andcommitted
Fix renewals on separate containers (#165)
* Added support to reload nginx containter in case only certificates renewal happend. Reusing the autodetection from --volumes-from.
1 parent f6c18cc commit a1a6732

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ $ docker run -d \
102102
```
103103
Then start any containers to be proxied as described previously.
104104

105+
* If for some reason you can't use the docker --volumes-from option, you can specify the name or id of the nginx container with `NGINX_PROXY_CONTAINER` variable.
106+
105107
#### Let's Encrypt
106108

107109
To use the Let's Encrypt service to automatically create a valid certificate for virtual host(s).

app/functions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,14 @@ function docker_kill {
7070
## Nginx
7171
reload_nginx() {
7272
if [[ -n "${NGINX_DOCKER_GEN_CONTAINER:-}" ]]; then
73-
# Using docker-gen separate container
74-
echo "Reloading nginx proxy (using separate container ${NGINX_DOCKER_GEN_CONTAINER})..."
73+
# Using docker-gen and nginx in separate container
74+
echo "Reloading nginx docker-gen (using separate container ${NGINX_DOCKER_GEN_CONTAINER})..."
7575
docker_kill "$NGINX_DOCKER_GEN_CONTAINER" SIGHUP
76+
if [[ -n "${NGINX_PROXY_CONTAINER:-}" ]]; then
77+
# Reloading nginx in case only certificates had been renewed
78+
echo "Reloading nginx (using separate container ${NGINX_PROXY_CONTAINER})..."
79+
docker_kill "$NGINX_PROXY_CONTAINER" SIGHUP
80+
fi
7681
else
7782
if [[ -n "${NGINX_PROXY_CONTAINER:-}" ]]; then
7883
echo "Reloading nginx proxy..."

0 commit comments

Comments
 (0)