|
|
@@ -18,7 +18,7 @@ services:
|
|
|
environment:
|
|
|
# Browser needs to access backend directly for CORS requests in Dev mode
|
|
|
- VITE_API_BASE_URL=http://localhost:8000/api/v1
|
|
|
- restart: on-failure
|
|
|
+ restart: always
|
|
|
|
|
|
# ==========================================
|
|
|
# Backend (FastAPI)
|
|
|
@@ -41,12 +41,15 @@ services:
|
|
|
# Also explictly allow 127.0.0.1 and localhost with port 5173
|
|
|
- BACKEND_CORS_ORIGINS=["http://localhost:5173", "http://127.0.0.1:5173", "http://frontend:5173"]
|
|
|
depends_on:
|
|
|
- - db
|
|
|
- - redis
|
|
|
- - hydra
|
|
|
+ db:
|
|
|
+ condition: service_healthy
|
|
|
+ redis:
|
|
|
+ condition: service_healthy
|
|
|
+ hydra:
|
|
|
+ condition: service_started
|
|
|
volumes:
|
|
|
- ./backend:/app # Hot Reload for Backend too
|
|
|
- restart: on-failure
|
|
|
+ restart: always
|
|
|
|
|
|
# ==========================================
|
|
|
# Database (MySQL)
|
|
|
@@ -64,6 +67,12 @@ services:
|
|
|
- "3308:3306"
|
|
|
volumes:
|
|
|
- db_data:/var/lib/mysql
|
|
|
+ healthcheck:
|
|
|
+ test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-u", "uap_user", "-p$$MYSQL_PASSWORD"]
|
|
|
+ interval: 10s
|
|
|
+ timeout: 5s
|
|
|
+ retries: 10
|
|
|
+ start_period: 10s
|
|
|
|
|
|
# ==========================================
|
|
|
# Redis
|
|
|
@@ -73,6 +82,11 @@ services:
|
|
|
ports:
|
|
|
- "6379:6379"
|
|
|
restart: always
|
|
|
+ healthcheck:
|
|
|
+ test: ["CMD", "redis-cli", "ping"]
|
|
|
+ interval: 10s
|
|
|
+ timeout: 5s
|
|
|
+ retries: 5
|
|
|
|
|
|
# ==========================================
|
|
|
# Ory Hydra Services
|
|
|
@@ -83,13 +97,15 @@ services:
|
|
|
- DSN=postgres://hydra:secret@postgresd:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
|
|
|
command: migrate sql -e --yes
|
|
|
depends_on:
|
|
|
- - postgresd
|
|
|
+ postgresd:
|
|
|
+ condition: service_healthy
|
|
|
restart: on-failure
|
|
|
|
|
|
hydra:
|
|
|
image: oryd/hydra:v2.2.0
|
|
|
depends_on:
|
|
|
- - hydra-migrate
|
|
|
+ hydra-migrate:
|
|
|
+ condition: service_completed_successfully
|
|
|
ports:
|
|
|
- "4444:4444"
|
|
|
- "4445:4445"
|
|
|
@@ -121,6 +137,12 @@ services:
|
|
|
- POSTGRES_DB=hydra
|
|
|
volumes:
|
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
+ healthcheck:
|
|
|
+ test: ["CMD-SHELL", "pg_isready -U hydra"]
|
|
|
+ interval: 10s
|
|
|
+ timeout: 5s
|
|
|
+ retries: 5
|
|
|
+ start_period: 10s
|
|
|
|
|
|
volumes:
|
|
|
db_data:
|