部署与运维
systemd(推荐)
Section titled “systemd(推荐)”sudo cp /opt/notenow/notenow.service.template /etc/systemd/system/notenow.service# 按实际路径/端口编辑 ExecStart 与 WorkingDirectorysudo systemctl daemon-reloadsudo systemctl enable --now notenowsudo systemctl status notenow日志:
sudo journalctl -u notenow -fsudo journalctl -u notenow -n 100Nginx 反代要点
Section titled “Nginx 反代要点”生产配置将:
https://notenow.cn/note/ → http://127.0.0.1:8000/并开启 WebSocket 升级头(用于可能的长连接场景)。修改 vhost 后:
openresty -t && systemctl reload openresty定期备份:
backend/data/notenow.dbbackend/uploads/backend/.env(私密保存)
恢复时先停服务,再覆盖数据目录并启动。
cd /opt/notenow/backendsource .venv/bin/activateuvicorn src.main:app --host 0.0.0.0 --port 8000 --log-level debug检查 .env 中 DATABASE_URL、模型密钥是否有效。
外链导入 412
Section titled “外链导入 412”多为站点风控。配置 BILIBILI_COOKIES_* / YT_DLP_USER_AGENT 后重试。
反代 502
Section titled “反代 502”后端进程未监听 8000,或防火墙/上游地址写错。先:
ss -tlnp | grep 8000curl -sI http://127.0.0.1:8000/docs健康检查清单
Section titled “健康检查清单”systemctl is-active notenowcurl -sI http://127.0.0.1:8000/docs→ 200curl -sI https://notenow.cn/note/docs→ 200- 登录后
GET /api/auth/me返回用户信息