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

130 lines
5.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 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:
# This stack lives at the monorepo root, OUTSIDE the AML_Backend repo, so the
# build context points into that subproject and the Dockerfile is referenced
# from here. appsettings.local.json is no longer inside the context, so it is
# passed in as a named additional context (`localcfg`) instead.
context: ../AML_Backend
dockerfile: ../docker-compose-local-dev/Dockerfile.local
additional_contexts:
localcfg: .
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: ../AML_Backend
dockerfile: ../docker-compose-local-dev/Dockerfile.local
additional_contexts:
localcfg: .
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"
# 内部 token 请求AbpTokenService → connect/token本地 host 仅监听 HTTP
# 覆盖 appsettings 的 https 默认值,否则 TenantRenewal / 建租户等内部调用会 SSL 握手失败。
AppConfig__General__ApiLocalhostUrl: "http://localhost:44331/"
# 在线支付appsettings.local.json 里 Portal.IsMockupPayment=true会让 CreateOrder 建单后
# 立即自造一次 QFPay 回调把订单置为已支付 —— 这样前端永远走不到收银台。置 false 才能测
# 真实支付链(下单 → 收银台 → PaymentWebhook → 订单转已支付)。
# 若只想跳过支付、快速拿到已开通的租户,改回 "true" 即可。
AppConfig__Portal__IsMockupPayment: "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: