Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ $ docker run -d \
tutum/apache-php
```

#### Force certificates renewal

If needed, you can force a running letsencrypt-nginx-proxy-companion container to renew all certificates that are currently in use. Replace `nginx-letsencrypt` with the name of your `letsencrypt-nginx-proxy-companion` container in the following command:

```bash
$ docker exec nginx-letsencrypt /app/force_renew
```

#### Optional container environment variables

Optional letsencrypt-nginx-proxy-companion container environment variables for custom configuration.
Expand Down
5 changes: 5 additions & 0 deletions app/force_renew
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source /app/letsencrypt_service --source-only

update_certs --force-renew
6 changes: 6 additions & 0 deletions app/letsencrypt_service
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ update_certs() {
params_d_str=""
[[ $DEBUG == true ]] && params_d_str+=" -v"
[[ $REUSE_KEY == true ]] && params_d_str+=" --reuse_key"
[[ "${1}" == "--force-renew" ]] && params_d_str+=" --valid_min 7776000" && shift

hosts_array_expanded=("${!hosts_array}")
# First domain will be our base domain
Expand Down Expand Up @@ -135,6 +136,11 @@ update_certs() {
[[ "$reload_nginx" == 'true' ]] && reload_nginx
}

# Allow the script functions to be sourced without starting the Service Loop.
if [ "${1}" == "--source-only" ]; then
return 0
fi

pid=
# Service Loop: When this script exits, start it again.
trap '[[ $pid ]] && kill $pid; exec $0' EXIT
Expand Down