init
This commit is contained in:
commit
5f8428a318
1688 files changed
+39031
No files matched your search
@@ -0,0 +1,37 @@
|
||||
# 复制为 .env,放在 1Panel 编排工作目录(可与 compose 同目录)
|
||||
# 服务器只需:本 .env + compose yaml + 数据目录,不要源码
|
||||
|
||||
# ---------- 镜像(改程序 = 本机重新 push,服务器 pull 新 tag)----------
|
||||
GATEWAY_IMAGE=ghcr.io/kadxy/weixin-ilink-gateway:latest
|
||||
# 换成你的仓库,例如 docker.io/你的用户名/record-bot:latest
|
||||
RECORD_BOT_IMAGE=docker.io/YOUR_DOCKERHUB_USER/record-bot:latest
|
||||
|
||||
# ---------- 密钥 ----------
|
||||
GATEWAY_API_KEY=change-me
|
||||
|
||||
# ---------- 端口 ----------
|
||||
GATEWAY_PORT=29527
|
||||
RECORD_BOT_PORT=5080
|
||||
|
||||
# ---------- 数据(绝对路径更稳,如 /opt/wechatbot/data/...)----------
|
||||
GATEWAY_DATA_DIR=./data/gateway
|
||||
RECORD_DATA_DIR=./data/record-bot
|
||||
|
||||
# ---------- 互相访问(分开部署、同一 Docker 网络 wechatbot 时)----------
|
||||
WEBHOOK_URLS=http://record-bot:8080/webhook/weixin
|
||||
GATEWAY_BASE_URL=http://weixin-ilink-gateway:3000
|
||||
|
||||
# 若两个编排不在同一网络,改用宿主机端口,例如:
|
||||
# WEBHOOK_URLS=http://host.docker.internal:5080/webhook/weixin
|
||||
# GATEWAY_BASE_URL=http://host.docker.internal:29527
|
||||
|
||||
DOCKER_NETWORK=wechatbot
|
||||
|
||||
RECORD_WEBHOOK_TOKEN=
|
||||
GATEWAY_WEBHOOK_TOKEN=
|
||||
MAX_DOWNLOAD_SIZE_MB=128
|
||||
|
||||
LLM_ENABLED=true
|
||||
LLM_API_KEY=
|
||||
LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
LLM_MODEL=qwen3.8-max
|
||||
@@ -0,0 +1,37 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
cd /d "%~dp0.."
|
||||
|
||||
REM ============================================================
|
||||
REM 本机构建并推送镜像;服务器只 docker compose pull && up -d
|
||||
REM 用法:
|
||||
REM deploy\build-push.bat
|
||||
REM set RECORD_BOT_IMAGE=youruser/record-bot:1.0.1 && deploy\build-push.bat
|
||||
REM ============================================================
|
||||
|
||||
if "%RECORD_BOT_IMAGE%"=="" (
|
||||
echo Set RECORD_BOT_IMAGE first, e.g.:
|
||||
echo set RECORD_BOT_IMAGE=youruser/record-bot:latest
|
||||
echo deploy\build-push.bat
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo === Build record-bot → %RECORD_BOT_IMAGE% ===
|
||||
docker build -t "%RECORD_BOT_IMAGE%" -f record-bot\Dockerfile record-bot
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
echo.
|
||||
echo === Push %RECORD_BOT_IMAGE% ===
|
||||
docker push "%RECORD_BOT_IMAGE%"
|
||||
if errorlevel 1 (
|
||||
echo Push failed. Login first: docker login
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo OK. On server:
|
||||
echo docker compose -f record-bot.compose.yaml pull
|
||||
echo docker compose -f record-bot.compose.yaml up -d
|
||||
echo Or in 1Panel: 重建/拉取镜像后重启容器。
|
||||
endlocal
|
||||
@@ -0,0 +1,54 @@
|
||||
# 本机构建并推送;服务器只 pull 镜像,无需源码
|
||||
# 用法:
|
||||
# $env:RECORD_BOT_IMAGE = "youruser/record-bot:1.0.1"
|
||||
# .\deploy\build-push.ps1
|
||||
# 可选同时构建自己的 gateway(一般用官方镜像即可):
|
||||
# $env:GATEWAY_IMAGE = "youruser/weixin-ilink-gateway:latest"
|
||||
# .\deploy\build-push.ps1 -IncludeGateway
|
||||
|
||||
param(
|
||||
[switch]$IncludeGateway
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location $root
|
||||
|
||||
if (-not $env:RECORD_BOT_IMAGE) {
|
||||
Write-Host @"
|
||||
请先设置镜像名,例如:
|
||||
`$env:RECORD_BOT_IMAGE = 'youruser/record-bot:latest'
|
||||
.\deploy\build-push.ps1
|
||||
"@
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "=== Build record-bot → $($env:RECORD_BOT_IMAGE) ==="
|
||||
docker build -t $env:RECORD_BOT_IMAGE -f record-bot/Dockerfile record-bot
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
Write-Host "=== Push $($env:RECORD_BOT_IMAGE) ==="
|
||||
docker push $env:RECORD_BOT_IMAGE
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Push 失败,先执行: docker login"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
if ($IncludeGateway) {
|
||||
if (-not $env:GATEWAY_IMAGE) {
|
||||
Write-Host "IncludeGateway 需要设置 GATEWAY_IMAGE"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "=== Build gateway → $($env:GATEWAY_IMAGE) ==="
|
||||
docker build -t $env:GATEWAY_IMAGE -f weixin-ilink-gateway/Dockerfile weixin-ilink-gateway
|
||||
docker push $env:GATEWAY_IMAGE
|
||||
}
|
||||
|
||||
Write-Host @"
|
||||
|
||||
完成。服务器更新步骤(无源码):
|
||||
docker compose -f deploy/record-bot.compose.yaml pull
|
||||
docker compose -f deploy/record-bot.compose.yaml up -d
|
||||
|
||||
1Panel: 打开编排 → 拉取镜像 / 重建 即可。
|
||||
"@
|
||||
@@ -0,0 +1,36 @@
|
||||
# 仅 gateway — 服务器上不需要源码,只拉镜像
|
||||
# 1Panel:容器 → 编排,粘贴本文件;配合 .env
|
||||
#
|
||||
# 首次:docker network create wechatbot (与 record-bot 共用,可选)
|
||||
|
||||
services:
|
||||
gateway:
|
||||
image: ${GATEWAY_IMAGE:-ghcr.io/kadxy/weixin-ilink-gateway:latest}
|
||||
container_name: weixin-ilink-gateway
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${GATEWAY_PORT:-29527}:3000"
|
||||
environment:
|
||||
API_KEY: ${GATEWAY_API_KEY:?set GATEWAY_API_KEY}
|
||||
PORT: "3000"
|
||||
DATA_DIR: /app/data
|
||||
# 分开部署时填 record-bot 对外可达地址,例如 http://127.0.0.1:5080/webhook/weixin
|
||||
# 或同 Docker 网络:http://record-bot:8080/webhook/weixin
|
||||
WEBHOOK_URLS: ${WEBHOOK_URLS:?set WEBHOOK_URLS}
|
||||
WEBHOOK_TOKEN: ${GATEWAY_WEBHOOK_TOKEN:-}
|
||||
MAX_DOWNLOAD_SIZE_MB: ${MAX_DOWNLOAD_SIZE_MB:-128}
|
||||
volumes:
|
||||
- ${GATEWAY_DATA_DIR:-./data/gateway}:/app/data
|
||||
networks:
|
||||
- wechatbot
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:3000/status"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 15s
|
||||
|
||||
networks:
|
||||
wechatbot:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK:-wechatbot}
|
||||
@@ -0,0 +1,39 @@
|
||||
# 仅 record-bot — 服务器上不需要源码,只拉镜像
|
||||
# 1Panel:容器 → 编排,粘贴本文件;配合 .env
|
||||
#
|
||||
# 镜像由本机 build-push 推到仓库后,这里改 RECORD_BOT_IMAGE 即可更新
|
||||
|
||||
services:
|
||||
record-bot:
|
||||
image: ${RECORD_BOT_IMAGE:?set RECORD_BOT_IMAGE e.g. docker.io/you/record-bot:latest}
|
||||
container_name: record-bot
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${RECORD_BOT_PORT:-5080}:8080"
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
TZ: Asia/Shanghai
|
||||
# 分开部署:同网络用 http://weixin-ilink-gateway:3000,或宿主机 http://172.17.0.1:29527
|
||||
Gateway__BaseUrl: ${GATEWAY_BASE_URL:-http://weixin-ilink-gateway:3000}
|
||||
Gateway__ApiKey: ${GATEWAY_API_KEY:?set GATEWAY_API_KEY}
|
||||
RecordBot__WebhookToken: ${RECORD_WEBHOOK_TOKEN:-}
|
||||
RecordBot__ReplyOnRecord: "true"
|
||||
RecordBot__ConnectionString: "Data Source=/app/data/records.db"
|
||||
RecordBot__MediaDir: /app/data/media
|
||||
RecordBot__BackupDir: /app/data/backups
|
||||
RecordBot__TimeZoneId: Asia/Shanghai
|
||||
Llm__Enabled: ${LLM_ENABLED:-true}
|
||||
Llm__ApiKey: ${LLM_API_KEY:-}
|
||||
Llm__BaseUrl: ${LLM_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1}
|
||||
Llm__Model: ${LLM_MODEL:-qwen3.8-max}
|
||||
volumes:
|
||||
- ${RECORD_DATA_DIR:-./data/record-bot}:/app/data
|
||||
networks:
|
||||
- wechatbot
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
networks:
|
||||
wechatbot:
|
||||
external: true
|
||||
name: ${DOCKER_NETWORK:-wechatbot}
|
||||
@@ -0,0 +1,17 @@
|
||||
[program:WeChatBot]
|
||||
; Supervisor 不能用 ./RecordBot,必须写绝对路径
|
||||
command = /data/WeChatBot/record-bot/RecordBot/RecordBot
|
||||
directory = /data/WeChatBot/record-bot/RecordBot
|
||||
environment = ASPNETCORE_URLS="http://0.0.0.0:5080",ASPNETCORE_ENVIRONMENT="Production",TZ="Asia/Shanghai"
|
||||
autorestart = true
|
||||
startsecs = 3
|
||||
stdout_logfile = /opt/1panel/tools/supervisord/log/WeChatBot.out.log
|
||||
stderr_logfile = /opt/1panel/tools/supervisord/log/WeChatBot.err.log
|
||||
stdout_logfile_maxbytes = 2MB
|
||||
stderr_logfile_maxbytes = 2MB
|
||||
user = root
|
||||
priority = 999
|
||||
numprocs = 1
|
||||
process_name = %(program_name)s_%(process_num)02d
|
||||
stopasgroup = true
|
||||
killasgroup = true
|
||||
@@ -0,0 +1,18 @@
|
||||
; 1Panel → 创建守护进程(不要只拷 .conf,要用面板创建或保存为同目录 .ini)
|
||||
[program:WeChatGateway]
|
||||
; 若是 bun 编译出的单文件用下面这行;若是 bun run start 则改成 /root/.bun/bin/bun run start
|
||||
command = /data/WeChatBot/weixin-ilink-gateway/server
|
||||
directory = /data/WeChatBot/weixin-ilink-gateway
|
||||
environment = TZ="Asia/Shanghai",PATH="/root/.bun/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
autorestart = true
|
||||
startsecs = 3
|
||||
stdout_logfile = /opt/1panel/tools/supervisord/log/WeChatGateway.out.log
|
||||
stderr_logfile = /opt/1panel/tools/supervisord/log/WeChatGateway.err.log
|
||||
stdout_logfile_maxbytes = 2MB
|
||||
stderr_logfile_maxbytes = 2MB
|
||||
user = root
|
||||
priority = 998
|
||||
numprocs = 1
|
||||
process_name = %(program_name)s_%(process_num)02d
|
||||
stopasgroup = true
|
||||
killasgroup = true
|
||||
Reference in new issue
Block a user