@envsync-cloud/deploy-cli
v0.9.1
Published
CLI for self-hosted EnvSync deployment on Docker Swarm
Downloads
561
Maintainers
Readme
@envsync-cloud/deploy-cli
Deploy EnvSync self-hosted on a single Docker Swarm host. This CLI is for operators, not local app development.
🚀 Quick Start
Prepare the host:
npx @envsync-cloud/deploy-cli preinstallWrite /etc/envsync/deploy.yaml:
npx @envsync-cloud/deploy-cli setupBootstrap the managed infra:
npx @envsync-cloud/deploy-cli bootstrapDeploy the pinned release:
npx @envsync-cloud/deploy-cli deployRunning envsync-deploy with no subcommand shows the current operator status and the recommended next command.
🧭 What This CLI Does
- writes and normalizes the self-host deploy config
- renders the Swarm stack, Traefik, Keycloak, and runtime artifacts
- bootstraps generated secrets and self-host observability state
- deploys the inactive API slot first, then promotes traffic
- keeps the previous API slot available for rollback
- creates and restores full self-host backup archives
📦 Commands
preinstallprepares Docker, Swarm, and required host packages.setupwrites the desired self-host config.bootstrapdestructively rebuilds managed infra and bootstrap state.deploydeploys the configured release.promote [blue|green]switches API traffic to a slot without rebuilding.rollbackswitches traffic back to the previously active API slot.health --jsonprints health JSON; plainhealthprints the operator summary view.plan-topology [file]renders the Enterprise topology plan fromdeploy.yaml.validate-topology [file]validates Enterprise edition topology rules before deployment.upgrade [version]pins a release target and deploys it.upgrade-depsrefreshes dependency image pins and redeploys.backupcreates a managed self-host backup archive.restore <archive>restores a backup archive into the managed roots.
🔄 Upgrade Flow
upgrade now updates the pinned release target automatically. Without a version argument it uses the running deploy-cli package version.
bunx @envsync-cloud/[email protected] upgrade
bunx @envsync-cloud/[email protected] upgrade 0.6.25Blue/green keeps the previous API slot around for rollback after promotion.
Frontend Runtime Config
Self-hosted frontend runtime values are injected at deploy time through runtime-config.js, not baked at build time.
Important behavior:
runtime-config.jsis written into both the staged release directory and the activeweb/currentandlanding/currentdirectories during deploy.runtime-config.jsis intentionally served withCache-Control: no-storeso frontend URLs and telemetry settings do not stay stale after upgrade.index.htmlis also served withno-storeto avoid pinning old runtime references.
Post-deploy verification:
curl -I https://app.example.com/runtime-config.js
curl -I https://example.com/runtime-config.js
curl -I https://app.example.com/index.html
curl -I https://example.com/index.html
curl -s https://app.example.com/runtime-config.js
curl -s https://example.com/runtime-config.jsExpected:
Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0- runtime config values point to the real public
api,app, andauthhosts rather than locallvh.medefaults
Operator visibility:
envsync-deploy healthenvsync-deploy health --json
Both now surface the effective frontend runtime config for web and landing.
🛟 Rollback / Backup
Create a backup before upgrades:
npx @envsync-cloud/deploy-cli backupRestore from an archive:
npx @envsync-cloud/deploy-cli restore /path/to/envsync-backup.tar.gzRestore and start services immediately:
npx @envsync-cloud/deploy-cli restore /path/to/envsync-backup.tar.gz --deployManual traffic control:
npx @envsync-cloud/deploy-cli promote
npx @envsync-cloud/deploy-cli rollback🧪 Local Smoke
Validate unpublished deploy-cli changes from the monorepo:
bun run selfhost:smokeValidate the edition-aware Enterprise topology contract directly:
bun run src/index.ts validate-topology /etc/envsync/deploy.yaml --json
bun run src/index.ts plan-topology /etc/envsync/deploy.yamlImportant Notes
- Self-hosted releases use exact semver values, not
stableorlatest. bootstrapis destructive.upgradeanddeployreconcile managed versioned artifacts fromrelease.version.- Custom image overrides are still preserved for advanced self-host setups.
- Enterprise package publication now targets NPM Packages rather than the public npm registry.
- The full deployment guide lives in SELFHOSTING.md.
