Skip to content

Commit

Permalink
added nginx as a reverse proxy server
Browse files Browse the repository at this point in the history
  • Loading branch information
rwmutel committed May 13, 2024
1 parent b0b7ba7 commit 93ce8bc
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
25 changes: 17 additions & 8 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ services:
depends_on:
consul:
condition: service_healthy
ports:
- "8000-8002:8080"
# ports:
# - "8000-8002:8080"
auth-db:
image: postgres:latest
environment:
Expand All @@ -61,8 +61,8 @@ services:
condition: service_healthy
environment:
CONSUL_ADDR: consul:8500
ports:
- "8003:8080"
# ports:
# - "8003:8080"
packs-db:
build:
context: src/coffee-packs
Expand Down Expand Up @@ -98,8 +98,8 @@ services:
condition: service_healthy
environment:
CONSUL_ADDR: consul:8500
ports:
- "8004:8080"
# ports:
# - "8004:8080"
shops-db:
build:
context: src/coffee-shops
Expand Down Expand Up @@ -130,8 +130,8 @@ services:
condition: service_healthy
networks:
- kavuny-net
ports:
- "8005:8080"
# ports:
# - "8005:8080"
environment:
CONSUL_ADDR: consul:8500
check-ins-db-1:
Expand Down Expand Up @@ -199,6 +199,15 @@ services:
depends_on:
- zookeeper

nginx:
image: nginx:latest
ports:
- "8080:8080"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
networks:
- kavuny-net

networks:
kavuny-net:
driver: bridge
35 changes: 35 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
server {
listen 8080;
listen [::]:8080;
server_name localhost;

location /packs {
proxy_pass http://coffee-packs:8080/packs;
}

location /coffee-shops {
proxy_pass http://coffee-shops:8080/coffee-shops;
}

location /check-ins {
proxy_pass http://check-ins:8080/check-ins;
}

location ~ ^/auth/(.*)$ {
rewrite ^/auth/(.*)$ /$1 break;
proxy_pass http://auth:8080;
}


location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

}

0 comments on commit 93ce8bc

Please sign in to comment.