about summary refs log tree commit diff
path: root/in-a-box/docker-compose.yml
blob: b97b553c6656ae365534bc5e7ea3427564c4f6ff (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
version: '2.1'
services:

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

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

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

#  es:
#    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
#      - /etc/timezone:/etc/timezone:ro
#      - ./.docker/mastodon/es:/usr/share/elasticsearch/data

  web:
    image: tootsuite/mastodon:latest
    restart: always
    env_file: ./.docker/mastodon/.env.production
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    networks:
      - mstdb_network
      - mstredis_network
#      - mstes_network
      - mstweb_network
    depends_on:
      - mstdb
      - mstredis
#      - mstes
    volumes:
      - ./public/assets:/mastodon/public/assets
      - ./public/packs:/mastodon/public/packs
      - ./public/system:/mastodon/public/system
      - /etc/localtime:/etc/localtime:ro
    tmpfs:
      - /mastodon/tmp/pids:rw,noexec,uid=991,gid=991,mode=0666

  streaming:
    image: tootsuite/mastodon:latest
    restart: always
    env_file: ./.docker/mastodon/.env.production
    command: yarn start
    networks:
      - mstdb_network
      - mstredis_network
      - mststreaming_network
    volumes:
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - db
      - redis

  sidekiq:
    image: tootsuite/mastodon:latest
    restart: always
    env_file: ./.docker/mastodon/.env.production
    command: bundle exec sidekiq -q default -q mailers -q pull -q push
    depends_on:
      - db
      - redis
    networks:
      - external_network
      - mstdb_network
#      - mstes_network
      - mstredis_network
    volumes:
      - ./public/assets:/mastodon/public/assets
      - ./public/packs:/mastodon/public/packs
      - ./public/system:/mastodon/public/system
      - /etc/localtime:/etc/localtime:ro

networks:
  external_network:
#    driver: bridge
#    enable_ipv6: true
#    ipam:
#      driver: default
#      config:
#        - subnet: 172.18.0.0/16
#        - subnet: 2600:1111:2222:3333::/64
  mstdb_network:
    internal: true
  mstredis_network:
    internal: true
  mststreaming_network:
    internal: true
  mstweb_network:
    internal: true
#  mstes_network:
#    internal: true