Skip to content

Fixes #4: Resolved 502 Bad Gateway error by updating docker-compose.yml #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ services:
volumes:
- ./movie-service/:/app/
ports:
- 8001:8000
- "8001:8000"
environment:
- DATABASE_URI=postgresql://movie_db_username:movie_db_password@movie_db/movie_db_dev
- CAST_SERVICE_HOST_URL=http://cast_service:8000/api/v1/casts/
depends_on:
- movie_db
movie_db:
condition: service_healthy
restart: always

movie_db:
image: postgres:12.1-alpine
Expand All @@ -22,18 +24,26 @@ services:
- POSTGRES_USER=movie_db_username
- POSTGRES_PASSWORD=movie_db_password
- POSTGRES_DB=movie_db_dev
healthcheck:
test: ["CMD-SHELL", "pg_isready -U movie_db_username"]
interval: 10s
timeout: 5s
retries: 5
restart: always

cast_service:
build: ./cast-service
command: uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
volumes:
- ./cast-service/:/app/
ports:
- 8002:8000
- "8002:8000"
environment:
- DATABASE_URI=postgresql://cast_db_username:cast_db_password@cast_db/cast_db_dev
depends_on:
- cast_db
cast_db:
condition: service_healthy
restart: always

cast_db:
image: postgres:12.1-alpine
Expand All @@ -43,6 +53,12 @@ services:
- POSTGRES_USER=cast_db_username
- POSTGRES_PASSWORD=cast_db_password
- POSTGRES_DB=cast_db_dev
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cast_db_username"]
interval: 10s
timeout: 5s
retries: 5
restart: always

nginx:
image: nginx:latest
Expand All @@ -53,7 +69,8 @@ services:
depends_on:
- cast_service
- movie_service
restart: always

volumes:
postgres_data_movie:
postgres_data_cast:
postgres_data_cast: