Files
moodle/compose.yml

98 lines
3.0 KiB
YAML

version: "3.8"
services:
app:
image: php:8.4-fpm-alpine3.22
volumes:
- site_content:/var/www/html/
- moodledata:/var/www/moodledata
networks:
- backend
- proxy
environment:
- PHP_EXTENSIONS
- APP_ENV
- MOODLE_LANGUAGE=${MOODLE_LANGUAGE:-en}
- MOODLE_TIMEZONE=${MOODLE_TIMEZONE:-Europe/Berlin}
- MOODLE_VERSION=${MOODLE_VERSION:-stable501/moodle-latest-501}
- MOODLE_FULLNAME
- MOODLE_SHORTNAME
- MOODLE_ADMINNAME=${MOODLE_ADMINNAME:-admin}
- MOODLE_ADMIN_PASSWORD_FILE=/run/secrets/admin_password
- MOODLE_ADMINMAIL
- MOODLE_SUMMARY
- MOODLE_SUPPORTMAIL
configs:
- source: php_conf
target: /usr/local/etc/php/conf.d/php.ini
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
- source: moodle_conf
target: /var/www/html/config.php
entrypoint: /docker-entrypoint.sh
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- coop-cloud.${STACK_NAME}.app.version=0.0.1
frontend:
image: nginx:1.20-alpine
networks:
- proxy
- backend
depends_on:
- app
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.redirectscheme.scheme=https"
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.permanent=true"
- coop-cloud.${STACK_NAME}.frontend.version=1.20-c628b67d
volumes:
- site_content:/var/www/html/
configs:
- source: nginx_default_conf
target: /etc/nginx/conf.d/default.conf
environment:
- STACK_NAME
- ROOT_PATH=/var/www/html/public
- DOMAIN
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 1m
networks:
backend:
proxy:
external: true
volumes:
site_content:
moodledata:
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: nginx.conf
template_driver: golang
php_conf:
name: ${STACK_NAME}_php_conf_${PHP_CONF_VERSION}
file: php.ini
moodle_conf:
name: ${STACK_NAME}_moodle_conf_${MOODLE_CONF_VERSION}
file: config-dist.php.tmpl
template_driver: golang