Files
xiaoxia-saas/docs/DEPLOYMENT.md
T
Xiaoxia AI 3b8ff2ddae
Tests / test (push) Failing after 30s
Tests / lint (push) Failing after 30s
feat: implement real deployment script
2026-06-15 18:12:09 +08:00

2.1 KiB
Raw Blame History

部署配置说明

部署流程

Staging(测试环境)

Production(生产环境)

部署步骤

  1. 构建 Docker 镜像

    • API 镜像:xiaoxia-saas-api
    • Worker 镜像:xiaoxia-saas-worker
  2. 传输镜像到服务器

    • 通过 SSH 上传到 /tmp/
  3. 在服务器上部署

    • Staging: /var/lib/xiaoxia-saas-staging
    • Production: /var/lib/xiaoxia-saas-production
  4. 启动服务

    • docker-compose up -d

SSH 密钥配置(必须)

方案 A:使用现有 SSH 密钥(推荐)

当前 act_runner 运行在服务器本机,可以直接访问本地文件系统。

  1. 配置 runner 使用本地部署

修改 deploy.yml,将 SSH 命令改为本地命令:

  • 不使用 ssh root@47.98.113.167
  • 直接执行本地命令
  1. 或者配置 SSH localhost
# 在服务器上配置 SSH localhost 免密登录
ssh-keygen -t ed25519 -f ~/.ssh/id_deploy -N ""
cat ~/.ssh/id_deploy.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

方案 B:使用 Gitea Secrets

如果需要远程部署到其他服务器:

  1. 在 Gitea 仓库设置中添加 Secrets

    • DEPLOY_SSH_KEY - SSH 私钥
    • DEPLOY_HOST - 部署服务器地址
    • DEPLOY_USER - SSH 用户名
  2. 修改 deploy.yml 使用 secrets

- name: Setup SSH
  run: |
    mkdir -p ~/.ssh
    echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/id_deploy
    chmod 600 ~/.ssh/id_deploy

当前状态

部署脚本已完成 ⚠️ SSH 配置待完成 ⚠️ 需要选择方案 A 或 B

推荐方案

方案 A(本地部署) - 最简单,因为 runner 和服务在同一台机器上。

修改 deploy.yml

  • 去掉 scpssh 命令
  • 直接在本地执行 docker 命令
  • 路径直接使用本地路径

下一步

  1. 选择部署方案(A 或 B
  2. 完成 SSH 配置
  3. 推送代码测试部署