chore(deploy): add replication deployment assets
Build docker and publish / build (20.15.1) (push) Successful in 5m52s

This commit is contained in:
2026-04-28 05:22:48 -07:00
parent 0ec0e2b9d2
commit 68c7b0a8ec
12 changed files with 1077 additions and 9 deletions
+31 -9
View File
@@ -1,6 +1,6 @@
# PPanel 服务部署 (云端/无源码版)
# 使用方法:
# 1. 确保已将 docker-compose.cloud.yml, configs/, loki/, grafana/, prometheus/, tempo/ 目录上传到服务器同一目录
# 1. 确保已将 docker-compose.cloud.yml, configs/, mysql/, redis/, loki/, grafana/, prometheus/, tempo/ 目录上传到服务器同一目录
# 2. 确保 configs/ 目录下有 ppanel.yaml 配置文件(参考 etc/ppanel.yaml
# 3. 确保 logs/ cache/ tempo_data/ 目录存在 (mkdir -p logs cache tempo_data)
# 4. 运行: docker-compose -f docker-compose.cloud.yml up -d
@@ -8,7 +8,8 @@
# 网络说明:
# ppanel-server 使用 host 网络(可出外网,访问 MySQL/Redis/Tempo 用 127.0.0.1
# 监控服务(MySQL/Redis/Loki/Tempo/Grafana/Prometheus)在 ppanel_net bridge 网络中
# MySQL(3306)/Redis(6379)/Tempo(4317) 将端口映射到 127.0.0.1ppanel-server 通过 host 网络访问
# MySQL(3306)/Redis(6379)/Tempo(4317) 映射到宿主机ppanel-server 通过 host 网络访问
# 远程从库/远程业务实例访问 MySQL/Redis 时,必须在宿主机防火墙只放行从机公网 IP
# 监控端口绑定 127.0.0.1,需通过 SSH 隧道或 Nginx 反代访问
#
# 未来多开 ppanel-server 时:
@@ -50,17 +51,19 @@ services:
max-file: "3"
# ----------------------------------------------------
# 2. MySQL Database
# 2. MySQL Database (主库)
# ----------------------------------------------------
mysql:
image: mysql:8.0
container_name: ppanel-mysql
restart: always
ports:
- "3306:3306" # 仅宿主机可访问,ppanel-server(host网络)通过127.0.0.1连接
- "${MYSQL_PUBLISH_ADDR:-0.0.0.0}:3306:3306" # 远程从库需要访问;请用防火墙只放行从机公网 IP
environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD:?请在 .env 文件中设置 MYSQL_ROOT_PASSWORD}"
MYSQL_DATABASE: "ppanel"
MYSQL_DATABASE: "${MYSQL_DATABASE:-ppanel}"
MYSQL_REPLICATION_USER: "${MYSQL_REPLICATION_USER:?请在 .env 文件中设置 MYSQL_REPLICATION_USER}"
MYSQL_REPLICATION_PASSWORD: "${MYSQL_REPLICATION_PASSWORD:?请在 .env 文件中设置 MYSQL_REPLICATION_PASSWORD}"
TZ: Asia/Shanghai
command:
- --default-authentication-plugin=mysql_native_password
@@ -70,7 +73,15 @@ services:
- --innodb_flush_log_at_trx_commit=2
- --innodb_io_capacity=5000
- --max_connections=5000
- --server-id=1
- --log-bin=mysql-bin
- --binlog-format=ROW
- --gtid-mode=ON
- --enforce-gtid-consistency=ON
- --log-replica-updates=ON
volumes:
- ./mysql/master.cnf:/etc/mysql/conf.d/replication.cnf:ro
- ./mysql/init-master.sh:/docker-entrypoint-initdb.d/10-init-master.sh:ro
- mysql_data:/var/lib/mysql
ulimits:
nproc: 65535
@@ -97,12 +108,22 @@ services:
image: redis:8.2.1
container_name: ppanel-redis
restart: always
environment:
REDIS_PASSWORD: "${REDIS_PASSWORD:?请在 .env 文件中设置 REDIS_PASSWORD}"
ports:
- "127.0.0.1:6379:6379" # 仅宿主机可访问,ppanel-server(host网络)通过127.0.0.1连接
- "${REDIS_PUBLISH_ADDR:-0.0.0.0}:6379:6379" # 远程业务实例/Redis从库需要访问;请用防火墙只放行从机公网 IP
command:
- redis-server
- --tcp-backlog 65535
- --maxmemory-policy allkeys-lru
- --tcp-backlog
- "65535"
- --maxmemory-policy
- allkeys-lru
- --requirepass
- "${REDIS_PASSWORD:?请在 .env 文件中设置 REDIS_PASSWORD}"
- --masterauth
- "${REDIS_PASSWORD:?请在 .env 文件中设置 REDIS_PASSWORD}"
- --appendonly
- "yes"
volumes:
- redis_data:/data
ulimits:
@@ -113,7 +134,7 @@ services:
networks:
- ppanel_net
healthcheck:
test: ["CMD", "redis-cli", "ping"]
test: ["CMD-SHELL", "redis-cli -a \"$${REDIS_PASSWORD}\" ping | grep -q PONG"]
interval: 10s
timeout: 5s
retries: 5
@@ -255,6 +276,7 @@ services:
restart: always
environment:
- REDIS_ADDR=redis://redis:6379
- REDIS_PASSWORD=${REDIS_PASSWORD:?请在 .env 文件中设置 REDIS_PASSWORD}
networks:
- ppanel_net
depends_on: