-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocker-compose-dev.yml
116 lines (110 loc) · 3.37 KB
/
docker-compose-dev.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
services:
mongo-dev:
image: mongo:7.0.2
restart: on-failure
container_name: mongo-dev
environment:
MONGO_INITDB_DATABASE: dev
MONGO_INITDB_ROOT_USERNAME: dev
MONGO_INITDB_ROOT_PASSWORD: 123456
volumes:
- mongo-volume:/data
entrypoint:
- bash
- -c
- |
echo dev123456 > /data/replica.key
chmod 400 /data/replica.key
chown 999:999 /data/replica.key
cat << EOF > /usr/local/bin/mongo_init.sh
until mongosh --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)' &>/dev/null; do sleep 2; done
sleep 5
mongosh -u $$MONGO_INITDB_ROOT_USERNAME -p $$MONGO_INITDB_ROOT_PASSWORD --eval 'rs.initiate({"_id":"rs0","members":[{"_id":0,"host":"$$(hostname):27017"}]})'
EOF
chmod +x /usr/local/bin/mongo_init.sh && mongo_init.sh &
exec docker-entrypoint.sh mongod --bind_ip_all --replSet rs0 --keyFile /data/replica.key
ports:
- 27017:27017
mariadb-dev:
image: mariadb:10.11
container_name: mariadb-dev
restart: on-failure
environment:
MARIADB_USER: dev
MARIADB_PASSWORD: 123456
MARIADB_DATABASE: dev
MARIADB_ROOT_PASSWORD: dev123456
ports:
- 3306:3306
volumes:
- mariadb-volume:/var/lib/mysql
redis-dev:
image: redis:7.2.3-alpine
container_name: redis-dev
restart: on-failure
command: redis-server --requirepass dev
mem_limit: 128M
ports:
- 6379:6379
nats-dev:
image: nats:2.10
container_name: nats-dev
restart: on-failure
ports:
- "4222:4222"
- "8222:8222"
command: "--js --http_port 8222"
gateway-dev:
image: nginx:latest
container_name: gateway-dev
restart: on-failure
network_mode: host
command:
- sh
- -c
- |
cat << 'EOF' > /etc/nginx/conf.d/default.conf
server {
listen 8080;
server_name localhost;
location = /internal_auth {
internal;
proxy_pass http://localhost:8082/auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_redirect off;
proxy_buffering off;
proxy_read_timeout 10s;
proxy_connect_timeout 5s;
}
location /user {
proxy_pass http://localhost:8081/api;
auth_request /internal_auth;
auth_request_set $$user_id $$upstream_http_x_user_id;
proxy_set_header X-User-Id $$user_id;
}
location /auth {
proxy_pass http://localhost:8082/api;
}
location /doc {
proxy_pass http://localhost:8083/api;
auth_request /internal_auth;
auth_request_set $$user_id $$upstream_http_x_user_id;
proxy_set_header X-User-Id $$user_id;
}
location /collab {
proxy_pass http://localhost:8084/api;
auth_request /internal_auth;
auth_request_set $$user_id $$upstream_http_x_user_id;
proxy_set_header X-User-Id $$user_id;
proxy_http_version 1.1;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
EOF
nginx -g 'daemon off;'
volumes:
mongo-volume:
mariadb-volume: