SlaunchX DevOps
/ 运维 OPS / n-00007 运维
← 返回门户
n-00007 运维 runbook
2026-08-17 系统性优化档案
- 清理: docker 66.9G + builder 4.9G + trivy 2.3G + gitea 旧备 0.7G + apt 339M
- gitea 数据迁移: /opt/gitea → slaunchx-data-vg/gitea LV (fstab 持久化), 停机约 2 分钟
- 回滚点: /opt/gitea.pre-sda-20260817 (根分区, 观察期满删除)
- unbound-resolvconf: 本机 resolvconf 未装 → 已 mask (勿解除, 解除即复发)
定时任务 (2026-08-17 三项整改落地)
- 本地备份 slaunchx-backup.timer 每日 03:40: gitea dump + mysql_test 两库 →
/home/reynard/backups/ (retention 14 天)。gitea 目标 2026-08-17 启用;
modules/gitea.py 已修 (
docker exec -u git -w /tmp, gitea 拒绝 root 运行),
该修改在 n-00007 /opt/slaunchx/repos/slaunchx-ops-devops 本地未提交, 待回推仓库。
- 异地备份 n7-backup-offsite.timer 每日 04:10:
/usr/local/bin/n7-backup-offsite.sh 将 /home/reynard/backups/ rsync 镜像到
大脑机 /opt/slaunchx-fleet-backups/n7/ (adminb84002@192.168.5.200:16189)。
key=/root/.ssh/n7-backup-offsite, 接收端 authorized_keys
restrict,command="rrsync -wo ..." 锁死; 验证: sudo journalctl -u n7-backup-offsite。
- 磁盘水位 disk-watermark.timer 每 30 分钟:
/usr/local/bin/disk-watermark-check.sh 85 检查 / /home /opt/gitea,
超限 POST http://127.0.0.1:8400/send (channel=all, source=disk-watermark)。
手动测试:
NOTIFY_LABEL=disk-watermark-selftest disk-watermark-check.sh 10。
- gitea 保留 gitea-backup-retention.timer 每日 03:55: gitea 备份 3 天保留 (清理旧 dump)。
- docker GC docker-gc.timer 每周日 04:30: image/builder prune (until=168h) +
journald vacuum 300M。
- 总览:
systemctl list-timers | grep -E 'backup|watermark|docker-gc|retention|offsite'
(2026-08-18 实测全部 enabled/active: disk-watermark / slaunchx-backup / gitea-backup-retention /
n7-backup-offsite / docker-gc)。
宿主健康基线 (2026-08-18 实测)
- fleet-agent (v0) + fleet-agent-v1 双栈 active; node_exporter active; smartd active; fail2ban active。
- 存储:
/ 62% (23G), /home 47% (404G, 179G 用), /opt/gitea 5% (98G LV, 4.2G 用)。
- 运维仓库
slaunchx-ops-devops 检出在 /opt/slaunchx/repos/slaunchx-ops-devops (9 个 systemd 服务由此运行);
另有 slaunchx-backend-platform 检出。
常用检查
- 环境健康:
docker ps --format '{{.Names}} {{.Status}}' | grep -v 'Up ' (init 容器 Exited(0) 属正常)
- 磁盘:
df -h / /home /opt/gitea; SMART: smartctl -H /dev/sda /dev/sdb
- gitea 端到端:
curl -s https://gitea.slaunchx.cc/api/v1/version (经隧道)
注意事项
- gitea SSH 用镜像自带 sshd (2222→22); compose 禁止开 START_SSH_SERVER (会撞端口崩溃)
- 边缘: 共享隧道 8da8d702 (
slaunchx-nginx, 落网关 n-00008) 承载 45 条 ingress,
改 ingress 用 GET-改-PUT 全量替换, 谨慎 (含 catch-all 404)。