diff --git a/ghost/.env.example b/ghost/.env.example index 0c1a803..1e1d533 100644 --- a/ghost/.env.example +++ b/ghost/.env.example @@ -1,7 +1,10 @@ -URL= MAIL_HOST= MAIL_PORT=465 MAIL_SECURE=true MAIL_USERNAME= MAIL_PASSWORD= MAIL_FROM= + +DATABASE_ROOT_PASSWORD= +DATABASE_USER=ghost +DATABASE_PASSWORD= diff --git a/ghost/docker-compose.yaml b/ghost/docker-compose.yaml index 04be67a..fd2aa41 100644 --- a/ghost/docker-compose.yaml +++ b/ghost/docker-compose.yaml @@ -1,4 +1,6 @@ networks: + ghost: + external: false caddy: name: caddy driver: bridge @@ -12,11 +14,15 @@ services: labels: - "com.centurylinklabs.watchtower.enable=true" networks: + - ghost - caddy environment: - # DB - database__client: sqlite3 - database__connection__filename: content/data/ghost.db + # DB (MySQL) + database__client: mysql + database__connection__host: db + database__connection__user: ${DATABASE_USER} + database__connection__password: ${DATABASE_PASSWORD} + database__connection__database: ghost # App NODE_ENV: production url: https://aykhans.me @@ -31,9 +37,37 @@ services: mail__options__service: SMTP mail__transport: SMTP volumes: - - ./data:/var/lib/ghost/content + - ./data/ghost:/var/lib/ghost/content + depends_on: + db: + condition: service_healthy logging: driver: "json-file" options: max-size: "100m" max-file: "3" + + db: + image: mysql:8.0.44 + container_name: ghost-db + restart: unless-stopped + networks: + - ghost + environment: + MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD} + MYSQL_USER: ${DATABASE_USER} + MYSQL_PASSWORD: ${DATABASE_PASSWORD} + MYSQL_DATABASE: ghost + volumes: + - ./data/mysql:/var/lib/mysql + healthcheck: + test: + ["CMD-SHELL", "mysqladmin ping -p$$MYSQL_ROOT_PASSWORD -h 127.0.0.1"] + interval: 5s + start_period: 30s + retries: 30 + logging: + driver: "json-file" + options: + max-size: "50m" + max-file: "3"