Skip to content

Commit c25e7d3

Browse files
committed
Added load balancing for redundancy
1 parent 0f32b7e commit c25e7d3

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ WORKDIR /etc/nginx/
44

55
RUN rm /etc/nginx/conf.d/default.conf
66

7-
COPY verify-app.conf /etc/nginx/conf.d/
7+
COPY nginx.conf .
88

99
EXPOSE 80

docker-compose.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ services:
77
restart: "always"
88
privileged: true
99
links:
10-
- "webapp:verify-app"
10+
- "webapp1:verify-app1"
11+
- "webapp2:verify-app2"
1112
ports:
1213
- "80:80"
1314

@@ -19,9 +20,20 @@ services:
1920
- DISCORD_API_TOKEN=${DISCORD_API_TOKEN}
2021
- BOT_PREFIX_CHARACTER=${BOT_PREFIX_CHARACTER}
2122

22-
webapp:
23+
webapp1:
2324
build: verify-web/.
24-
container_name: verify-app
25+
container_name: verify-app1
26+
restart: "always"
27+
environment:
28+
- RECAPTCHA_PUBLIC_KEY=${RECAPTCHA_PUBLIC_KEY}
29+
- RECAPTCHA_PRIVATE_KEY=${RECAPTCHA_PRIVATE_KEY}
30+
- CSRF_SECRET_KEY=${CSRF_SECRET_KEY}
31+
- DISCORD_API_TOKEN=${DISCORD_API_TOKEN}
32+
- DISCORD_SERVER_CHANNEL_ID=${DISCORD_SERVER_CHANNEL_ID}
33+
34+
webapp2:
35+
build: verify-web/.
36+
container_name: verify-app2
2537
restart: "always"
2638
environment:
2739
- RECAPTCHA_PUBLIC_KEY=${RECAPTCHA_PUBLIC_KEY}

nginx.conf

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
events {
2+
worker_connections 1024;
3+
}
4+
5+
http {
6+
upstream verify-app {
7+
server verify-app1:8080;
8+
server verify-app2:8080;
9+
}
10+
11+
server {
12+
listen 80;
13+
listen [::]:80;
14+
15+
location / {
16+
proxy_pass http://verify-app/verify;
17+
}
18+
19+
location /verify {
20+
proxy_pass http://verify-app/verify;
21+
}
22+
}
23+
}

verify-app.conf

-12
This file was deleted.

0 commit comments

Comments
 (0)