-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-production.yml
149 lines (140 loc) · 3.01 KB
/
docker-compose-production.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
x-common-env-vars: &common-env-vars
RAILS_MASTER_KEY: ${RAILS_MASTER_KEY}
REDIS_URL: redis://redis-db:6379
DATABASE_URL: postgres://root:${POSTGRES_PASSWORD:-password}@postgres-db/
MINIO_ENDPOINT: http://${MINIO_PUBLIC_IP:-127.0.0.1}:9000
x-resource-limits: &resource-limits
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
x-replicas: &replicas
mode: replicated
endpoint_mode: vip
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 3
window: 120s
update_config:
delay: 10s
parallelism: 2
failure_action: rollback
monitor: 1m
max_failure_ratio: 0.3
order: start-first
services:
web:
image: ghcr.io/unclesp1d3r/cipherswarm:latest
ports:
- "80:80"
environment:
<<: *common-env-vars
depends_on:
- redis-db
- postgres-db
- minio
- sidekiq
volumes:
- storage:/rails/storage
networks:
- frontend
- backend
deploy:
resources:
<<: *resource-limits
healthcheck:
test: [ "CMD-SHELL", "curl --fail http://localhost/up || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
postgres-db:
image: postgres
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
volumes:
- postgres:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: pg_isready
interval: 2s
timeout: 5s
retries: 30
networks:
- backend
deploy:
resources:
<<: *resource-limits
minio:
image: bitnami/minio
ports:
- '9000:9000'
- '9001:9001'
volumes:
- minio:/bitnami/minio/data
networks:
- frontend
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
- MINIO_DEFAULT_BUCKETS=application
deploy:
resources:
<<: *resource-limits
healthcheck:
test: [ "CMD-SHELL", "curl --fail http://localhost:9000/minio/health/live || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
redis-db:
image: redis
networks:
- backend
deploy:
restart_policy:
condition: on-failure
resources:
<<: *resource-limits
volumes:
- redis:/data
healthcheck:
test: [ "CMD-SHELL", "redis-cli ping | grep PONG" ]
interval: 1s
timeout: 3s
retries: 5
sidekiq:
image: ghcr.io/unclesp1d3r/cipherswarm:latest
command: bundle exec sidekiq
environment:
<<: *common-env-vars
depends_on:
- redis-db
- postgres-db
- minio
volumes:
- storage:/rails/storage
networks:
- backend
deploy:
replicas: 4
<<: *replicas
resources:
<<: *resource-limits
healthcheck:
test: [ "CMD-SHELL", "curl --fail http://localhost:7433 || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
networks:
backend:
frontend:
volumes:
storage:
postgres:
redis:
minio:
driver: local