Fakultas Ilmu Komputer UI

Commit 681ca158 authored by Inigo Ramli's avatar Inigo Ramli
Browse files

Added new NGINX for Docker Swarm

parent 3f048924
Pipeline #83206 passed with stages
in 3 minutes and 2 seconds
version: '2.4'
services:
nginx:
image: nginx:1.19-alpine
ports:
- '80:80'
volumes:
- ./nginx-swarm.conf:/etc/nginx/conf.d/default.conf
\ No newline at end of file
version: '3.9'
services:
web:
image: tbcare/web:${ENVIRONMENT:-staging}
ports:
- '3000:80'
app:
image: tbcare/backend:${ENVIRONMENT:-staging}
ports:
......@@ -16,8 +20,12 @@ services:
- host.docker.internal:host-gateway
volumes:
- staticfiles:/srv/staticfiles
links:
- db:db
depends_on:
- db
environment:
- DEBUG=True
- DEBUG=False
- DATABASE_NAME=tbcare
- DATABASE_HOST=db
- DATABASE_PORT=5432
......@@ -89,6 +97,10 @@ services:
ports:
- "5432:5432"
- "5433:5433"
environment:
- POSTGRES_DB=tbcare
- POSTGRES_USER=patroni_super
- POSTGRES_PASSWORD=patroni_pass
networks:
monitoring:
......
upstream web {
server 10.184.0.3:80;
server 10.184.0.4:80;
server 10.184.0.5:80;
server 10.184.0.6:80;
}
upstream app {
server 10.184.0.3:8000;
server 10.184.0.4:8000;
server 10.184.0.5:8000;
server 10.184.0.6:8000;
}
upstream locust {
server 10.184.0.3:8089;
server 10.184.0.4:8089;
server 10.184.0.5:8089;
server 10.184.0.6:8089;
}
upstream grafana {
server 10.184.0.3:3000;
server 10.184.0.4:3000;
server 10.184.0.5:3000;
server 10.184.0.6:3000;
}
server {
listen 80;
location /locust/ {
server_name_in_redirect off;
rewrite /locust(.*) $1 break;
proxy_redirect off;
proxy_pass http://locust;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /monitoring/ {
server_name_in_redirect off;
rewrite /monitoring(.*) $1 break;
proxy_redirect off;
proxy_pass http://grafana;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
proxy_pass http://app;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
client_max_body_size 2M;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment