105 lines
3.2 KiB
YAML
105 lines
3.2 KiB
YAML
# Test stack only. Only the API publishes a host port.
|
|
x-app: &app
|
|
image: ${DEPLOY_IMAGE:?Set DEPLOY_IMAGE}
|
|
read_only: true
|
|
cap_drop: [ALL]
|
|
security_opt: [no-new-privileges:true]
|
|
tmpfs: ['/tmp:rw,noexec,nosuid,size=64m']
|
|
mem_limit: 512m
|
|
pids_limit: 128
|
|
volumes: [config:/config]
|
|
environment: &app-env
|
|
DATABASE_URL: postgresql+psycopg://adcloud:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/adcloud
|
|
PROFILE_BACKEND: cassandra
|
|
CASSANDRA_HOSTS: cassandra
|
|
CASSANDRA_TLS: 'false'
|
|
COOKIE_SECURE: 'false'
|
|
CORS_ORIGINS: ${DEPLOY_CORS_ORIGINS:-http://localhost:3000,http://localhost:5173,http://localhost:5174,http://47.76.92.159:18081}
|
|
depends_on: &app-deps
|
|
postgres: {condition: service_healthy}
|
|
cassandra-init: {condition: service_completed_successfully}
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-bookworm
|
|
restart: unless-stopped
|
|
mem_limit: 512m
|
|
environment:
|
|
POSTGRES_DB: adcloud
|
|
POSTGRES_USER: adcloud
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}
|
|
volumes: [postgres-data:/var/lib/postgresql/data]
|
|
healthcheck:
|
|
test: [CMD-SHELL, 'pg_isready -U adcloud -d adcloud']
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 30
|
|
cassandra:
|
|
image: cassandra:4.1
|
|
restart: unless-stopped
|
|
mem_limit: 2g
|
|
environment:
|
|
CASSANDRA_CLUSTER_NAME: AdcloudTest
|
|
CASSANDRA_DC: datacenter1
|
|
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
|
|
MAX_HEAP_SIZE: 768M
|
|
HEAP_NEWSIZE: 256M
|
|
volumes: [cassandra-data:/var/lib/cassandra]
|
|
healthcheck:
|
|
test: [CMD-SHELL, "cqlsh -e 'SELECT release_version FROM system.local' 127.0.0.1"]
|
|
start_period: 60s
|
|
interval: 10s
|
|
timeout: 10s
|
|
retries: 30
|
|
cassandra-init:
|
|
image: ${DEPLOY_IMAGE:?Set DEPLOY_IMAGE}
|
|
entrypoint: [python, /app/scripts/init_cassandra.py]
|
|
mem_limit: 256m
|
|
depends_on:
|
|
cassandra: {condition: service_healthy}
|
|
api:
|
|
<<: *app
|
|
restart: unless-stopped
|
|
ports: ['${DEPLOY_BIND_IP:-0.0.0.0}:${DEPLOY_PORT:-18080}:8000']
|
|
worker:
|
|
<<: *app
|
|
restart: unless-stopped
|
|
command: [adcloud-profiles]
|
|
healthcheck:
|
|
disable: true
|
|
event-worker:
|
|
<<: *app
|
|
restart: unless-stopped
|
|
command: [adcloud-events]
|
|
healthcheck:
|
|
disable: true
|
|
integration:
|
|
image: ${TEST_IMAGE:?Set TEST_IMAGE}
|
|
profiles: [ci]
|
|
depends_on: *app-deps
|
|
environment:
|
|
ADCLOUD_REQUIRE_INTEGRATION: 'true'
|
|
ADCLOUD_TEST_POSTGRES_URL: postgresql+psycopg://adcloud:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@postgres:5432/adcloud
|
|
ADCLOUD_TEST_CASSANDRA_HOSTS: cassandra
|
|
ADCLOUD_TEST_CASSANDRA_KEYSPACE: adcloud
|
|
ADCLOUD_TEST_CASSANDRA_TLS: 'false'
|
|
smoke:
|
|
<<: *app
|
|
profiles: [checks]
|
|
entrypoint: [python, /app/scripts/smoke_api.py]
|
|
command: [--base-url, 'http://api:8000', --require-projection]
|
|
volumes: [config:/config:ro]
|
|
depends_on:
|
|
api: {condition: service_healthy}
|
|
worker: {condition: service_started}
|
|
event-worker: {condition: service_started}
|
|
healthcheck:
|
|
disable: true
|
|
|
|
volumes:
|
|
postgres-data: {}
|
|
cassandra-data: {}
|
|
config:
|
|
name: ${CONFIG_VOLUME:-${COMPOSE_PROJECT_NAME:-adcloud-test}-config}
|
|
external: ${CONFIG_EXTERNAL:-false}
|