diff --git a/docker-compose.yml b/docker-compose.yml index d8515db..3671ad8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -22,6 +24,12 @@ 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 @@ -29,11 +37,13 @@ services: 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 @@ -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 @@ -53,7 +69,8 @@ services: depends_on: - cast_service - movie_service + restart: always volumes: postgres_data_movie: - postgres_data_cast: \ No newline at end of file + postgres_data_cast: