116 lines
2.8 KiB
YAML
116 lines
2.8 KiB
YAML
version: '3.8' # Use a recent version
|
|
|
|
services:
|
|
# --- Web API ---
|
|
api:
|
|
build:
|
|
context: .
|
|
ssh: ["default"]
|
|
container_name: textsender_api
|
|
ports:
|
|
- "9081:9081"
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
main_db:
|
|
condition: service_healthy
|
|
networks:
|
|
- textsender_api-network
|
|
restart: unless-stopped
|
|
|
|
# --- Auth API ---
|
|
auth_api:
|
|
build:
|
|
context: ../textsender_auth
|
|
ssh: ["default"]
|
|
dockerfile: Dockerfile
|
|
container_name: auth_api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "9080:9080"
|
|
env_file:
|
|
- ../textsender_auth/.env
|
|
depends_on:
|
|
auth_db:
|
|
condition: service_healthy
|
|
networks:
|
|
- textsender_api-network
|
|
|
|
# --- catapult service ---
|
|
catapult:
|
|
build:
|
|
context: ../catapult
|
|
ssh: ["default"]
|
|
dockerfile: Dockerfile
|
|
container_name: catapult
|
|
restart: unless-stopped
|
|
env_file:
|
|
- ../catapult/.env
|
|
depends_on:
|
|
- api
|
|
- main_db
|
|
- auth_api
|
|
- auth_db
|
|
networks:
|
|
- textsender_api-network
|
|
|
|
|
|
# PostgreSQL Database Service
|
|
main_db:
|
|
image: postgres:18.4-alpine
|
|
container_name: textsender_api_db
|
|
environment:
|
|
# These MUST match the user, password, and database name in the DATABASE_URL above
|
|
POSTGRES_USER: ${DB_MAIN_USER:-textsender_api}
|
|
POSTGRES_PASSWORD: ${DB_MAIN_PASSWORD:-password}
|
|
POSTGRES_DB: ${DB_MAIN_NAME:-textsender_api_db}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
# Checks if Postgres is ready to accept connections
|
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
restart: always
|
|
networks:
|
|
- textsender_api-network
|
|
|
|
# --- textsender_api web auth api db ---
|
|
auth_db:
|
|
image: postgres:18.4-alpine
|
|
container_name: textsender_api_auth_db
|
|
environment:
|
|
# These MUST match the user, password, and database name in the DATABASE_URL above
|
|
POSTGRES_USER: ${DB_AUTH_USER:-textsender_auth}
|
|
POSTGRES_PASSWORD: ${DB_AUTH_PASSWORD:-password}
|
|
POSTGRES_DB: ${DB_AUTH_NAME:-textsender_auth_db}
|
|
volumes:
|
|
# Persist database data using a named volume
|
|
- postgres_data_auth:/var/lib/postgresql
|
|
ports:
|
|
- "5433:5432"
|
|
healthcheck:
|
|
# Checks if Postgres is ready to accept connections
|
|
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
restart: always
|
|
networks:
|
|
- textsender_api-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
postgres_data_auth:
|
|
driver: local
|
|
|
|
networks:
|
|
textsender_api-network:
|
|
driver: bridge
|