mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 01:37:48 -05:00
cerbot compose
This commit is contained in:
38
certbot-compose.yml
Normal file
38
certbot-compose.yml
Normal 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:
|
||||||
@@ -82,7 +82,7 @@ esac
|
|||||||
# Enable staging mode if needed
|
# Enable staging mode if needed
|
||||||
if [ $staging != "0" ]; then staging_arg="--staging"; fi
|
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 \
|
certbot certonly --webroot -w /var/www/certbot \
|
||||||
$staging_arg \
|
$staging_arg \
|
||||||
$email_arg \
|
$email_arg \
|
||||||
|
|||||||
10
nginx-proxy/cert/vhosts/site.template
Normal file
10
nginx-proxy/cert/vhosts/site.template
Normal 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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user