RUNTIME / 02
生产运行拓扑
这不是目标设计,而是从 EC2、Nginx、systemd、Docker、数据库、日志与健康接口核实出的生产真值。逻辑架构回答应该怎样分层;本页回答现在到底跑在哪里。
REQUEST TO STATE
从域名到状态盘的四层运行链
所有层目前位于同一台 EC2。箭头表达实际部署路径,不代表推荐的最终边界。
EDGE
DNS · TLS · Nginx
9 个公共域名汇聚到同一公网 IP,由 Nginx 按 host/path 分流。reits / wwwbbsapiauthorderopenapiworkergitealogHOST SERVICES
systemd 业务服务
Go/Node 服务直接运行在宿主机;内部端口由 Nginx 反向代理。reits-auth :8095developer-api :8090miniapp-gateway :8081order :3210data-sources :8080CONTAINERS
Docker 产品与平台
IM、官网、BBS、Gitea 和日志栈共用一个 Docker daemon 与根卷。im-core :18080portal :3003NodeBB :4567Gitea :3002Grafana :3300Loki :3100AlloySTATE
本机数据库与数据卷
业务状态、仓库、日志和采集文件仍以本机 EBS/Docker volumes 为主。MariaDBPostgreSQLRedisMongoDBIM Postgres/Redis/NATS/MinIOLocal packagesXFS / Docker volumesEDGE ROUTING
域名、路径与真实上游
Nginx 是唯一公共入口。8090/8095/8081 虽绑定所有本机地址,但从公网验证均被安全组过滤。
/ · /snapshots · /api/operationsreits-info-portal:3003Dockerhealthy/NodeBB:4567Dockerhealthy/healthz · /readyz · /websock · defaultim-core:18080Dockerhealthy/api/*public-booking-platform:3210systemdhealthy/openapi/*miniapp-gateway:8081systemdhealthy/v1/* · /api/*reits-auth:8095systemdrisk/public-booking-platform:3210systemdhealthy/api/* · /openapi/* · /packages/*developer-api · gateway · local disk:8090 / 8081systemdrisk/data-sources:8080systemdhealthy/Gitea:3002Dockerhealthy/Grafana:3300Dockerprotected/v1/*reits-media:—not deployedmissingSTATE & RESOURCES
状态、资产和备份边界
资源服务器不能只画成 S3/CDN 目标态;下面区分已经运行的本机状态和仍未部署的资源控制面。
Host MariaDB
Auth / OpenAPIjx_reits_auth · jx_im_developer · jx_im_openapi · wukong
Backup · daily dump → local + S3Host PostgreSQL
GiteaGitea metadata
Backup · missing from current backup scriptHost Redis
Auth / OpenAPIsession/challenge support
Backup · not declareddata-sources data
Content Datacrawler state, files and local data
Backup · local backup directoryGitea Docker volume
Developer Platformrepositories, LFS and Gitea /data
Backup · daily tar → local + S3BBS volumes
Communitytopics/users/uploads + Redis
Backup · not proven in EC2 backup flowIM volumes
RealtimeIM state, Redis, NATS, object data
Backup · not proven in EC2 backup flowOpenAPI local packages
Developer Platformpackage files under /opt/miniapp-open-platform/storage
Backup · local-only runtime modeOBSERVABILITY
日志不是一个框,而是一条可验证链
Grafana/Loki/Alloy 已运行四天,覆盖 Nginx、Docker 与 systemd;缺口是异地保存、指标/追踪和统一告警。
Loki retention
14 dayslocal Docker volume · 101 MiB observedjournald
2.9 GiBlocal archived + active journalsNginx files
daily × 10compressed rotation; reits access log currently ~123 MiBCloudWatch Logs
0 groupsno off-host log copy observedDocker storage
50 GiB16.2 GiB images reclaimable at audit timeLocal backups
26 GiBtwo ~13 GiB Gitea archives plus MariaDB dumpsDELIVERY & RECOVERY
发布、定时任务与恢复证据
自动部署频率很高,但各服务版本证据、备份范围和回滚方式尚未统一。
BBS / Data / Portal
~1 minute- SourceGitea main
- Executorsystemd timers
- TargetDocker / systemd
- Evidencecurrent-sha files
Order
~5 minutes- SourceGitea main
- Executorreits-order-auto-deploy
- Targetsystemd :3210
- Evidencerelease SHA + health
OpenAPI
~1 hour- SourceGitea main
- Executorreits-openapi-autodeploy
- Targettwo systemd services
- Evidencebuild SHA + health
Auth
manual- SourceGitea main
- Executormanual deploy
- Targetsystemd :8095
- Evidenceproduction is behind current main
EC2 backup
daily 03:00 UTC- SourceMariaDB + Gitea /data
- Executorec2-backup.timer
- Targetlocal + S3
- Evidencegzip integrity only
RUNTIME REVIEW
生产环境优先级
这里只记录盘点结论,不在审计过程中直接修改生产配置。
生产 Auth 仍启用预览旁路
AUTH_EXPOSE_DEV_CODE、AUTH_ALLOW_PREVIEW、AUTH_PREVIEW_OVERRIDE 在 auth.reits.tech 生产进程中均为开启状态;必须先建立零停机回退方案,再关闭并验证所有客户端。
资源服务器只存在于代码,不存在于生产
没有 reits-media service、Nginx vhost、REITs S3 bucket 或 assets.reits.tech DNS;OpenAPI health 明确报告 storageBackend=local。
当前备份无法完整恢复 Gitea
备份包含 MariaDB 和 Gitea /data tar,但 Gitea 实际使用的宿主机 PostgreSQL 约 3.9 GiB 未被 dump;BBS 与 IM 数据卷也未进入这条备份链,脚本还包含应迁移到受管密钥存储的硬编码凭据。
单 EC2 是全生态共同故障域
Edge、Auth、IM、官网、BBS、Order、OpenAPI、数据库、日志和 Gitea 共用一个实例、一块根卷与一个 Docker daemon。
日志可查询,但没有异地副本
Alloy → Loki → Grafana 链路健康且 Grafana 有访问保护;日志仅存本机,CloudWatch log group 为 0,实例或根卷故障会同时丢失服务和诊断证据。
生产版本真值不统一
多数服务有 SHA 证据,但 Auth 仍运行 d95cab5,落后于当前 main;Order/OpenAPI 的 build SHA 来自健康接口,部署状态文件格式不一致。
磁盘与备份增长需要预算
根卷使用 54%;Docker 50 GiB、本地备份 26 GiB、采集数据 19 GiB。当前尚未形成统一容量阈值、保留策略和告警。