From f20864f42e76b46806786159101c9f4dd795fc50 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 6 Jun 2017 09:20:50 +0800 Subject: [PATCH 1/3] move cron to shell --- Procfile | 4 +--- updatessl.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Procfile b/Procfile index 14b25ad..b7346ac 100644 --- a/Procfile +++ b/Procfile @@ -1,4 +1,2 @@ dockergen: docker-gen -watch -notify "/app/updatessl.sh updatessl" /app/nginx.tmpl /etc/nginx/conf.d/default.conf -nginx: nginx -cron: cron && tail -f /dev/null - +nginx: nginx \ No newline at end of file diff --git a/updatessl.sh b/updatessl.sh index f939967..394b2f5 100755 --- a/updatessl.sh +++ b/updatessl.sh @@ -10,6 +10,15 @@ DEFAULT_CONF="/etc/nginx/conf.d/default.conf" CERTS="/etc/nginx/certs" +startcron() { + if service cron status | grep "cron is running"; then + echo "cron is running, skip" + else + service cron start + fi +} + + updatessl() { if grep ACME_DOMAINS $DEFAULT_CONF ; then @@ -33,6 +42,7 @@ updatessl() { } +startcron "$@" From 01f3b3236dfb93e232f66002c82baf176b804f6c Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 6 Jun 2017 10:10:52 +0800 Subject: [PATCH 2/3] fix cronjob --- Procfile | 3 ++- updatessl.sh | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Procfile b/Procfile index b7346ac..a96a1ab 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ dockergen: docker-gen -watch -notify "/app/updatessl.sh updatessl" /app/nginx.tmpl /etc/nginx/conf.d/default.conf -nginx: nginx \ No newline at end of file +nginx: nginx +cron: cron -f \ No newline at end of file diff --git a/updatessl.sh b/updatessl.sh index 394b2f5..f939967 100755 --- a/updatessl.sh +++ b/updatessl.sh @@ -10,15 +10,6 @@ DEFAULT_CONF="/etc/nginx/conf.d/default.conf" CERTS="/etc/nginx/certs" -startcron() { - if service cron status | grep "cron is running"; then - echo "cron is running, skip" - else - service cron start - fi -} - - updatessl() { if grep ACME_DOMAINS $DEFAULT_CONF ; then @@ -42,7 +33,6 @@ updatessl() { } -startcron "$@" From c9e8e8259d1064de3c5cde5e688ea9cd5976afa3 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 6 Jun 2017 14:13:15 +0800 Subject: [PATCH 3/3] flush cache --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ef2c70..081d8ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,10 +10,6 @@ RUN apt-get update \ && apt-get clean \ && rm -r /var/lib/apt/lists/* -ENV AUTO_UPGRADE=1 -ENV LE_WORKING_DIR=/acme.sh -ENV LE_CONFIG_HOME=/acmecerts -RUN wget -O- https://get.acme.sh | sh # Configure Nginx and apply fix for very long server names RUN echo "daemon off;" >> /etc/nginx/nginx.conf \ @@ -36,6 +32,11 @@ ENV DOCKER_HOST unix:///tmp/docker.sock VOLUME ["/etc/nginx/certs"] +ENV AUTO_UPGRADE=1 +ENV LE_WORKING_DIR=/acme.sh +ENV LE_CONFIG_HOME=/acmecerts +RUN wget -O- https://get.acme.sh | sh + VOLUME ["/acmecerts"] EXPOSE 443