Local Development with Zerops
Develop locally with hot reload while connecting to Zerops managed services (DB, cache, storage) via VPN. ZCP generates .env with real credentials. Deploy to Zerops with zerops_deploy which uses zcli push under the hood.
Setup
Prerequisites
- zcli installed:
npm i -g @zerops/zclior docs.zerops.io/references/cli - VPN: WireGuard (installed by zcli automatically on first
zcli vpn up) - Project-scoped token: Create in Zerops GUI → Settings → Access Tokens → Custom access per project
Configuration
Workflow
1. Connect to Zerops services
- All services accessible by hostname (e.g.,
db,cache) - One project at a time — switching disconnects the current
- Env vars NOT available via VPN — use
.envfile instead
2. Load credentials
ZCP writes .env via zerops_env action="generate-dotenv" (it merges three input channels — project envVariables, zerops.yaml run.envVariables, and .env.local — into one resolved file):
Don't hand-edit
.envdirectly — the nextgenerate-dotenvrefuses with a diff if it finds keys it didn't produce. Put manual overrides in.env.local(a no-touch input channel that survives regeneration), or passforce=true.
3. Develop locally
Start your dev server as usual — hot reload works against Zerops managed services over VPN.
4. Deploy to Zerops
Uses zcli push under the hood. Blocks until build completes.
zerops.yml for Local Mode
The same zerops.yml works for both local push and container deploy:
${hostname_varName} references are resolved by Zerops at container runtime — they work regardless of push source (local or container).
Connection Troubleshooting
| Symptom | Diagnosis | Fix |
|---|---|---|
nc -zv db 5432 times out | VPN not connected | zcli vpn up <project-id> |
| VPN connected, still timeout | Wrong project | zcli vpn up <correct-project-id> |
| Connected but auth fails | Stale .env | Regenerate: zerops_env action="generate-dotenv" |
| Service unreachable | Service stopped | zerops_manage action="start" serviceHostname="db" |
Diagnostic sequence
zerops_discover service="db"— is service RUNNING?nc -zv db 5432 -w 3— network reachable?- Compare
.envvszerops_env action="generate-dotenv" preview=true(orzerops_discover includeEnvValues=truefor stored values —includeEnvsreturns key templates, not resolved values) — credentials current?
Multi-Project
Each project directory has its own .mcp.json + .zcp/state/. VPN is one per machine — switch manually.
Gotchas
.envcontains secrets: Add to.gitignoreimmediately — never commit- Object storage (S3): Uses HTTPS apiUrl — may work without VPN but not fully verified. Include VPN as fallback