diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb1389b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +production.env \ No newline at end of file diff --git a/certbot/files/entrypoint.sh b/certbot/files/entrypoint.sh index 07a94b5..5506b6d 100644 --- a/certbot/files/entrypoint.sh +++ b/certbot/files/entrypoint.sh @@ -138,17 +138,23 @@ function get_cert() if [ $webserver_exists -eq 1 ] ; then log get_cert "Getting cert for [$root_domain] with [$domains]" - # certbotx certonly \ - # --config-dir "$cert_bot_path" \ - # --agree-tos \ - # --domains "$domains" \ - # --email "contact@${root_domain}" \ - # --no-eff-email \ - # --expand \ - # --noninteractive \ - # --webroot \ - # --webroot-path "$web_root_path" \ - # $OPTIONS || true + # PRODUCTION needs to be set in env + if [ -z ${PRODUCTION+x} ]; then + log WARNING get_cert "PRODUCTION not set, exiting" + return 0 + fi + log get_cert "Running certbot" + certbot certonly \ + --config-dir "$cert_bot_path" \ + --agree-tos \ + --domains "$domains" \ + --email "contact@${root_domain}" \ + --no-eff-email \ + --expand \ + --noninteractive \ + --webroot \ + --webroot-path "$web_root_path" + # $OPTIONS || true else log get_cert ERROR "Webserver for [$root_domain] not reachable after $server_retries retries" return 1 diff --git a/docker-compose.yml b/docker-compose.yml index fe56d3f..4c6c492 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,7 @@ services: GROUP_UID: ${UID_PROXY:-12002} env_file: - ./certbot/files/domains.env + - ./production.env # set PRODUCTION= here restart: always image: certbot container_name: certbot