AML/docs/AML_Backend/docker-compose-local-dev/docker-compose.local.yml

116 lines
4.4 KiB
YAML

# Local development stack for iCON.Abp.FX.HttpApi.Host
#
# docker compose -f docker-compose.local.yml up -d --build
#
# Services:
# mssql - SQL Server 2022 (amd64 under Rosetta on Apple Silicon)
# db-migrator - runs once: applies EF migrations + seeds data, then exits
# httpapi-host - the API; waits for a successful migration before starting
#
# After it is up:
# Swagger : http://localhost:44331/swagger
# DB : localhost,11433 (sa / Aml@Local2026)
# Admin : admin / 1q2w3E*
name: aml-local
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
platform: linux/amd64 # Apple Silicon: requires Rosetta emulation in Docker Desktop
container_name: aml-mssql
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "Aml@Local2026"
MSSQL_PID: "Developer"
ports:
- "11433:1433"
volumes:
- mssql-data:/var/opt/mssql
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -Q \"SELECT 1\" -b"]
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
rabbitmq:
image: rabbitmq:3.13-management # has native arm64, no platform override needed
container_name: aml-rabbitmq
environment:
# Match RabbitMQConfig in appsettings.local.json (user/pass/vhost).
RABBITMQ_DEFAULT_USER: "admin"
RABBITMQ_DEFAULT_PASS: "123456"
RABBITMQ_DEFAULT_VHOST: "bthost"
ports:
# Host ports are shifted to avoid clashing with any other local RabbitMQ
# (e.g. a general dev-infra broker already on 5672/15672). The API talks to
# this broker over the compose network via internal port 5672 regardless.
- "5673:5672" # AMQP (host 5673 -> container 5672)
- "15673:15672" # management UI (http://localhost:15673 admin/123456)
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 10s
timeout: 5s
retries: 20
start_period: 30s
db-migrator:
build:
# Context is the AML_Backend repo root (one level up); this compose file and
# the Dockerfile live in docker-compose-local-dev/.
context: ..
dockerfile: docker-compose-local-dev/Dockerfile.local
target: migrator
image: aml-dbmigrator:local
container_name: aml-dbmigrator
depends_on:
mssql:
condition: service_healthy
environment:
DOTNET_ENVIRONMENT: "Development"
ConnectionStrings__Default: "Server=mssql,1433;Database=AbpAML;User Id=sa;Password=Aml@Local2026;TrustServerCertificate=True;Encrypt=False;"
restart: "no"
httpapi-host:
build:
context: ..
dockerfile: docker-compose-local-dev/Dockerfile.local
target: host
image: aml-httpapi-host:local
container_name: aml-httpapi-host
depends_on:
mssql:
condition: service_healthy
rabbitmq:
condition: service_healthy
db-migrator:
condition: service_completed_successfully
ports:
- "44331:44331"
volumes:
# ABP commercial license token (from `abp login`). The runtime license
# check reads /root/.abp/cli/access-token.bin; without it the host aborts
# (ABP-LIC-0008). Generate once with: abp login <user> -o <org> -p <pwd>
- "${HOME}/.abp/cli:/root/.abp/cli:ro"
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "http://+:44331"
ConnectionStrings__Default: "Server=mssql,1433;Database=AbpAML;User Id=sa;Password=Aml@Local2026;TrustServerCertificate=True;Encrypt=False;"
# IdentityServer issuer / self URL must match the URL used by the browser.
App__SelfUrl: "http://localhost:44331"
AuthServer__Authority: "http://localhost:44331"
AuthServer__RequireHttpsMetadata: "false"
# RabbitMQ: use the bundled broker service and run the background consumer.
AppConfig__RabbitMQConfig__HostName: "rabbitmq"
AppConfig__RabbitMQConfig__EnableConsumer: "true"
# iCS is a separate iCON service (not in this repo). Point at the shared stag
# instance so document/survey/engine features work without running iCS locally.
# (Requires the iCS credentials in appsettings.local.json to be valid on stag.)
AppConfig__iCS__iCSRootUrl: "https://stag-abp-api.iconsz.com/"
# Still unavailable locally: Elasticsearch-backed sanction sync.
AppConfig__JobConfig__SanctionJob__Enabled: "false"
restart: unless-stopped
volumes:
mssql-data: