-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
144 lines (140 loc) · 4.4 KB
/
Copy pathdocker-compose.yml
File metadata and controls
144 lines (140 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# ============================================================
# AirGate Core 生产部署
#
# 推荐用法(一行安装):
# curl -fsSL https://raw.githubusercontent.com/DouDOU-start/airgate-core/master/deploy/install.sh | bash
#
# 手动用法:
# 1. 在本目录(或任意空目录)准备 docker-compose.yml + .env:
# cp .env.example .env && vim .env
# # 必填:DB_PASSWORD / REDIS_PASSWORD / JWT_SECRET
# 2. 启动前先建好 ./data 子目录(避免 docker 以 root 创建后续读写不便):
# mkdir -p data/postgres data/redis data/plugins data/uploads data/assets
# 3. 启动:
# docker compose up -d
# 4. 查看日志:
# docker compose logs -f core
# 5. 停止:
# docker compose down # 保留 ./data
# rm -rf data # 同时清理数据(慎用)
#
# 数据持久化:所有数据写入当前目录下的 ./data,方便备份、迁移、查看大小。
# 镜像版本通过 AIRGATE_IMAGE_TAG 控制,默认 latest。
# 如需本地构建(开发用),改用 docker-compose.dev.yml。
# ============================================================
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
command:
- postgres
- -c
- max_wal_size=${POSTGRES_MAX_WAL_SIZE:-4GB}
- -c
- checkpoint_timeout=${POSTGRES_CHECKPOINT_TIMEOUT:-15min}
- -c
- checkpoint_completion_target=${POSTGRES_CHECKPOINT_COMPLETION_TARGET:-0.9}
environment:
POSTGRES_USER: airgate
POSTGRES_PASSWORD: ${DB_PASSWORD:-airgate}
POSTGRES_DB: airgate
PGDATA: /var/lib/postgresql/data/pgdata
TZ: ${TZ:-Asia/Shanghai}
volumes:
- ./data/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U airgate -d airgate"]
interval: 10s
timeout: 5s
retries: 20
ulimits:
nofile:
soft: 65536
hard: 65536
networks:
- airgate-net
redis:
image: redis:8-alpine
restart: unless-stopped
command:
- redis-server
- --save
- "60"
- "1"
- --appendonly
- "yes"
- --requirepass
- ${REDIS_PASSWORD:?REDIS_PASSWORD is required, see .env.example}
environment:
TZ: ${TZ:-Asia/Shanghai}
# 仅供 healthcheck 内部读取,不影响 Redis 自身鉴权(鉴权由 --requirepass 决定)
REDIS_PASSWORD: ${REDIS_PASSWORD:?REDIS_PASSWORD is required, see .env.example}
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD-SHELL", "redis-cli -a \"$$REDIS_PASSWORD\" --no-auth-warning ping | grep -q PONG"]
interval: 10s
timeout: 3s
retries: 20
ulimits:
nofile:
soft: 65536
hard: 65536
networks:
- airgate-net
core:
image: ${AIRGATE_IMAGE:-ghcr.io/doudou-start/airgate-core}:${AIRGATE_IMAGE_TAG:-latest}
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
# ---- 数据库 ----
DB_HOST: postgres
DB_PORT: 5432
DB_USER: airgate
DB_PASSWORD: ${DB_PASSWORD:-airgate}
DB_NAME: airgate
DB_SSLMODE: disable
# ---- Redis ----
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:?REDIS_PASSWORD is required, see .env.example}
# ---- 安全 ----
JWT_SECRET: ${JWT_SECRET:-change-me-in-production}
API_KEY_SECRET: ${API_KEY_SECRET:-}
# ---- 运行时 ----
GIN_MODE: release
LOG_LEVEL: info
LOG_FORMAT: text
WEB_DIR: frontend
PLUGINS_DIR: /app/data/plugins
ASSETS_DIR: /app/data/assets
PLUGINS_MARKETPLACE_GITHUB_TOKEN: ${PLUGINS_MARKETPLACE_GITHUB_TOKEN:-}
TZ: ${TZ:-Asia/Shanghai}
volumes:
# 插件目录持久化(重建容器不丢已安装插件)
- ./data/plugins:/app/data/plugins
# 上传文件持久化
- ./data/uploads:/app/data/uploads
# 运行时图片资产持久化
- ./data/assets:/app/data/assets
ports:
- "${BIND_HOST:-0.0.0.0}:${PORT:-9517}:9517"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:9517/healthz"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
ulimits:
nofile:
soft: 65536
hard: 65536
networks:
- airgate-net
networks:
airgate-net:
driver: bridge