前端配置迁至 config/local.js,完善支付、模板库与部署脚本
- 页面直接引用 local.js 设置 SOON_DEPLOY_CONFIG,移除 deploy-config - Docker sync-config 生成 local.js;更新 README 与 agent-core 说明 - 模板库自动扫描 .soon;新增后端部署/种子/排查脚本 - 完善支付配置、订阅弹窗与后台支付管理页 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
# 部署脚本
|
||||
|
||||
## 权限(推荐:SSH 粘贴,勿 FTP 上传 .sh)
|
||||
|
||||
FTP 会把脚本改成 CRLF,报 `set: pipefail`。**在服务器 SSH 整段粘贴:**
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/designadmin.cardsoon.com
|
||||
U=www; G=www; ROOT="$PWD"
|
||||
mkdir -p "$ROOT/storage"/{users,logs,payment,cache/rate,cache/wechat_certs}
|
||||
chown -R "$U:$G" "$ROOT"
|
||||
find "$ROOT/src" "$ROOT/public" -type d -exec chmod 755 {} +
|
||||
find "$ROOT/src" "$ROOT/public" -type f -exec chmod 644 {} +
|
||||
chmod 755 "$ROOT/config"
|
||||
test -f "$ROOT/config/local.php" && chmod 640 "$ROOT/config/local.php"
|
||||
chmod 775 "$ROOT/storage/users" "$ROOT/storage/logs" "$ROOT/storage/cache/rate" "$ROOT/storage/cache/wechat_certs"
|
||||
chmod 700 "$ROOT/storage/payment"
|
||||
rm -f "$ROOT/storage/cache/rate/"*.json
|
||||
echo OK
|
||||
```
|
||||
|
||||
## 上线步骤
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/designadmin.cardsoon.com
|
||||
```
|
||||
|
||||
```bash
|
||||
cp config/local.php.example config/local.php
|
||||
vi config/local.php
|
||||
```
|
||||
|
||||
改 `db`、`jwt_secret`、`site`、`storage` 路径。
|
||||
|
||||
```bash
|
||||
mysql -u root -p soondesign < schema.sql
|
||||
```
|
||||
|
||||
再执行上面「权限」整段粘贴。
|
||||
|
||||
## 初始化管理员
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/designadmin.cardsoon.com
|
||||
php scripts/seed-admin.php admin@cardsoon.com cardsoon
|
||||
```
|
||||
|
||||
成功输出 `OK created admin` 或 `OK updated admin`。登录:`https://design.cardsoon.com/pages/admin/login.html`
|
||||
|
||||
模型目录:`.soon` 放后端站点(推荐,避免防跨站读不到):
|
||||
|
||||
```bash
|
||||
mkdir -p /www/wwwroot/designadmin.cardsoon.com/soonModels
|
||||
cp /www/wwwroot/design.cardsoon.com/soonModels/*.soon /www/wwwroot/designadmin.cardsoon.com/soonModels/
|
||||
chmod 755 /www/wwwroot/designadmin.cardsoon.com/soonModels
|
||||
chmod 644 /www/wwwroot/designadmin.cardsoon.com/soonModels/*.soon
|
||||
```
|
||||
|
||||
`local.php`:
|
||||
|
||||
```php
|
||||
'models_dir' => '/www/wwwroot/designadmin.cardsoon.com/soonModels',
|
||||
```
|
||||
|
||||
排查:
|
||||
|
||||
```bash
|
||||
php scripts/check-soon-models.php
|
||||
```
|
||||
|
||||
## 宝塔
|
||||
|
||||
- 网站运行目录:`public`
|
||||
- Nginx:`/api/v1/` → `index.php`,`/api/admin/` → `admin.php`
|
||||
|
||||
## 配置
|
||||
|
||||
后端只维护 `config/local.php`(从 `local.php.example` 复制)。
|
||||
|
||||
前端(`design.cardsoon.com`)只维护 `config/local.js`(从 `config/local.js.example` 复制);全量更新 frontend 时不要覆盖。
|
||||
|
||||
## 本地脚本
|
||||
|
||||
`setup-backend-perms.sh` 供 git 拉取使用;Windows/FTP 上传易坏,请用上面 SSH 粘贴块。
|
||||
Reference in New Issue
Block a user