about summary refs log tree commit diff
path: root/deploy/docker-compose.yml
blob: ed09d0c0ee3c8304411b8db731d1de4f1441b9bc (plain) (blame)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
version: '2.4'
services:

  nginx:
    restart: always
    image: nginx:mainline-alpine
    ports:
      - 80:80
      - 443:443
    environment:
      - NGINX_HOST=plural.cafe
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./.docker/nginx/nginx.conf:/etc/nginx/conf.d/web.template:ro
      - ./.acme.sh/${NGINX_HOST}_ecc/${NGINX_HOST}.cer:/etc/ssl/cert.pem:ro
      - ./.acme.sh/${NGINX_HOST}_ecc/${NGINX_HOST}.key:/etc/ssl/privkey.pem:ro
      - ./.acme.sh/${NGINX_HOST}_ecc/fullchain.cer:/etc/ssl/fullchain.pem:ro
      - ./public:/var/www/html:ro
    command: sh -c "envsubst \"`env | awk -F = '{printf \" $$%s\", $$1}'`\" < /etc/nginx/conf.d/web.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
    networks:
      - external_network
      - mstweb_network
      - mststreaming_network
      - netdata_network

  netdata:
    restart: always
    image: titpetric/netdata
    cap_add:
      - SYS_PTRACE
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./.docker/netdata:/etc/netdata
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - netdata_network

  ipv6nat:
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /lib/modules:/lib/modules:ro
    privileged: true
    network_mode: host
    image: robbertkl/ipv6nat

  mstdb:
    restart: always
    image: postgres:9.6-alpine
    networks:
      - mstdb_network
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./.docker/mastodon/db:/var/lib/postgresql/data

  mstredis:
    restart: always
    image: redis:4-alpine
    networks:
      - mstredis_network
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./.docker/mastodon/redis:/data

  mstes:
    restart: always
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.3
    environment:
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - mstes_network
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./.docker/mastodon/es:/usr/share/elasticsearch/data

  mstweb:
    image: pluralcafe/mastodon:stable
    restart: always
    env_file: ./.docker/mastodon/.env.production
    environment:
      - WEB_CONCURRENCY=1
      - MAX_THREADS=15
    command: sh -c "rm -f /mastodon/tmp/pids/server.pid; rake db:migrate; bundle exec rails s -p 3000 -b '0.0.0.0'"
    networks:
      - mstdb_network
      - mstes_network
      - mstredis_network
      - mstweb_network
    depends_on:
      - mstdb
      - mstredis
      - mstes
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./public/system:/mastodon/public/system

  mststreaming:
    image: pluralcafe/mastodon:stable
    restart: always
    env_file: .docker/mastodon/.env.production
    command: yarn start
    networks:
      - mstdb_network
      - mstredis_network
      - mststreaming_network
    depends_on:
      - mstdb
      - mstredis

  mstsidekiq:
    image: pluralcafe/mastodon:stable
    restart: always
    env_file: .docker/mastodon/.env.production
    environment:
      - DB_POOL=10
    command: bundle exec sidekiq -q default -q mailers -q pull -q push
    depends_on:
      - mstdb
      - mstes
      - mstredis
    networks:
      - external_network
      - mstdb_network
      - mstes_network
      - mstredis_network
    volumes:
      - ./public/system:/mastodon/public/system

  mstbarkeep:
    image: pluralcafe/barkeep
    restart: always
    env_file: ./.docker/mastodon/.env.ambassador
    command: yarn start
    depends_on:
      - mstdb
    networks:
      - external_network
      - mstdb_network

networks:
  external_network:
    driver: bridge
    enable_ipv6: true
    ipam:
      driver: default
      config:
        - subnet: 172.18.0.0/16
        - subnet: fd00:dead:beef::/48
  mstdb_network:
    internal: true
  mstes_network:
    internal: true
  mstredis_network:
    internal: true
  mststreaming_network:
    internal: true
  mstweb_network:
    internal: true
  netdata_network:
    internal: true