CaiWuXiTong/compose.jiangling.yml

170 lines
5.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 服务器只运行本机已加载的镜像,禁止在服务器执行 docker compose build。
services:
db:
image: mariadb:11.4
pull_policy: missing
container_name: caiwu_db
restart: unless-stopped
env_file:
- ./runtime/.env
volumes:
- caiwu_database:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
# 团队共享 MariaDB 实例:逻辑上分为系统配置库和业务镜像库。
# 两个库独立备份、独立表结构,但复用同一套 TLS 入口和团队密码,
# 避免新人再填写第二套连接资料。正式业务库 caiwu_db 继续保持内网隔离。
config_db:
image: mariadb:11.4
pull_policy: missing
container_name: caiwu_config_db
restart: unless-stopped
env_file:
- ./runtime/config-db.env
command:
- "--innodb-buffer-pool-size=4G"
- "--innodb-log-buffer-size=64M"
- "--max-connections=60"
- "--table-open-cache=600"
- "--performance-schema=OFF"
- "--slow-query-log=ON"
- "--long-query-time=5"
- "--min-examined-row-limit=10000"
- "--log-output=FILE"
- "--slow-query-log-file=/var/lib/mysql/caiwu-slow.log"
ports:
- "0.0.0.0:13306:3306"
volumes:
- caiwu_config_database:/var/lib/mysql
- ./config-db-init.sh:/docker-entrypoint-initdb.d/10-config-db-security.sh:ro
networks:
- default
- config_database
mem_limit: 6g
cpus: "4.00"
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
# 大事实表的列式存储。当前发布只提供受控回填能力;页面仍读 MariaDB,
# 直到对应数据集完成行数对账、Parquet 归档并显式切换。
clickhouse:
image: m.daocloud.io/docker.io/clickhouse/clickhouse-server:26.8.2.7-alpine
pull_policy: missing
container_name: caiwu_clickhouse
restart: unless-stopped
env_file:
- ./runtime/clickhouse.env
environment:
TZ: Asia/Shanghai
volumes:
- caiwu_clickhouse_database:/var/lib/clickhouse
- caiwu_clickhouse_logs:/var/log/clickhouse-server
- ./clickhouse-resource-policy.xml:/etc/clickhouse-server/config.d/caiwu-resource-policy.xml:ro
mem_limit: 4g
cpus: "2.00"
ulimits:
nofile:
soft: 262144
hard: 262144
logging:
driver: json-file
options:
max-size: "20m"
max-file: "5"
healthcheck:
test:
- "CMD-SHELL"
- "clickhouse-client --user \"$$CLICKHOUSE_USER\" --password \"$$CLICKHOUSE_PASSWORD\" --query 'SELECT 1' >/dev/null"
interval: 10s
timeout: 5s
retries: 12
start_period: 30s
app:
image: caiwu_akaunting:${IMAGE_TAG:?IMAGE_TAG is required}
pull_policy: never
container_name: caiwu_app
restart: unless-stopped
depends_on:
db:
condition: service_healthy
config_db:
condition: service_healthy
environment:
RUN_MIGRATIONS: ${RUN_MIGRATIONS:-0}
FINANCE_BATCH_WORKER_ENABLED: "1"
SUPPLIER_PAYABLE_MAINTENANCE_DB_CONNECTION: business_mirror
JST_DB_CONNECTION: business_mirror
env_file:
- ./runtime/qiniu-storage.env
- ./runtime/clickhouse.env
ports:
- "127.0.0.1:18088:18088"
volumes:
- ./runtime/.env:/var/www/html/.env
- caiwu_storage:/var/www/html/storage
healthcheck:
test:
- "CMD-SHELL"
# app:ready 验证 Laravel 与数据库;静态资源探针验证 Apache。
# 不请求动态页面,避免健康检查被应用防火墙按高频访问误拦截。
- "runuser -u www-data -- php artisan app:ready --quiet && curl -fsS -o /dev/null http://127.0.0.1:18088/serviceworker.js"
interval: 15s
timeout: 5s
retries: 10
start_period: 45s
# Heavy CLI jobs use a separate cgroup, not Apache's unbounded app container.
batch:
image: caiwu_akaunting:${IMAGE_TAG:?IMAGE_TAG is required}
pull_policy: never
profiles: [batch]
user: www-data
entrypoint: [php, artisan]
command: [list]
restart: "no"
environment:
SUPPLIER_PAYABLE_MAINTENANCE_DB_CONNECTION: business_mirror
JST_DB_CONNECTION: business_mirror
env_file:
- ./runtime/qiniu-storage.env
- ./runtime/clickhouse.env
volumes:
- ./runtime/.env:/var/www/html/.env:ro
- caiwu_storage:/var/www/html/storage
cpus: "1.00"
mem_limit: 3g
memswap_limit: 3g
healthcheck:
disable: true
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
caiwu_database:
name: caiwu_database
caiwu_storage:
name: caiwu_storage
caiwu_config_database:
name: caiwu_config_database
caiwu_clickhouse_database:
name: caiwu_clickhouse_database
caiwu_clickhouse_logs:
name: caiwu_clickhouse_logs
networks:
config_database:
name: caiwu_config_database_network