124 lines
2.8 KiB
YAML
124 lines
2.8 KiB
YAML
services:
|
|
api:
|
|
build:
|
|
context: ./devices-api
|
|
dockerfile: Dockerfile
|
|
container_name: handheld-api
|
|
networks:
|
|
- handheld-net
|
|
ports:
|
|
- "8080:8080"
|
|
volumes:
|
|
- ./devices-api:/app
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
- DB_HOST=postgres
|
|
- DB_PORT=5432
|
|
- DB_NAME=handheld_devices
|
|
- DB_USER=devices_user
|
|
- DB_PASSWORD=devices_password
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -q -O - http://localhost:8080/health/live || exit 1"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: handheld-postgres
|
|
networks:
|
|
- handheld-net
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
POSTGRES_DB: handheld_devices
|
|
POSTGRES_USER: devices_user
|
|
POSTGRES_PASSWORD: devices_password
|
|
volumes:
|
|
- ./postgres_data:/var/lib/postgresql/data
|
|
- ./devices-api/migrations/001_create_devices.sql:/docker-entrypoint-initdb.d/001_create_devices.sql
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U devices_user -d handheld_devices"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: handheld-redis
|
|
networks:
|
|
- handheld-net
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: handheld-frontend
|
|
networks:
|
|
- handheld-net
|
|
ports:
|
|
- "8090:8090"
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- API_URL=http://localhost:8080
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -q -O - http://localhost:8090/health || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 5s
|
|
|
|
worker:
|
|
build:
|
|
context: ./devices-worker
|
|
dockerfile: Dockerfile
|
|
container_name: handheld-worker
|
|
networks:
|
|
- handheld-net
|
|
volumes:
|
|
- ./devices-worker:/app
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
- DB_HOST=postgres
|
|
- DB_PORT=5432
|
|
- DB_NAME=handheld_devices
|
|
- DB_USER=devices_user
|
|
- DB_PASSWORD=devices_password
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pgrep -f 'worker.lua' || exit 1"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
|
|
networks:
|
|
handheld-net:
|
|
name: handheld-devices
|