Part 2 exercises
This commit is contained in:
parent
108f52dbd5
commit
ad09df6e2b
16 changed files with 266 additions and 0 deletions
38
Part2/Exercise08/docker-compose.yml
Normal file
38
Part2/Exercise08/docker-compose.yml
Normal file
|
@ -0,0 +1,38 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:15.2-alpine
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
container_name: db
|
||||
volumes:
|
||||
- ./data:/var/lib/postgresql/data
|
||||
|
||||
backend:
|
||||
image: example-backend:1.14
|
||||
environment:
|
||||
- REDIS_HOST=cache
|
||||
- POSTGRES_HOST=db
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
container_name: back
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
frontend:
|
||||
image: example-frontend:1.14
|
||||
container_name: front
|
||||
|
||||
redis:
|
||||
image: redis:7.0.9
|
||||
container_name: cache
|
||||
|
||||
proxy:
|
||||
image: nginx:1.23.3
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
ports:
|
||||
- 80:80
|
||||
depends_on:
|
||||
- backend
|
||||
- frontend
|
17
Part2/Exercise08/nginx.conf
Normal file
17
Part2/Exercise08/nginx.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
events { worker_connections 1024; }
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
proxy_pass http://front:5000;
|
||||
}
|
||||
|
||||
# configure here where requests to http://localhost/api/...
|
||||
# are forwarded
|
||||
location /api/ {
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://back:8080/;
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue