完善 Docker 部署骨架并整理开源发布资料
- 调整 Dockerfile 与入口脚本,拆分应用、MySQL、Redis 的部署职责 - 新增 docker-compose、docker ignore 与 Docker 环境变量示例 - 重写 README 并补充 Docker 部署说明与第三方资产说明 - 将后台示例账号与 webhook token 改为安全占位值,移除弱口令默认兜底
This commit is contained in:
@@ -3,6 +3,10 @@ set -euo pipefail
|
||||
|
||||
mkdir -p /app/logs
|
||||
|
||||
# 首次启动时自动生成最小可运行配置:
|
||||
# 1. 若用户已经通过挂载文件提供 config.yaml,则完全尊重现有配置;
|
||||
# 2. 若未提供,则根据 .env / compose 环境变量生成一份安全模板;
|
||||
# 3. 模板中的敏感值继续走环境变量占位,避免把真实密钥写进镜像层。
|
||||
if [ ! -f /app/config.yaml ]; then
|
||||
cat > /app/config.yaml <<EOF
|
||||
environment: "\${ABOT_ENVIRONMENT:production}"
|
||||
@@ -11,22 +15,22 @@ plugin_dir: "\${ABOT_PLUGIN_DIR:plugins}"
|
||||
db_config:
|
||||
pool_name: "\${ABOT_DB_POOL_NAME:wechat_boot_pool}"
|
||||
pool_size: "\${ABOT_DB_POOL_SIZE:10}"
|
||||
host: "\${DB_HOST:127.0.0.1}"
|
||||
port: "\${DB_PORT:3306}"
|
||||
prot: "\${DB_PORT:3306}"
|
||||
user: "\${DB_USER:root}"
|
||||
password: "\${DB_PASSWORD}"
|
||||
database: "\${DB_NAME:message_archive}"
|
||||
host: "\${ABOT_DB_HOST:127.0.0.1}"
|
||||
port: "\${ABOT_DB_PORT:3306}"
|
||||
prot: "\${ABOT_DB_PORT:3306}"
|
||||
user: "\${ABOT_DB_USER:root}"
|
||||
password: "\${ABOT_DB_PASSWORD}"
|
||||
database: "\${ABOT_DB_NAME:message_archive}"
|
||||
charset: "utf8mb4"
|
||||
use_unicode: true
|
||||
get_warnings: true
|
||||
pool_reset_session: true
|
||||
|
||||
redis_config:
|
||||
host: "\${REDIS_HOST:127.0.0.1}"
|
||||
port: "\${REDIS_PORT:6379}"
|
||||
password: "\${REDIS_PASSWORD:}"
|
||||
db: "\${REDIS_DB:0}"
|
||||
host: "\${ABOT_REDIS_HOST:127.0.0.1}"
|
||||
port: "\${ABOT_REDIS_PORT:6379}"
|
||||
password: "\${ABOT_REDIS_PASSWORD:}"
|
||||
db: "\${ABOT_REDIS_DB:0}"
|
||||
decode_responses: true
|
||||
|
||||
email_config:
|
||||
@@ -45,6 +49,10 @@ wx_config:
|
||||
EOF
|
||||
fi
|
||||
|
||||
# wechat_ipad 配置保留为独立文件:
|
||||
# 1. 兼容现有代码对 wechat_ipad/config.toml 的读取方式;
|
||||
# 2. 仅在文件缺失时生成,避免覆盖用户已有的登录态与设备信息;
|
||||
# 3. 这样既支持 Docker 一键部署,也不强行改动用户本地运行方式。
|
||||
mkdir -p /app/wechat_ipad
|
||||
if [ ! -f /app/wechat_ipad/config.toml ]; then
|
||||
cat > /app/wechat_ipad/config.toml <<EOF
|
||||
@@ -58,13 +66,4 @@ login_time = ""
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -d /var/lib/mysql/mysql ]; then
|
||||
mysql_install_db --user=mysql --ldata=/var/lib/mysql >/dev/null
|
||||
fi
|
||||
|
||||
service mariadb start
|
||||
service redis-server start
|
||||
|
||||
mysql -uroot -e "CREATE DATABASE IF NOT EXISTS \`${DB_NAME}\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
|
||||
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user