Docker Compose generator for an app with a database
Get a docker-compose.yml for your app with a database, Redis and automatic HTTPS through Caddy. Passwords are generated in your browser and go into a separate .env file.
What you get
- Each service restarts on its own and keeps its data in a named volume, so updates and reboots lose nothing.
- Health checks make the app wait until the database accepts connections.
- The app reaches the others by service name: postgres, mariadb and redis.
Updating
- docker compose pull && docker compose up -d fetches new images and recreates what changed.
- Back up before a major database upgrade: docker compose exec postgres pg_dump -U app app > backup.sql.
- Pin major versions, as in postgres:17-alpine, so an update never jumps a major version by itself.
Ports and the firewall
Docker publishes ports by writing its own firewall rules, past ufw. With Caddy in front, only 80 and 443 are published, and the app and the databases stay on the internal network.
More tools
- VPS ping test
- VPS cost calculator
- chmod calculator
- Cron generator
- Subnet calculator
- SSH key generator
- Bandwidth calculator
- What is my IP
- Cloud-init generator
- SSH hardening generator
- UFW firewall generator
- Fail2ban config generator
- WireGuard config generator
- Nginx reverse proxy generator
- Systemd service generator
- Swap size calculator
- DNS lookup