Files
fj/deploy.sh
selfreleaseandDevin 6329f3f6b4 feat: 分享传播与经文纸水墨背景
- 分享按钮:系统分享 + 二维码卡片(qr.png),移动端移入播放行不再遮挡标题
- og 分享卡片元数据 + og.png 封面;beforeinstallprompt 安装提示
- robots.txt / sitemap.xml / poster.png 传播物料
- .sutra-paper 宣纸底纹:桌面 bg.jpg,移动端竖版 bg-m.jpg,夜间模式罩层适配
- 移动端设置区重排为双列标签网格

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-05 14:30:43 +08:00

40 lines
1.7 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 部署佛经诵读站到 fj.all8ai.top(154.8.162.18:/opt/fj/)
#
# 用法:
# ./deploy.sh # 已配置 SSH key 时直接用
# FJ_PASS=xxx ./deploy.sh # 密码登录(需本机装 sshpass)
#
# 注意:不要在脚本里写死密码;密码走 FJ_PASS 环境变量。
set -euo pipefail
cd "$(dirname "$0")"
HOST=154.8.162.18
USER=root
DEST=/opt/fj
# 注意:不同步 .env —— 服务器端 PORT=8018 与本地开发配置不同,避免覆盖。
FILES=(index.html style.css app.js server.py sw.js manifest.json icon.svg icon-180.png icon-192.png icon-512.png README.md run.md robots.txt sitemap.xml og.png qr.png poster.png bg.jpg bg-m.jpg)
SSH_OPTS="-o StrictHostKeyChecking=no -o ConnectTimeout=15"
SSH_CMD="ssh $SSH_OPTS"
if [ -n "${FJ_PASS:-}" ]; then
command -v sshpass >/dev/null || { echo "缺少 sshpass:brew install sshpass 或改用 SSH key"; exit 1; }
SSH_CMD="sshpass -p $FJ_PASS ssh $SSH_OPTS"
fi
echo "==> 同步文件到 $USER@$HOST:$DEST/"
rsync -az --timeout=30 -e "$SSH_CMD" "${FILES[@]}" "$USER@$HOST:$DEST/"
# 经文数据目录整目录同步(删除远端多余文件,加新经只需往 sutras/ 丢 json)
rsync -az --timeout=30 --delete -e "$SSH_CMD" sutras/ "$USER@$HOST:$DEST/sutras/"
rsync -az --timeout=30 --delete -e "$SSH_CMD" bgm/ "$USER@$HOST:$DEST/bgm/"
echo "==> 重启 fj.service"
$SSH_CMD "$USER@$HOST" 'systemctl restart fj.service && sleep 1 && systemctl is-active fj.service'
echo "==> 健康检查"
code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 https://fj.all8ai.top/)
echo "https://fj.all8ai.top/ -> $code"
[ "$code" = "200" ] || { echo "健康检查未通过"; exit 1; }
echo "部署完成"