Reload nginx when new certificates are added
This commit is contained in:
parent
1ff5e4e9fd
commit
8dd596c583
1 changed files with 6 additions and 1 deletions
|
|
@ -36,6 +36,10 @@ update_certs() {
|
||||||
# Symlink to created certificate and key.
|
# Symlink to created certificate and key.
|
||||||
ln -sf ./$domain/fullchain.pem /etc/nginx/certs/$domain".crt"
|
ln -sf ./$domain/fullchain.pem /etc/nginx/certs/$domain".crt"
|
||||||
ln -sf ./$domain/key.pem /etc/nginx/certs/$domain".key"
|
ln -sf ./$domain/key.pem /etc/nginx/certs/$domain".key"
|
||||||
|
|
||||||
|
# Update certificates configuration in nginx
|
||||||
|
/usr/local/bin/docker-gen -only-exposed /app/nginx.tmpl /etc/nginx/conf.d/default.conf
|
||||||
|
nginx -s reload
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
@ -47,11 +51,12 @@ trap '[[ $pid ]] && kill $pid; exec $0' EXIT
|
||||||
trap 'trap - EXIT' INT TERM
|
trap 'trap - EXIT' INT TERM
|
||||||
|
|
||||||
echo 'Waiting 10s before updating certs...'
|
echo 'Waiting 10s before updating certs...'
|
||||||
sleep 10
|
sleep 1s
|
||||||
|
|
||||||
update_certs
|
update_certs
|
||||||
|
|
||||||
# Wait some amount of time
|
# Wait some amount of time
|
||||||
|
echo "Sleep for ${seconds_to_wait}s"
|
||||||
sleep $seconds_to_wait & pid=$!
|
sleep $seconds_to_wait & pid=$!
|
||||||
wait
|
wait
|
||||||
pid=
|
pid=
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue