Skip to content

Commit

Permalink
tuning logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ebarault committed Oct 16, 2017
1 parent ab6b3d6 commit a52d4d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ services:
- ./var_log_letsencrypt:/var/log/letsencrypt
restart: always
environment:
#- WEBROOT=""
#- WEBROOT=
- DEBUG=false
- STAGING=true
- DOMAINS=my.domain.com
- [email protected]
- CONCAT=false
- HEALTH_CHECK_URL=my.domain.com:80
# - LOGFILE=/var/log/letsencrypt/certrenewal.log
3 changes: 3 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ until [ $(curl -s -L --head --fail -o /dev/null -w '%{http_code}\n' --connect-ti
# -o = Redirects the HTML output to /dev/null
done

echo ""
echo "$HEALTH_CHECK_URL is online, running certbot"

# one-time execution at container start once host's health check is ok
/scripts/run_certbot.sh

Expand Down
8 changes: 4 additions & 4 deletions scripts/run_certbot.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#!/bin/sh

LOGFILE="/var/log/letsencrypt/certrenewal.log"
# LOGFILE="/var/log/letsencrypt/certrenewal.log"

logger_error() {
if [ -n "${LOGFILE}" ]
then
echo "[error] ${1}" >> ${LOGFILE}
fi
>&2 echo "[error] ${1}"
>&2 echo "[error] ${1}" > /proc/1/fd/1 2>/proc/1/fd/2
}

logger_info() {
if [ -n "${LOGFILE}" ]
then
echo "[info] ${1}" >> ${LOGFILE}
else
echo "[info] ${1}"
echo "[info] ${1}" > /proc/1/fd/1 2>/proc/1/fd/2
fi
}

issueCertificate() {
certbot certonly --agree-tos --renew-by-default --non-interactive --email $EMAIL $args -d $1 &>/dev/null
certbot certonly --agree-tos --renew-by-default --non-interactive --max-log-backups 100 --email $EMAIL $args -d $1 &>/dev/null
return $?
}

Expand Down

0 comments on commit a52d4d9

Please sign in to comment.