summaryrefslogtreecommitdiff
path: root/ghost/compose.yml
blob: 2dcc82f5face8a23edd570b5c5fd07a0d38f5178 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/main/schema/compose-spec.json
# Based on https://github.com/TryGhost/ghost-docker and https://noted.lol/self-host-ghost/
# I removed caddy and tinnybird
services:

  ghost:
    # Do not alter this without updating the Tinybird Sync container as well
    image: ghost:${GHOST_VERSION:-6-alpine}
    restart: always
    ports: # we need ports for testing
      - 2368:2368
        #expose:
        #- "127.0.0.1:${GHOST_PORT:-2368}"
    # This is required to import current config when migrating
    # IMPORTANT
    # In usual install use .env
    # In case of portainer.io use stack.env
    env_file:
      stack.env
    environment:
      NODE_ENV: production
      url: http://${DOMAIN:?DOMAIN environment variable is required}
      #url: https://${DOMAIN:?DOMAIN environment variable is required} ATM i have not SSL for it
      #admin__url: ${ADMIN_DOMAIN:+https://${ADMIN_DOMAIN}}
      admin__url: ${ADMIN_DOMAIN:+http://${ADMIN_DOMAIN}}
      database__client: mysql
      database__connection__host: ghost-db
      database__connection__user: ${DATABASE_USER:-ghost}
      database__connection__password: ${DATABASE_PASSWORD:?DATABASE_PASSWORD environment variable is required}
      database__connection__database: ghost
    volumes:
      - ${UPLOAD_LOCATION:-./data/ghost}:/var/lib/ghost/content
    depends_on:
      ghost-db:
        condition: service_healthy
      activitypub:
        condition: service_started
        required: false
    networks:
      - ghost_network

  ghost-db:
    image: mysql:8
    restart: always
    expose:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD:?DATABASE_ROOT_PASSWORD environment variable is required}
      MYSQL_USER: ${DATABASE_USER:-ghost}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD:?DATABASE_PASSWORD environment variable is required}
      MYSQL_DATABASE: ghost
      MYSQL_MULTIPLE_DATABASES: activitypub
    volumes:
      - /var/lib/docker/mysql-init-script:/docker-entrypoint-initdb.d
      - ${MYSQL_DATA_LOCATION:-./data/mysql}:/var/lib/mysql
    healthcheck:
      test: mysqladmin ping -p$$MYSQL_ROOT_PASSWORD -h 127.0.0.1
      interval: 1s
      start_period: 30s
      start_interval: 10s
      retries: 120
    networks:
      - ghost_network

  activitypub:
    image: ghcr.io/tryghost/activitypub:1.1.0
    restart: always
    expose:
      - "8080"
    volumes:
      - ${UPLOAD_LOCATION:-./data/ghost}:/opt/activitypub/content
    environment:
      # See https://github.com/TryGhost/ActivityPub/blob/main/docs/env-vars.md
      NODE_ENV: production
      MYSQL_HOST: ghost-db
      MYSQL_USER: ${DATABASE_USER:-ghost}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD:?DATABASE_PASSWORD environment variable is required}
      MYSQL_DATABASE: activitypub
      LOCAL_STORAGE_PATH: /opt/activitypub/content/images/activitypub
      LOCAL_STORAGE_HOSTING_URL: https://${DOMAIN}/content/images/activitypub
    depends_on:
      ghost-db:
        condition: service_healthy
      activitypub-migrate:
        condition: service_completed_successfully
    profiles: [activitypub]
    networks:
      - ghost_network

  # Suporting Services
  activitypub-migrate:
    image: ghcr.io/tryghost/activitypub-migrations:1.1.0
    environment:
      MYSQL_DB: mysql://${DATABASE_USER:-ghost}:${DATABASE_PASSWORD:?DATABASE_PASSWORD environment variable is required}@tcp(ghost-db:3306)/activitypub
    networks:
      - ghost_network
    depends_on:
      ghost-db:
        condition: service_healthy
    profiles: [activitypub]
    restart: no

networks:
  ghost_network:
    name: ghost_network