56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
---
|
|
version: "3.8"
|
|
|
|
services:
|
|
app:
|
|
command: ["-cert", "/certs/cert.crt", "-key", "/certs/cert.key", "-ca", "/certs/ca.crt", "-cakey", "/certs/ca.key"]
|
|
volumes:
|
|
- "compy_certs:/certs"
|
|
depends_on:
|
|
- ssl_generator
|
|
|
|
web:
|
|
# NOTE(3wc): this is just to host the PAC file
|
|
image: nginx:1.20
|
|
networks:
|
|
- proxy
|
|
environment:
|
|
- DOMAIN
|
|
configs:
|
|
- source: pac_conf
|
|
target: /usr/share/nginx/html/proxy.pac
|
|
deploy:
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
|
|
ssl_generator:
|
|
image: nginx:1.20
|
|
volumes:
|
|
- "compy_certs:/certs"
|
|
deploy:
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: none
|
|
environment:
|
|
- DOMAIN
|
|
command: |
|
|
sh -c
|
|
"if [ ! -f /certs/ca.crt ]; then
|
|
openssl req -x509 -newkey rsa:4096 -nodes -keyout /certs/cert.key -out /certs/cert.crt -days 3650 -subj '/CN=$DOMAIN'
|
|
openssl req -x509 -newkey rsa:4096 -nodes -keyout /certs/ca.key -out /certs/ca.crt -days 3650 -subj '/CN=$DOMAIN'
|
|
fi;"
|
|
|
|
configs:
|
|
# NOTE(3wc): ah yes, the Proxy Auto-Configuration config..
|
|
pac_conf:
|
|
name: ${STACK_NAME}_pac_conf_${PAC_CONF_VERSION}
|
|
file: proxy.pac.tmpl
|
|
template_driver: golang
|
|
|
|
volumes:
|
|
compy_certs:
|