ali-prod-deploy 部署架构

iZuf6j0quz8xk88o690oobZ · 阿里云生产机 · Ubuntu + Docker Compose + Traefik + Gitea Actions
快照时间 2026-07-10 17:24
CPU 4 cores
Memory 7.1 GB (2.7 used)
Disk 40 GB (35 used, 94%)
Docker Network kihaneseifu-net (19 containers)
L0 — Edge / Ingress 对外流量
traefik
Up 32h
traefik:v3.4
:80 → HTTP :443 → HTTPS cert: cloudflare
Traefik 动态路由(file provider @ /srv/traefik/dynamic/*.yml)
iloomerp.com iloom-frontend:3015 nginx 内部反代 /api/ /ws/ → iloom-gateway:8080
api.iloomerp.com iloom-gateway:8080 对外可选 API 入口
muyu.tifpg.com muyu-portal:3000 同域 /api → muyu-gateway:8888
api.tifpg.com muyu-gateway:8888
gitea.iloom.fun gitea:3000 timeouts: dial 30s / idle 600s
iloom iloomerp.com
Frontend
iloom-frontend
Up
gitea.iloom.fun/kihaneseifu/iloom-frontend:main-84a7ee77
src: iloom-flatten nginx :3015 reverse-proxy /api/ /ws/ → iloom-gateway:8080
Backend — 5 Go 微服务
iloom-gateway
Up
…/iloom-gateway:main-3f4e477f
:8080gin router + reverse proxy
iloom-auth-service
Healthy
…/iloom-auth-service:main-3f4e477f
:8081JWT + refresh
iloom-purchaser-service
Healthy
…/iloom-purchaser-service:main-3f4e477f
:8082
iloom-textile-service
Healthy
…/iloom-textile-service:main-3f4e477f
:8083
iloom-washing-service
Healthy
…/iloom-washing-service:main-3f4e477f
:8084
依赖关系:iloom-auth-service / *-service → muyu-mysql:3306 (muyu_wms 库中 ilm_* 前缀表)。
iloom-auth-service → muyu-system-rpc:9001,iloom-purchaser-service → muyu-inventory-rpc:9002。
muyu muyu.tifpg.com
Frontend
muyu-portal
Up
gitea.iloom.fun/kihaneseifu/muyu-portal:main-7a5a5d61
nginx :3000host :3001
Backend — go-zero (gateway + 4 rpc)
muyu-gateway
Up
…/muyu-gateway:main-a6941b9e
:8888API 网关
muyu-system-rpc
Up
…/muyu-system-rpc:main-a6941b9e
:9001
muyu-inventory-rpc
Up
…/muyu-inventory-rpc:main-a6941b9e
:9002
muyu-purchase-rpc
Up
…/muyu-purchase-rpc:main-a6941b9e
:9003
muyu-production-rpc
Up
…/muyu-production-rpc:main-a6941b9e
:9004
L2 — 数据 / 中间件 muyu compose 提供,iloom 复用
muyu-mysql
Healthy
mysql:8.4  ·  host :13306
DB: muyu_wms muyu 基础 23 表 + 迁移 13 表 iloom 26 张 ilm_* 表
muyu-postgres
Healthy
postgres:16-alpine  ·  host :15432
DB: muyu_crm4 张 crm_* 表
muyu-redis
Healthy
redis:7-alpine  ·  host :16379
muyu-etcd
Healthy
quay.io/coreos/etcd:v3.5.17  ·  :2379/:2380
go-zero 服务发现
L3 — 系统 / DevOps gitea + runner + traefik
gitea
Up 40h
gitea/gitea:1.23
:3000 (127.0.0.1) ssh :2222 域名: gitea.iloom.fun 4 仓库 + 内置 registry :3000
gitea-db
Healthy
postgres:16-alpine
act-runner (systemd)
Active
gitea act_runner (host 模式)
maxParallel: 1docker.sock 挂载
L4 — CI/CD 流水线
1
本地 gitlab gitlab.cheverjohn.me
2
gitea main git push gitea main
3
Actions build & push :3000 registry
4
ssh deploy scp compose + docker compose up -d
仓库 Workflow Build 产物 部署目录 Compose project
muyu-apiserver .gitea/workflows/deploy.yml muyu-{gateway,system,inventory,purchase,production}-rpc /srv/kihaneseifu/muyu/apiserver apiserver
muyu-portal .gitea/workflows/deploy.yml muyu-portal /srv/kihaneseifu/muyu/portal portal
iloom .gitea/workflows/deploy.yml iloom-{gateway,auth,purchaser,textile,washing}-service /srv/kihaneseifu/iloom/apiserver iloom-apiserver
iloom-flatten .gitea/workflows/deploy.yml iloom-frontend /srv/kihaneseifu/iloom/frontend iloom-frontend
关键约定与已知问题
镜像 Tag 规则 main 分支 → main-<short8-sha>;semver tag → v*;feat 分支 → feat-<short8-sha>
Docker 网络 kihaneseifu-net(external bridge)— 所有业务容器 + gitea 都在这个网络,互相以容器名解析
数据库共用 iloom 与 muyu 共用同一个 muyu-mysql:muyu 用 sys_*/crm_*/inv_*/pro_*,iloom 用 ilm_* 前缀隔离
Registry gitea 内置 container registry:gitea.iloom.fun/kihaneseifu/*;CI runner 内推送用 localhost:3000
双仓库源 本地开发以 gitlab.cheverjohn.me 为权威源,每次 push 需同时 git push origin main && git push gitea main;gitea 上的 push 触发 CI
Traefik 配置 file provider:/srv/traefik/dynamic/{iloom,muyu,gitea}.yml,改动自动 reload
⚠️ 磁盘 当前根盘使用 94% (35G/40G)。build cache 累积迅速,需定期 docker builder prune -a -f
⚠️ CI 串行 act-runner maxParallel=1,多个仓库同时 push 会排队,deploy 平均等待 1-3 分钟
⚠️ docker.io 拉取 deploy 阶段 docker compose up -d 会尝试拉取 mysql/redis 等基础镜像,docker.io 抽风时会失败。可在 workflow 加 docker compose pull \|\| true 容错