-
Notifications
You must be signed in to change notification settings - Fork 18
/
docker-compose.yml
131 lines (125 loc) · 3.04 KB
/
docker-compose.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
version: '3.5'
services:
api1: &api
#image: docker.io/akitaonrails/rinhabackendapi:latest
build: ./
environment:
PORT: 3000
DB_HOST: localhost
DB_POOL: 80
RAILS_MAX_THREADS: 40
WEB_CONCURRENCY: 2
RAILS_LOG_LEVEL: warn
RAILS_ENV: production
REDIS_HOST: localhost
REDIS_POOL_SIZE: 50
JOB_BATCH_SIZE: 100
CACHE_EXPIRES_SECONDS: 60
RAILS_LOG_TO_STDOUT: 'true'
RUBY_YJIT_ENABLE: 1
RAILS_MASTER_KEY: 84ec93b5f81d27f8fdf7fc71d7b28e15
hostname: api1
depends_on:
- postgres
- redis
network_mode: host
deploy:
resources:
limits:
cpus: '0.45'
memory: '0.5GB'
api2:
<<: *api
hostname: api2
environment:
PORT: 3001
DB_HOST: localhost
DB_POOL: 80
RAILS_MAX_THREADS: 40
WEB_CONCURRENCY: 2
RAILS_LOG_LEVEL: warn
RAILS_ENV: production
REDIS_HOST: localhost
REDIS_POOL_SIZE: 50
JOB_BATCH_SIZE: 100
CACHE_EXPIRES_SECONDS: 60
RAILS_LOG_TO_STDOUT: 'true'
RUBY_YJIT_ENABLE: 1
RAILS_MASTER_KEY: 84ec93b5f81d27f8fdf7fc71d7b28e15
sidekiq1: &sidekiq
<<: *api
hostname: sidekiq
environment:
DB_HOST: localhost
DB_POOL: 3
RAILS_MAX_THREADS: 1
WEB_CONCURRENCY: 1
RAILS_LOG_LEVEL: warn
RAILS_ENV: production
REDIS_HOST: localhost
REDIS_POOL_SIZE: 1
JOB_BATCH_SIZE: 40
JOB_FLUSH_TIMEOUT: 30
CACHE_EXPIRES_SECONDS: 60
RAILS_LOG_TO_STDOUT: 'true'
RUBY_YJIT_ENABLE: 1
RAILS_MASTER_KEY: 84ec93b5f81d27f8fdf7fc71d7b28e15
command: /rails/bin/bundle exec sidekiq -c 1 -q insert_buffer
deploy:
resources:
limits:
cpus: '0.05'
memory: '0.15GB'
sidekiq2:
<<: *sidekiq
command: /rails/bin/bundle exec sidekiq -c 1 -q flush
nginx: # Load Balancer
image: docker.io/nginx:latest
command: ["nginx", "-g", "daemon off;"]
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- api1
- api2
ulimits:
nproc: 1000000
nofile:
soft: 1000000
hard: 1000000
network_mode: host
deploy:
resources:
limits:
cpus: '0.15'
memory: '0.3GB'
postgres: # Banco de dados
image: docker.io/postgres
hostname: postgres
environment:
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: password
command: postgres -c 'max_connections=450'
volumes:
- ./postgresql.conf:/docker-entrypoint-initdb.d/postgresql.conf
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
network_mode: host
deploy:
resources:
limits:
cpus: '0.35'
memory: '1.3GB'
redis:
image: docker.io/redis:latest
hostname: redis
command: redis-server --save "" --appendonly no --maxclients 20000
network_mode: host
deploy:
resources:
limits:
cpus: '0.05'
memory: '0.1GB'