Files
daywork/server/DEPLOY.md
T

46 lines
1.5 KiB
Markdown
Raw 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.
# 同步服务端部署(服务器 /opt,Docker + Caddy)
服务器现状:Caddy 占用 80/443,各服务容器接入 mynet 网络,Gitea SSH 在宿主机 222 端口。
## 一、获取部署文件并启动
cd /opt
git clone https://gitea.linyux.cn/root/daywork.git daywork 2>/dev/null || (cd daywork && git pull)
cd daywork/server
docker compose up -d --build
启动后容器 internlog-sync 加入 mynet,Caddy 可用容器名直接访问。
## 二、修改 Caddyfile
在 /opt/caddy 下的 Caddyfile 中,把 gitea.linyux.cn 站点改为(新增两个 handle 块):
gitea.linyux.cn {
handle_path /sync-api/* {
reverse_proxy internlog-sync:3780
}
handle {
reverse_proxy gitea:3000
}
}
其余站点不动。
## 三、重载并验证
docker exec caddy caddy reload --config /etc/caddy/Caddyfile
curl https://gitea.linyux.cn/sync-api/api/health
应返回 {"ok":true}(公网可达,可从本机验证)。
## 四、客户端
应用 → 设置 → 多端数据同步:地址填 https://gitea.linyux.cn/sync-api,注册云端账号后同步。
手机浏览器打开同一地址登录,添加到主屏幕后即为手机端应用。
## 五、数据与运维
- 数据目录:/opt/daywork/server/data(用户注册表 + 每用户数据),打包即备份
- 更新版本:cd /opt/daywork && git pull && cd server && docker compose up -d --build
- 接口:POST /api/auth/register、POST /api/auth/login、POST /api/sync、GET /api/health