The deploy workflow was writing PORT=3800 and ZY_SITE_MODE=production
into .env.app, which gets loaded by ecosystem.config.js's loadEnvFile().
Since ...appEnv is spread first and instance-specific values override it,
this is now safe — but removing them from .env.app eliminates the root
cause entirely (belt-and-suspenders fix).
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/80f409c9-7f98-443e-9c31-21111194a523
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
Root causes found:
1. CN server (www.guanghulab.com): conflicting Nginx configs in sites-enabled
and conf.d override cn-domain.conf, causing requests to proxy to a non-
responsive backend → 502
2. SG server: ecosystem.config.js spreads .env.app AFTER PORT/ZY_SITE_MODE,
causing .env.app's PORT=3800 to override preview's PORT=3801 → both
instances fight for port 3800 → preview fails → 502 on preview domain
Fixes:
- deploy-cn-landing.yml: clean ALL conflicting Nginx site configs from both
sites-enabled and conf.d before installing cn-domain.conf
- deploy-cn-landing.yml: enhanced health check diagnostics to detect config
conflicts and validate correct service identity
- ecosystem.config.js: move ...appEnv BEFORE instance-specific PORT and
ZY_SITE_MODE to ensure PM2 config takes priority over .env.app
Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/80f409c9-7f98-443e-9c31-21111194a523
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>