-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
196 lines (185 loc) · 6.43 KB
/
docker-compose.yaml
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
192
193
194
195
196
version: "3.7"
networks:
internal:
web:
services:
proxy:
image: traefik:2.4
command:
- "--log.level=INFO"
- "--api=true"
- "--api.dashboard=true"
- "--api.insecure=true"
- "--providers.docker"
- "--entrypoints.web.address=:80"
# - "--entryPoints.websecure.address=:443"
# - "--certificatesResolvers.app.acme.httpchallenge=true"
# - "--certificatesresolvers.app.acme.httpchallenge.entrypoint=web"
# - "--certificatesresolvers.app.acme.email=sample@localhost.io"
# - "--certificatesresolvers.app.acme.storage=/letsencrypt/acme.json"
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 8080
published: 8080
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
networks:
- internal
- web
app:
image: node:14-slim
# build:
# context: .
# target: development
restart: always
labels:
- "traefik.enable=true"
# - "traefik.http.routers.app.rule=Host(`app.io`)"
- "traefik.http.routers.app_rt.service=app_srv"
- "traefik.http.routers.app_rt.rule=Path(`/app/api`)"
- "traefik.http.routers.app_rt.middlewares=strip-url@docker"
# - "traefik.http.routers.app.entrypoints=web"
# - "traefik.http.routers.app.tls.certresolver=app"
- "traefik.http.services.app_srv.loadbalancer.server.port=5000"
- "traefik.http.services.app_srv.loadbalancer.server.scheme=h2c"
- "traefik.http.middlewares.strip-url.stripprefix.prefixes=/app/api"
working_dir: /app
environment:
PORT: 5000
NODE_ENV: development
DB_MASTER_CONNECTION_URL: postgresql://repl_user:repl_password@192.168.1.104:5432/app
DB_SLAVE_ONE_CONNECTION_URL: postgresql://repl_user:repl_password@192.168.1.104:5433/app
DB_SLAVE_TWO_CONNECTION_URL: postgresql://repl_user:repl_password@192.168.1.104:5434/app
DB_SLAVE_THREE_CONNECTION_URL: postgresql://repl_user:repl_password@192.168.1.104:5435/app
REDIS_URL: redis://redis:6379?password=bnf9cU34naC9
ports:
- "9229:9229"
- "5000:5000"
volumes:
- ./:/app
networks:
- internal
command: ["npm", "run", "start"]
db_master:
image: docker.io/bitnami/postgresql:11
restart: always
environment:
POSTGRESQL_REPLICATION_MODE: master
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_USERNAME: postgres
POSTGRESQL_PASSWORD: mysecretpassword
POSTGRESQL_DATABASE: app
ALLOW_EMPTY_PASSWORD: 'yes'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# volumes:
# - postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- internal
db_slave_one:
image: docker.io/bitnami/postgresql:11
restart: always
environment:
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_MASTER_HOST: db_master
POSTGRESQL_MASTER_PORT_NUMBER: 5432
ALLOW_EMPTY_PASSWORD: 'yes'
depends_on:
- db_master
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# volumes:
# - postgres-data:/var/lib/postgresql/data
ports:
- "5433:5432"
networks:
- internal
db_slave_two:
image: docker.io/bitnami/postgresql:11
restart: always
environment:
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_MASTER_HOST: db_master
POSTGRESQL_MASTER_PORT_NUMBER: 5432
ALLOW_EMPTY_PASSWORD: 'yes'
depends_on:
- db_master
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# volumes:
# - postgres-data:/var/lib/postgresql/data
ports:
- "5434:5432"
networks:
- internal
db_slave_three:
image: docker.io/bitnami/postgresql:11
restart: always
environment:
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_MASTER_HOST: db_master
POSTGRESQL_MASTER_PORT_NUMBER: 5432
ALLOW_EMPTY_PASSWORD: 'yes'
depends_on:
- db_master
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
# volumes:
# - postgres-data:/var/lib/postgresql/data
ports:
- "5435:5432"
networks:
- internal
adminer:
image: adminer:latest
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.storage_rt.entrypoints=web"
- "traefik.http.routers.storage_rt.middlewares=strip_url_adminer@docker"
- "traefik.http.routers.storage_rt.rule=PathPrefix(`/adminer`)"
- "traefik.http.services.storage.loadbalancer.server.port=8080"
- "traefik.http.middlewares.strip_url_adminer.stripprefix.prefixes=/adminer"
networks:
- internal
redis:
image: bitnami/redis:6.0-debian-10
environment:
- REDIS_PASSWORD=bnf9cU34naC9
networks:
- internal
volumes:
postgres-data: