Production-harden the stack for Hetzner deployment - #2
Open
maximilianschmid wants to merge 1 commit into
Open
Conversation
Split compose into base + dev override + prod override (COMPOSE_FILE in .env selects prod on the server): - Traefik: Let's Encrypt ACME (HTTP-01) in prod, global entrypoint-level HTTP->HTTPS redirect replacing per-site routers, HSTS/security headers, basic auth in front of /typo3 (EOL TYPO3/PHP), phpMyAdmin loopback-only in prod (SSH tunnel) - Apache: default catch-all vhost now denies everything (previously served the parent dir of ALL sites with Indexes on), real-domain ServerAliases, -Indexes, mod_remoteip for real client IPs behind Traefik, ServerTokens Prod - PHP: expose_php off, httponly session cookies, FPM pools sized for 8GB - MySQL: healthcheck gating dependent services, 1G InnoDB buffer pool in prod via compose command override - Ops: json-file log rotation on all services, nightly mysqldump backup script with 14-day retention, "Deploy to Hetzner" runbook in README - Secrets: initdb SQL with real passwords untracked (example template committed), typo3.htpasswd + acme state gitignored; old committed passwords flagged for rotation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the same repo deployable to a Hetzner Cloud VPS (x86, 8 GB, e.g. CPX31) while keeping local dev unchanged. Dev keeps working via the auto-loaded
docker-compose.override.yaml; prod runs withdocker-compose.prod.yaml(selected viaCOMPOSE_FILEin.envon the server).Traefik / TLS
traefik/dynamic-prod.yaml+ resolver flags; mkcert.testsetup moved totraefik/dynamic-dev.yaml*-httprouters)/typo3on all sites (EOL TYPO3/PHP versions) — matches only/typo3and/typo3/..., not/typo3temp//typo3confwhich serve frontend assets127.0.0.1:8081(SSH tunnel)Apache
/var/www/html/(the parent of ALL sites) withOptions Indexes, i.e. a full directory listing for any unmatched Host headerServerAliasentries so one vhost file serves dev + prodmod_remoteiprestores real client IPs behind Traefik; log format uses%a-Indexes,ServerTokens Prod,ServerSignature OffPHP / MySQL
expose_php = Off,session.cookie_httponly = 1, FPM pools sized for 8 GB (max_children 10)commandoverrideOps / secrets
backup/backup-mysql.sh: nightly per-DB dumps, 14-day retention (cron line in README)initdb.d/01-create-databases.sqluntracked (contained plaintext passwords);.exampletemplate committed;typo3.htpasswd+ ACME state gitignored. The previously committed DB passwords are burned and must be rotated on deploy (README covers it)Note: companion fixes live in
wwwroot/(gitignored site content, carried to prod via rsync): each site's.htaccessSSL redirect now checksX-Forwarded-Proto(was an infinite loop behind Traefik on real domains), and the TYPO3 env configs apply the Docker DB/proxy settings for real domains too (previously real domains hit dead Mittwald DB hosts → 500/503).Test plan
docker compose configvalidates for dev and prod file combinations.testand real hostnames at the Apache layer)🤖 Generated with Claude Code