cerbot compose

This commit is contained in:
Luke Berndt
2024-02-03 10:53:46 -05:00
parent 416b8dd778
commit febe3d23a6
3 changed files with 49 additions and 1 deletions

38
certbot-compose.yml Normal file
View File

@@ -0,0 +1,38 @@
version: "3"
services:
nginx:
build:
context: ./nginx-proxy
args:
STAGE: "cert"
environment:
- DOMAIN_NAME
image: "nginx:${TAG}-cert"
networks:
- proxy
ports:
- "80:80"
restart: always
volumes:
- ${PWD}/data/log/syslog:/var/log/syslog
- ${PWD}/data/log/nginx:/var/log/nginx
- ${PWD}/data/certbot/www/:/var/www/certbot/:ro
- ${PWD}/data/certbot/conf/:/etc/letsencrypt/:ro
command: /bin/bash -c "envsubst '$$DOMAIN_NAME' < /etc/nginx/conf.d/site.template > /etc/nginx/conf.d/default.conf && while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g 'daemon off;'"
certbot:
image: certbot/certbot:latest
volumes:
- ${PWD}/data/certbot/www/:/var/www/certbot/:rw
- ${PWD}/data/certbot/conf/:/etc/letsencrypt/:rw
entrypoint: "certbot certonly --webroot -w /var/www/certbot \
--staging \
--email ${REACT_APP_ADMIN_EMAIL} \
-d ${DOMAIN_NAME} -d www.${DOMAIN_NAME} -d api.${DOMAIN_NAME} -d admin.${DOMAIN_NAME}\
--rsa-key-size $rsa_key_size \
--agree-tos \
--force-renewal"
networks:
proxy:
node:

View File

@@ -82,7 +82,7 @@ esac
# Enable staging mode if needed
if [ $staging != "0" ]; then staging_arg="--staging"; fi
docker compose -f docker-compose.yml -f test-compose.yml run --rm --entrypoint "\
docker compose -f certbot-compose.yml run --rm --entrypoint "\
certbot certonly --webroot -w /var/www/certbot \
$staging_arg \
$email_arg \

View File

@@ -0,0 +1,10 @@
server {
listen 80;
server_name account.${DOMAIN_NAME} api.${DOMAIN_NAME} admin.${DOMAIN_NAME} www.${DOMAIN_NAME} ${DOMAIN_NAME};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
return 404
}