custom-php/compose.yml

103 lines
3.0 KiB
YAML

version: "3.8"
services:
backend:
image: adhocore/phpfpm:8.0
volumes:
- "site_content:/var/www/html/"
networks:
- backend
- proxy
environment:
- DB_HOST=db
- DB_USER=site
- DB_PASSWORD_FILE=/run/secrets/db_password
- DB_NAME=site
- PHP_EXTENSIONS_TO_DISABLE
secrets:
- db_password
configs:
- source: php_uploads_conf
target: /usr/local/etc/php/conf.d/uploads.ini
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
depends_on:
- db
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- coop-cloud.${STACK_NAME}.backend.version=8.0-92fac7ac
frontend:
image: nginx:1.19.2
networks:
- proxy
deploy:
restart_policy:
condition: on-failure
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}"
# Redirect from EXTRA_DOMAINS to DOMAIN
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- coop-cloud.${STACK_NAME}.frontend.version=1.19.2-c628b67d
volumes:
- site_content:/var/www/html/
configs:
- source: nginx_default_conf
target: /etc/nginx/conf.d/default.conf
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
db:
image: "mariadb:10.6"
volumes:
- "mariadb:/var/lib/mysql"
networks:
- backend
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
- MYSQL_DATABASE=site
- MYSQL_USER=site
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
secrets:
- db_password
- db_root_password
deploy:
labels: ['coop-cloud.${STACK_NAME}.db.version=10.6-718cb856']
networks:
backend:
proxy:
external: true
volumes:
mariadb:
site_content:
secrets:
db_root_password:
external: true
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
configs:
entrypoint_conf:
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
nginx_default_conf:
name: ${STACK_NAME}_nginx_default_conf_${NGINX_DEFAULT_CONF_VERSION}
file: default.conf
php_uploads_conf:
name: ${STACK_NAME}_php_uploads_conf_${PHP_UPLOADS_CONF_VERSION}
file: uploads.ini