-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-loadbalance.yaml
167 lines (162 loc) · 4.52 KB
/
docker-compose-loadbalance.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
version: "3.9"
services:
web:
build:
context: .
dockerfile: ./src/load-balancer/Dockerfile
command: "--image akatranlp/web-service:latest --replicas 2 --network backend"
environment:
PORT: 8080
HEALTH_TIMEOUT: 200
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- backend
proxy:
ports:
- "8080:8080"
build:
context: .
dockerfile: ./src/reverse-proxy/Dockerfile
environment:
PORT: 8080
HEALTH_TIMEOUT: 200
CONFIG_FILE: $CONFIG_FILE
networks:
- backend
user:
build:
context: .
dockerfile: ./src/load-balancer/Dockerfile
command: "--image akatranlp/user-service:latest --replicas 2 --network backend"
environment:
AUTH_IS_ACTIVE: $AUTH_IS_ACTIVE
GRPC_COMMUNICATION: false
PORT: 8080
HEALTH_TIMEOUT: 200
JWT_ACCESS_PRIVATE_KEY: $JWT_ACCESS_PRIVATE_KEY
JWT_ACCESS_PUBLIC_KEY: $JWT_ACCESS_PUBLIC_KEY
JWT_REFRESH_PRIVATE_KEY: $JWT_REFRESH_PRIVATE_KEY
JWT_REFRESH_PUBLIC_KEY: $JWT_REFRESH_PUBLIC_KEY
JWT_ACCESS_TOKEN_EXPIRATION: $JWT_ACCESS_TOKEN_EXPIRATION
JWT_REFRESH_TOKEN_EXPIRATION: $JWT_REFRESH_TOKEN_EXPIRATION
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: $POSTGRES_DB
TZ: Europe/Berlin
networks:
- backend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
db:
condition: service_healthy
test-data:
condition: service_healthy
book:
build:
context: .
dockerfile: ./src/load-balancer/Dockerfile
command: "--image akatranlp/book-service:latest --replicas 2 --network backend"
environment:
AUTH_IS_ACTIVE: $AUTH_IS_ACTIVE
GRPC_COMMUNICATION: false
AUTH_SERVICE_ENDPOINT: http://user:8080/validate-token
TRANSACTION_SERVICE_ENDPOINT: http://transaction:8080/check-chapter-bought
PORT: 8080
HEALTH_TIMEOUT: 200
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: $POSTGRES_DB
TZ: Europe/Berlin
networks:
- backend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
db:
condition: service_healthy
test-data:
condition: service_healthy
transaction:
build:
context: .
dockerfile: ./src/load-balancer/Dockerfile
command: "--image akatranlp/transaction-service:latest --replicas 2 --network backend"
environment:
AUTH_IS_ACTIVE: $AUTH_IS_ACTIVE
GRPC_COMMUNICATION: false
AUTH_SERVICE_ENDPOINT: http://user:8080/validate-token
BOOK_SERVICE_ENDPOINT: http://book:8080/valdiate-chapter-id
USER_SERVICE_ENDPOINT: http://user:8080/move-user-amount
PORT: 8080
HEALTH_TIMEOUT: 200
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: $POSTGRES_DB
TZ: Europe/Berlin
networks:
- backend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
db:
condition: service_healthy
test-data:
condition: service_healthy
test-data:
build:
context: .
dockerfile: ./src/load-balancer/Dockerfile
command: "--image akatranlp/test-data-service:latest --replicas 2 --network backend"
environment:
RESET_ON_INIT: true
TEST_DATA_USER_PASSWORD: $TEST_DATA_USER_PASSWORD
TEST_DATA_FILE: $TEST_DATA_FILE
PORT: 8080
HEALTH_TIMEOUT: 200
POSTGRES_HOST: db
POSTGRES_PORT: 5432
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: $POSTGRES_DB
TZ: Europe/Berlin
networks:
- backend
volumes:
- /var/run/docker.sock:/var/run/docker.sock
healthcheck:
test: curl -q --fail http://localhost:8080/health
interval: 5s
timeout: 5s
start_period: 5s
retries: 5
depends_on:
db:
condition: service_healthy
db:
image: postgres:latest
environment:
POSTGRES_USER: $POSTGRES_USER
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_DB: $POSTGRES_DB
TZ: Europe/Berlin
networks:
- backend
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
backend:
driver: bridge
name: backend