增加readme
continuous-integration/drone/tag Build encountered an error
Details
continuous-integration/drone/tag Build encountered an error
Details
This commit is contained in:
parent
55335097f9
commit
c4a41da72b
22
.drone.yml
22
.drone.yml
|
|
@ -6,15 +6,11 @@ platform:
|
|||
os: linux
|
||||
arch: arm64
|
||||
|
||||
# 仅在打 tag 时触发 (如 v1.0.0)
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
steps:
|
||||
# ----------------------------------------------------------
|
||||
# 第一步:构建镜像并推送到 Gitea Registry
|
||||
# ----------------------------------------------------------
|
||||
- name: build-and-push-to-gitea
|
||||
image: 192.168.0.75:3000/guanyuankai/plugins-docker:latest
|
||||
privileged: true
|
||||
|
|
@ -27,7 +23,6 @@ steps:
|
|||
repo: 192.168.0.75:3000/guanyuankai/bonus-edge-proxy
|
||||
insecure: true
|
||||
mirror: "https://docker.m.daocloud.io"
|
||||
# 同时推送 latest 和 git tag (比如 v1.0.1)
|
||||
tags:
|
||||
- latest
|
||||
- "${DRONE_TAG}"
|
||||
|
|
@ -35,9 +30,6 @@ steps:
|
|||
context: .
|
||||
platforms: linux/arm64
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# 第二步:将最新的 Compose 文件同步到 RK3588 (新增步骤)
|
||||
# ----------------------------------------------------------
|
||||
- name: scp-config-to-edge
|
||||
image: appleboy/drone-scp
|
||||
settings:
|
||||
|
|
@ -54,9 +46,6 @@ steps:
|
|||
- mediamtx.yml
|
||||
- mosquitto/config/mosquitto.conf
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# 第三步:远程执行部署命令
|
||||
# ----------------------------------------------------------
|
||||
- name: deploy-to-edge
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
|
|
@ -67,23 +56,18 @@ steps:
|
|||
password:
|
||||
from_secret: edge_password
|
||||
port: 22
|
||||
|
||||
ignore_stderr: true
|
||||
script:
|
||||
# 1. 确保目录存在 (防止 SCP 自动创建目录权限问题,双重保险)
|
||||
|
||||
- mkdir -p /opt/edge-proxy
|
||||
- cd /opt/edge-proxy
|
||||
|
||||
# 2. [关键] 登录私有仓库,防止 Token 过期
|
||||
# 注意:这里使用了 $ 符号,需要在 Drone Secret 里再配一套 registry_password
|
||||
# 或者直接用明文 (不推荐),或者复用 gitea_password
|
||||
- echo "$REGISTRY_PASSWORD" | docker login 192.168.0.75:3000 -u "$REGISTRY_USER" --password-stdin
|
||||
|
||||
# 3. 拉取最新镜像
|
||||
- docker compose -f docker-compose.prod.yml pull
|
||||
|
||||
# 4. 重启服务 (Up -d 会重新加载 SCP 传过来的新 yaml 配置)
|
||||
- docker compose -f docker-compose.prod.yml up -d --remove-orphans
|
||||
|
||||
# 5. 清理无用镜像 (只清理悬空的)
|
||||
- docker image prune -f
|
||||
environment:
|
||||
REGISTRY_USER:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
部署操作手册 (Deployment Guide)
|
||||
|
||||
1. 准备工作 (Setup)
|
||||
|
||||
1.1 文件位置
|
||||
|
||||
确保以下文件在 Git 仓库的根目录:
|
||||
|
||||
.drone.yml (流水线定义)
|
||||
|
||||
docker-compose.prod.yml (生产环境运行配置)
|
||||
|
||||
mediamtx.yml (如果需要)
|
||||
|
||||
1.2 Drone 配置 (Secrets)
|
||||
|
||||
登录 Drone 网页版 -> Settings -> Secrets,添加以下变量:
|
||||
|
||||
gitea_username: Gitea 用户名
|
||||
|
||||
gitea_password: Gitea 密码
|
||||
|
||||
edge_host_ip: RK3588 的 IP 地址 (如 192.168.0.123)
|
||||
|
||||
edge_user: RK3588 用户名 (如 dev)
|
||||
|
||||
edge_password: RK3588 密码
|
||||
|
||||
1.3 RK3588 权限准备
|
||||
|
||||
在 RK3588 上执行一次:
|
||||
|
||||
sudo mkdir -p /opt/edge-proxy
|
||||
sudo chown -R forlinx:forlinx /opt/edge-proxy
|
||||
|
||||
|
||||
2. 如何触发部署 (How to Deploy)
|
||||
|
||||
因为我们在 .drone.yml 里设置了 trigger: event: [ tag ],所以普通的 git push 不会 触发部署,只会触发编译(如果有另外的 push 事件配置的话)。
|
||||
|
||||
要发布新版本到设备上,请执行:
|
||||
|
||||
# 1. 提交修改
|
||||
git add .
|
||||
git commit -m "update config"
|
||||
git push
|
||||
|
||||
# 2. 打标签 (Tag) - 这就是开关!
|
||||
git tag v1.0.0
|
||||
git push origin v1.0.0
|
||||
|
||||
|
||||
Drone 检测到 v1.0.0 这个标签被推送,就会开始干活:
|
||||
|
||||
编译 Docker 镜像。
|
||||
|
||||
登录 RK3588。
|
||||
|
||||
上传最新的 docker-compose.prod.yml。
|
||||
|
||||
拉取镜像并重启容器。
|
||||
Loading…
Reference in New Issue