Skip to content

Commit 2974fc1

Browse files
authored
Merge pull request #249 from buchdag/force-renew
Add the ability to force the renewal of all certificates
2 parents 23dca23 + ebe87bf commit 2974fc1

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ $ docker run -d \
142142
tutum/apache-php
143143
```
144144

145+
#### Force certificates renewal
146+
147+
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:
148+
149+
```bash
150+
$ docker exec nginx-letsencrypt /app/force_renew
151+
```
152+
145153
#### Optional container environment variables
146154

147155
Optional letsencrypt-nginx-proxy-companion container environment variables for custom configuration.

app/force_renew

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
source /app/letsencrypt_service --source-only
4+
5+
update_certs --force-renew

app/letsencrypt_service

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ update_certs() {
7070
params_d_str=""
7171
[[ $DEBUG == true ]] && params_d_str+=" -v"
7272
[[ $REUSE_KEY == true ]] && params_d_str+=" --reuse_key"
73+
[[ "${1}" == "--force-renew" ]] && params_d_str+=" --valid_min 7776000" && shift
7374

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

139+
# Allow the script functions to be sourced without starting the Service Loop.
140+
if [ "${1}" == "--source-only" ]; then
141+
return 0
142+
fi
143+
138144
pid=
139145
# Service Loop: When this script exits, start it again.
140146
trap '[[ $pid ]] && kill $pid; exec $0' EXIT

0 commit comments

Comments
 (0)