31290517ba
docker-entrypoint-initdb.d only applies db/init.sql, and only on a brand new volume - existing installs never got db/migrations/*.sql applied unless someone ran them by hand. This bit twice this session (qr-oss's own init.sql was missing a migration, and qr-vip's live DB was two migrations behind after a code deploy). scripts/migrate.php now runs automatically on every container start via a new entrypoint wrapper, applying any not-yet-recorded migration - safe to run repeatedly since every migration file already checks information_schema before altering. Also caught in the process: Dockerfile.fpm (the production image) never installed phpmailer/phpmailer, unlike the dev Dockerfile - meaning self-registration's password email has been silently fatal-erroring in production since the nginx+php-fpm switch.
70 lines
2.3 KiB
YAML
70 lines
2.3 KiB
YAML
services:
|
|
qrforge-app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
restart: "unless-stopped"
|
|
environment:
|
|
TYPE: "${TYPE:-docker}"
|
|
QRCODE_GENERATOR: "${QRCODE_GENERATOR:-internal-chillerlan.qrcode}"
|
|
BASE_URL: "${BASE_URL:-http://localhost}"
|
|
DATABASE_HOST: "qrforge-db"
|
|
DATABASE_PORT: "3306"
|
|
DATABASE_NAME: "${DATABASE_NAME:-qrcode}"
|
|
DATABASE_USER: "${DATABASE_USER:-qrcode}"
|
|
DATABASE_PASSWORD: "${DATABASE_PASSWORD:?zet DATABASE_PASSWORD in .env}"
|
|
DATABASE_PREFIX: "${DATABASE_PREFIX:-}"
|
|
DATABASE_CHARSET: "${DATABASE_CHARSET:-utf8}"
|
|
ALLOW_SELF_REGISTRATION: "${ALLOW_SELF_REGISTRATION:-false}"
|
|
# Defaults here are dev-convenience only (mailhog, no auth) - a real deployment's
|
|
# .env must override MAIL_HOST/MAIL_SMTP_AUTH/MAIL_USERNAME/MAIL_PASSWORD
|
|
# explicitly, same as DATABASE_PASSWORD above already requires.
|
|
MAIL_HOST: "${MAIL_HOST:-mailhog}"
|
|
MAIL_PORT: "${MAIL_PORT:-1025}"
|
|
MAIL_ENCRYPTION: "${MAIL_ENCRYPTION:-}"
|
|
MAIL_SMTP_AUTH: "${MAIL_SMTP_AUTH:-false}"
|
|
MAIL_USERNAME: "${MAIL_USERNAME:-}"
|
|
MAIL_PASSWORD: "${MAIL_PASSWORD:-}"
|
|
MAIL_FROM_ADDRESS: "${MAIL_FROM_ADDRESS:-noreply@example.com}"
|
|
MAIL_FROM_NAME: "${MAIL_FROM_NAME:-QRForge}"
|
|
ports:
|
|
- "80:80"
|
|
depends_on:
|
|
qrforge-db:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./data/qrcode-storage:/var/www/qrcode-storage
|
|
networks:
|
|
- qrforge-network
|
|
|
|
mailhog:
|
|
image: "mailhog/mailhog:v1.0.1"
|
|
restart: "unless-stopped"
|
|
ports:
|
|
- "8025:8025" # web UI: http://localhost:8025
|
|
networks:
|
|
- qrforge-network
|
|
|
|
qrforge-db:
|
|
image: "mysql:8.0"
|
|
restart: "unless-stopped"
|
|
volumes:
|
|
- ./data/mysql:/var/lib/mysql
|
|
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD:?zet MYSQL_ROOT_PASSWORD in .env}"
|
|
MYSQL_DATABASE: "${DATABASE_NAME:-qrcode}"
|
|
MYSQL_USER: "${DATABASE_USER:-qrcode}"
|
|
MYSQL_PASSWORD: "${DATABASE_PASSWORD:?zet DATABASE_PASSWORD in .env}"
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
networks:
|
|
- qrforge-network
|
|
|
|
networks:
|
|
qrforge-network:
|
|
driver: bridge
|