forked from PushOCCRP/Push-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-with-nginx.yml
executable file
·191 lines (181 loc) · 4.55 KB
/
docker-compose-with-nginx.yml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
version: '3.8'
services:
# nginx, working as a front-end proxy for uniqush
# we need it for only allowing certain endpoints to be available
nginx:
build: https://github.com/PushOCCRP/watchful-nginx.git
restart: always
ports:
- "80:80"
- "443:443"
depends_on:
- web
# - letsencrypt
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
env_file:
- ./secrets.env
volumes:
- "./.docker/nginx/:/etc/nginx/" # config
- "./.docker/nginx/:/etc/ssl/nginx"
- "./.docker/data/secrets/keys:/srv/data" # dhpram and certs are here
#- "./.docker/data/secrets/keys/live/`ls`:/srv/data/ssl/keys:ro"
- "./.docker/data/secrets/keys/archive/:/etc/letsencrypt/archive"
# - "./.docker/data/secrets/keys/live/$LETSENCRYPT_DOMAINS:/srv/data/ssl/keys"
- "./.docker/data/secrets/keys/live/dailycardinal.pushapp.press:/srv/data/ssl/keys:rw"
- "./public/:/var/public/:ro"
db:
image: postgres:9.6
restart: always
volumes:
- "./.docker/postgres:/data/postgres"
- "./.docker/backups:/data/backups"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- PGDATA=/data/postgres
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
restart: always
volumes:
- ".:/push:cached"
- "rails_cache:/app/tmp/cache"
- "node_modules:/app/node_modules"
- "packs:/app/public/packs"
expose:
- "3000"
ports:
- "3000:3000"
depends_on:
- db
- uniqush
- redis
- sidekiq
- scheduled_jobs
env_file:
- ./secrets.env
environment:
- RAILS_ENV=${RAILS_ENV}
- proxy_images=true
- REDIS_URL=redis://redis:6379/0
- FORCE_SSL=false
entrypoint: /push/entrypoint.sh
tty: true
stdin_open: true
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Run ActiveJobs on a schedule using the Clockwork gem
scheduled_jobs:
build: .
command: bundle exec clockwork ./scheduler.rb
volumes:
- ".:/push:cached"
env_file:
- ./secrets.env
environment:
- RAILS_ENV=production
- proxy_images=true
- FORCE_SSL=false
- REDIS_URL=redis://redis:6379
depends_on:
- db
- redis
- sidekiq
entrypoint: /push/entrypoint_scheduled_jobs.sh
tty: true
stdin_open: true
networks:
- default
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# uniqush itself
uniqush:
build: https://github.com/beevelop/docker-uniqush.git
restart: always
environment:
# this is the default, but let's be explicit here
UNIQUSH_DATABASE_HOST: "redis"
# UNIQUSH_LOGFILE: "/var/log/uniqush"
# UNIQUSH_LOGLEVEL: "verbose"
UNIQUSH_GID: "60001"
UNIQUSH_UID: "60001"
depends_on:
- redis
volumes:
- "./secrets:/secrets:cached"
- "./log/uniqush:/var/log/uniqush:cached"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# The Redis server. This is used for both Sidekiq and Uniqush
redis:
image: redis:buster
restart: always
volumes:
- "./.docker/redis:/data:cached"
command: ["redis-server", "--appendonly", "yes"]
expose:
- "6379"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Sidekiq is used for the ActiveJob backend
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
volumes:
- ".:/push:cached"
depends_on:
- db
- redis
env_file:
- ./secrets.env
environment:
- RAILS_ENV=production
- proxy_images=true
- FORCE_SSL=false
- REDIS_URL=redis://redis:6379/0
tty: true
stdin_open: true
entrypoint: /push/entrypoint_sidekiq.sh
networks:
- default
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
logrotate:
image: blacklabelops/logrotate
restart: always
volumes:
- "./log:/logs"
environment:
- LOGS_DIRECTORIES=/logs
- LOGROTATE_SIZE=5M
- LOGROTATE_CRONSCHEDULE=0 0 * * * *
- LOGROTATE_COMPRESSION=compress
- LOGROTATE_COPIES=5
volumes:
rails_cache:
node_modules:
packs: