# /opt/stacks/moodle/docker-compose.yml services: # ── MariaDB per a Moodle ───────────────── db: container_name: moodle-db image: mariadb:10.11 restart: unless-stopped environment: TZ: Europe/Madrid MYSQL_ROOT_PASSWORD: '${MYSQL_ROOT_PASSWORD}' MYSQL_DATABASE: moodle MYSQL_USER: moodle MYSQL_PASSWORD: '${MYSQL_PASSWORD}' command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci volumes: - moodle_db:/var/lib/mysql healthcheck: test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] interval: 10s timeout: 5s retries: 5 start_period: 30s networks: [moodle_net] # ── Moodle — Aplicació principal ───────── moodle: container_name: moodle image: moodlehq/moodle-php-apache:8.2-bullseye restart: unless-stopped environment: TZ: Europe/Madrid volumes: # Codi de Moodle i config.php - moodle_html:/var/www/html # Dades dels usuaris (fitxers pujats, cache, sessions) - moodle_data:/var/www/moodledata ports: - "127.0.0.1:8084:80" # Només local → via Nginx Proxy Manager healthcheck: test: ["CMD", "curl", "-f", "http://localhost/login/index.php"] interval: 30s timeout: 10s retries: 5 start_period: 120s depends_on: db: condition: service_healthy networks: [moodle_net, shared_net] volumes: moodle_db: moodle_html: moodle_data: networks: moodle_net: driver: bridge shared_net: external: true name: shared_net