Rust Build / Rustfmt (push) Successful in 36s
Rust Build / Test Suite (push) Successful in 1m9s
Rust Build / Check (push) Successful in 1m14s
Rust Build / Clippy (push) Successful in 2m25s
Rust Build / build (push) Successful in 3m5s
Rust Build / Rustfmt (pull_request) Successful in 40s
Rust Build / Check (pull_request) Successful in 2m12s
Rust Build / Clippy (pull_request) Successful in 1m30s
Rust Build / Test Suite (pull_request) Successful in 2m39s
Rust Build / build (pull_request) Successful in 2m51s
Reviewed-on: phoenix/textsender-api#5
130 lines
4.4 KiB
YAML
130 lines
4.4 KiB
YAML
version: '3.8' # Use a recent version
|
|
|
|
services:
|
|
# --- Web API ---
|
|
api:
|
|
build: # Tells docker-compose to build the Dockerfile in the current directory
|
|
context: .
|
|
ssh: ["default"] # Uses host's SSH agent
|
|
container_name: textsender_api # Optional: Give the container a specific name
|
|
ports:
|
|
# Map host port 8000 to container port 3000 (adjust as needed)
|
|
- "9081:9081"
|
|
env_file:
|
|
- .env
|
|
depends_on:
|
|
main_db:
|
|
condition: service_healthy
|
|
networks:
|
|
- textsender_api-network
|
|
restart: unless-stopped # Optional: Restart policy
|
|
|
|
# --- Web API auth ---
|
|
auth_api:
|
|
build:
|
|
# Might want to change the naming convention at some point for the repo names. textsender-models, textsender-auth, textesender-api, etc
|
|
context: ../textsender-auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile)
|
|
ssh: ["default"] # Uses host's SSH agent
|
|
dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name
|
|
container_name: auth_api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "9080:9080"
|
|
# environment:
|
|
# Environment variables your API needs, e.g., database connection
|
|
# Add other necessary environment variables
|
|
env_file:
|
|
- ../textsender-auth/.env
|
|
depends_on:
|
|
auth_db:
|
|
condition: service_healthy
|
|
networks:
|
|
- textsender_api-network
|
|
# Optional: Mount local code for development (live reload)
|
|
# volumes:
|
|
# - ./path/to/your/web-api-repo:/app
|
|
|
|
# --- songparser 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
|
|
# --- textsender_api web api db ---
|
|
main_db:
|
|
image: postgres:18.3-alpine # Use an official Postgres image (Alpine variant is smaller)
|
|
container_name: textsender_api_db # Optional: Give the container a specific name
|
|
environment:
|
|
# These MUST match the user, password, and database name in the DATABASE_URL above
|
|
POSTGRES_USER: ${POSTGRES_MAIN_USER:-textsender_api}
|
|
POSTGRES_PASSWORD: ${POSTGRES_MAIN_PASSWORD:-password}
|
|
POSTGRES_DB: ${POSTGRES_MAIN_DB:-textsender_api_db}
|
|
volumes:
|
|
# Persist database data using a named volume
|
|
- postgres_data:/var/lib/postgresql
|
|
ports:
|
|
# Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging)
|
|
- "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 # Optional: Restart policy
|
|
networks:
|
|
- textsender_api-network
|
|
|
|
# --- textsender_api web auth api db ---
|
|
auth_db:
|
|
image: postgres:18.4-alpine # Use an official Postgres image (Alpine variant is smaller)
|
|
container_name: textsender_api_auth_db # Optional: Give the container a specific name
|
|
environment:
|
|
# These MUST match the user, password, and database name in the DATABASE_URL above
|
|
POSTGRES_USER: ${POSTGRES_AUTH_USER:-textsender_api_op}
|
|
POSTGRES_PASSWORD: ${POSTGRES_AUTH_PASSWORD:-password}
|
|
POSTGRES_DB: ${POSTGRES_AUTH_DB:-textsender_api_auth_db}
|
|
volumes:
|
|
# Persist database data using a named volume
|
|
- postgres_data_auth:/var/lib/postgresql
|
|
ports:
|
|
# Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging)
|
|
- "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 # Optional: Restart policy
|
|
networks:
|
|
- textsender_api-network
|
|
|
|
# Define the named volume for data persistence
|
|
volumes:
|
|
postgres_data:
|
|
driver: local # Use the default local driver
|
|
postgres_data_auth:
|
|
driver: local # Use the default local driver
|
|
|
|
# Define the network (optional, but good practice)
|
|
networks:
|
|
textsender_api-network:
|
|
driver: bridge
|