Skip to content

Commit

Permalink
Add NGINX
Browse files Browse the repository at this point in the history
  • Loading branch information
barcellos-pedro committed Feb 9, 2024
1 parent fc65d62 commit e040e4d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ networks:
driver: bridge

services:
app:
app: &app_defaults
container_name: backend
build: .
ports:
Expand All @@ -26,6 +26,24 @@ services:
database:
condition: service_healthy

app2:
<<: *app_defaults
container_name: backend_2
ports:
- "8081:8080"

nginx:
container_name: nginx
image: nginx:1.21.6
networks:
- rest-network
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- '80:80'
depends_on:
- app

database:
container_name: database
image: postgres:14.5
Expand Down
12 changes: 12 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
upstream loadbalancer {
server app:8080;
server app2:8080;
}

server {
listen 80;
server_name localhost;
location / {
proxy_pass http://loadbalancer;
}
}

0 comments on commit e040e4d

Please sign in to comment.