igovnow
ca25328ef4
This Docker Compose file defines a multi-service application stack, including: Caddy: A web server and reverse proxy Ghost: A blogging platform Gitea: A self-hosted Git service MySQL: A database for Ghost Varnish: A caching HTTP reverse proxy Key features: Uses YAML anchors for reusable logging and healthcheck configurations Defines two networks: "web" (external) and "internal" (bridge) Specifies volume mounts for persistent data storage Implements healthchecks for all services Uses secrets for sensitive information (MySQL password) Sets up dependencies between services Services overview: Caddy: Handles incoming HTTP/HTTPS traffic Ghost: Main blogging application, configured to use MySQL Gitea: Git repository hosting service MySQL: Database backend for Ghost Varnish: Caching layer, likely sitting in front of Ghost The configuration also defines volumes for MySQL, Ghost, and Gitea data, and uses a secret for the Ghost MySQL password.
122 lines
2.7 KiB
YAML
122 lines
2.7 KiB
YAML
x-logging: &default-logging
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
x-healthcheck: &default-healthcheck
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 5s
|
|
|
|
networks:
|
|
web:
|
|
external: true
|
|
internal:
|
|
external: false
|
|
driver: bridge
|
|
|
|
services:
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
|
|
- ./caddy/data:/data
|
|
- ./caddy/config:/config
|
|
networks:
|
|
- web
|
|
- internal
|
|
logging: *default-logging
|
|
healthcheck:
|
|
<<: *default-healthcheck
|
|
test: ["CMD", "nc", "-z", "localhost", "80"]
|
|
|
|
ghost:
|
|
image: ghost:5.89-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
- url=https://speedyweedyops.org
|
|
- database__client=mysql
|
|
- database__connection__host=mysql
|
|
- database__connection__user=ghostmysqluser
|
|
- database__connection__password=/run/secrets/ghost_mysql_password
|
|
- database__connection__database=dbghost
|
|
secrets:
|
|
- ghost_mysql_password
|
|
volumes:
|
|
- myghostapp:/var/lib/ghost/content
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
- mysql
|
|
- caddy
|
|
logging: *default-logging
|
|
healthcheck:
|
|
<<: *default-healthcheck
|
|
test: ["CMD", "nc", "-z", "localhost", "2368"]
|
|
|
|
gitea:
|
|
image: gitea/gitea:1.22
|
|
restart: unless-stopped
|
|
volumes:
|
|
- giteadata:/data
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
- caddy
|
|
logging: *default-logging
|
|
healthcheck:
|
|
<<: *default-healthcheck
|
|
test: ["CMD", "nc", "-z", "localhost", "3000"]
|
|
|
|
mysql:
|
|
image: mysql:8.4.2
|
|
restart: always
|
|
environment:
|
|
- MYSQL_RANDOM_ROOT_PASSWORD=true
|
|
- MYSQL_DATABASE=dbghost
|
|
- MYSQL_PASSWORD=/run/secrets/ghost_mysql_password
|
|
- MYSQL_USER=ghostmysqluser
|
|
secrets:
|
|
- ghost_mysql_password
|
|
volumes:
|
|
- ./mysql/my.cnf:/etc/mysql/my.cnf
|
|
- mysqldb:/var/lib/mysql
|
|
networks:
|
|
- internal
|
|
logging: *default-logging
|
|
healthcheck:
|
|
<<: *default-healthcheck
|
|
test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/localhost/3306"]
|
|
interval: 10s
|
|
start_period: 30s
|
|
|
|
varnish:
|
|
image: varnish:7.3
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./varnish/default.vcl:/etc/varnish/default.vcl:ro
|
|
environment:
|
|
- VARNISH_SIZE=512M
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
- ghost
|
|
logging: *default-logging
|
|
healthcheck:
|
|
<<: *default-healthcheck
|
|
test: ["CMD", "varnishadm", "ping"]
|
|
interval: 10s
|
|
|
|
volumes:
|
|
mysqldb:
|
|
myghostapp:
|
|
giteadata:
|
|
|
|
secrets:
|
|
ghost_mysql_password:
|
|
file: ./ghost_mysql_password |