Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e1d4d0326 | ||
|
|
92227e1311 |
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
||||
"generatedAt": "2026-10-23T09:54:31.191Z",
|
||||
"generatedAt": "2026-10-23T11:27:49.824Z",
|
||||
"templates": {
|
||||
"acheng-campus-food": {
|
||||
"real-manifest-interaction": {
|
||||
@@ -256,5 +256,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceTreeHash": "f07ae4270ab0424e283142ebdf72fd9d31a9222323ef677150b59a77f573a50b"
|
||||
"sourceTreeHash": "1dbd5f3a24cc1f86925b4bcd05c99b45cc00d6a39dabe2302ad07ba7f763c79c"
|
||||
}
|
||||
@@ -31,6 +31,8 @@ OBJECT_STORAGE_ACCESS_KEY=
|
||||
OBJECT_STORAGE_SECRET_KEY=
|
||||
OBJECT_STORAGE_REGION=us-east-1
|
||||
|
||||
# 访客微信登录配置,与后台「小程序上传配置」相互独立:
|
||||
# AppID 必须与上传配置一致;AppSecret 只放在服务器环境变量中
|
||||
WECHAT_APP_ID=
|
||||
WECHAT_APP_SECRET=
|
||||
|
||||
|
||||
@@ -41,6 +41,23 @@ pnpm deploy:status
|
||||
|
||||
如需异地副本,在 `shared/.env.production` 配置 `BACKUP_OFFSITE_TARGET`(`rsync` 目标,例如 `backup@example-host:/srv/personal-brand-backups/`),并为 `ubuntu` 用户预先配置 SSH key。未配置时备份只保留在同一台 VPS 上,不等同于灾难恢复副本。至少每季度应在隔离数据库执行一次恢复演练,不得在生产数据库上测试恢复;整机重启演练需在维护窗口执行,确认 Admin、API、PostgreSQL 和公网路由恢复后再结束维护。
|
||||
|
||||
## 微信登录配置
|
||||
|
||||
后台「小程序上传配置」中的 AppID 和上传私钥只用于构建、上传小程序代码,不等于访客登录配置。体验版或正式版调用 `wx.login` 后,API 还需要以下两个环境变量才能通过微信 `jscode2session` 换取 OpenID:
|
||||
|
||||
```bash
|
||||
WECHAT_APP_ID=wxd75d946d6978d183
|
||||
WECHAT_APP_SECRET=<小程序 AppSecret>
|
||||
```
|
||||
|
||||
两项写入 `shared/.env.production`,不要提交到仓库。`WECHAT_APP_ID` 必须与后台上传配置中的 AppID 一致;不一致时微信会返回 `40029` 或 `40163`。修改后重启 API:
|
||||
|
||||
```bash
|
||||
pm2 restart personal-brand-api
|
||||
```
|
||||
|
||||
API 通过 `node --env-file=shared/.env.production` 启动,重启后会读取新值。`pnpm deploy:status` 会检查两项是否非空;缺失时状态检查失败。
|
||||
|
||||
## Nginx 反向代理
|
||||
|
||||
生产环境建议使用同源路径:
|
||||
|
||||
@@ -43,6 +43,7 @@ export function buildRemoteStatusScript({ deployRoot: rootPath = deployRoot } =
|
||||
'printf "backup-timer="; systemctl --user is-active personal-brand-backup.timer',
|
||||
'printf "backup-age-hours="; newest=$(find "$DEPLOY_ROOT/shared/backups" -maxdepth 1 -type f -name "*.dump" -printf "%T@ %p\\n" | sort -nr | head -1 | cut -d" " -f2-); age=$(( ( $(date +%s) - $(stat -c %Y "$newest") ) / 3600 )); echo "$age"; test "$age" -le "${BACKUP_MAX_AGE_HOURS:-36}"',
|
||||
'printf "backup-temp-files="; find "$DEPLOY_ROOT/shared/backups" -maxdepth 1 -type f -name "*.tmp" | wc -l',
|
||||
'printf "wechat-login="; if grep -q "^WECHAT_APP_ID=." "$DEPLOY_ROOT/shared/.env.production" && grep -q "^WECHAT_APP_SECRET=." "$DEPLOY_ROOT/shared/.env.production"; then echo configured; else echo missing; exit 1; fi',
|
||||
'printf "disk="; df -h / | awk \'NR==2 {print $5 " used, " $4 " free"}\'',
|
||||
'printf "release-count="; find "$DEPLOY_ROOT/releases" -mindepth 1 -maxdepth 1 -type d | wc -l',
|
||||
].join("; ");
|
||||
|
||||
@@ -12,6 +12,8 @@ test("生产状态脚本不再要求 VPS 上运行 CI runner", () => {
|
||||
assert.match(script, /personal-brand-backup\.timer/);
|
||||
assert.match(script, /backup-age-hours/);
|
||||
assert.match(script, /BACKUP_MAX_AGE_HOURS/);
|
||||
assert.match(script, /wechat-login/);
|
||||
assert.match(script, /WECHAT_APP_SECRET/);
|
||||
});
|
||||
|
||||
test("生产状态脚本语法有效", () => {
|
||||
|
||||
Reference in new issue
Block a user