Skip to content

Commit

Permalink
build: fix cert renew with FMTM_SCRIPT_DOMAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Nov 5, 2023
1 parent a9f34c1 commit a37697a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docker-compose.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ services:
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${VITE_API_URL:-api.${FMTM_DOMAIN}}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN:-localhost}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN}
ports:
- 80:80
- 443:443
Expand Down Expand Up @@ -152,7 +152,7 @@ services:
environment:
FMTM_DOMAIN: ${FMTM_DOMAIN}
FMTM_API_DOMAIN: ${FMTM_API_DOMAIN:-${VITE_API_URL:-api.${FMTM_DOMAIN}}}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN:-localhost}
FMTM_SCRIPT_DOMAIN: ${FMTM_SCRIPT_DOMAIN}
CERT_EMAIL: ${CERT_EMAIL}
ports:
- 80:80
Expand Down
11 changes: 3 additions & 8 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ COPY templates/dev/fmtm.conf.template \

FROM base as certs-init-main
# Replace existing /docker-entrypoint.sh
COPY 100-renew-certs.sh /docker-entrypoint.sh
COPY container-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY templates/cert-init/fmtm.conf.template \
templates/cert-init/api.conf.template \
Expand All @@ -107,13 +107,8 @@ COPY templates/cert-init/fmtm.conf.template \



FROM base as certs-init-development
# Replace existing /docker-entrypoint.sh
COPY container-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY templates/cert-init/fmtm.conf.template \
templates/cert-init/api.conf.template \
templates/cert-init/odk.conf.template \
FROM certs-init-main as certs-init-development
COPY templates/cert-init/odk.conf.template \
templates/cert-init/minio.conf.template \
/etc/nginx/templates/

Expand Down
4 changes: 2 additions & 2 deletions nginx/container-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ certbot --non-interactive certonly "${certbot_args[@]}"
echo "Certificate generated under: /etc/letsencrypt/live/${FMTM_DOMAIN}/"

# Add FMTM_SCRIPT_DOMAIN if present
if [ -n "${FMTM_SCRIPT_DOMAIN}" ] && [ "${FMTM_SCRIPT_DOMAIN}" != "localhost" ]; then
if [ -n "${FMTM_SCRIPT_DOMAIN}" ]; then
echo
echo "FMTM_SCRIPT_DOMAIN variable set and not equal to 'localhost'. Generating separate certificate."
echo "FMTM_SCRIPT_DOMAIN variable set. Generating separate certificate."
certbot --non-interactive certonly \
--webroot --webroot-path=/var/www/certbot \
--email "${CERT_EMAIL}" --agress-tos --no-eff-email \
Expand Down

0 comments on commit a37697a

Please sign in to comment.