@envsync-cloud/deploy-cli 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/dist/index.js +3531 -0
  4. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EnvSync Cloud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # `@envsync-cloud/deploy-cli`
2
+
3
+ Deploy EnvSync self-hosted on a single Docker Swarm host. This CLI is for operators, not local app development.
4
+
5
+ ## ๐Ÿš€ Quick Start
6
+
7
+ Prepare the host:
8
+
9
+ ```bash
10
+ npx @envsync-cloud/deploy-cli preinstall
11
+ ```
12
+
13
+ Write `/etc/envsync/deploy.yaml`:
14
+
15
+ ```bash
16
+ npx @envsync-cloud/deploy-cli setup
17
+ ```
18
+
19
+ Bootstrap the managed infra:
20
+
21
+ ```bash
22
+ npx @envsync-cloud/deploy-cli bootstrap
23
+ ```
24
+
25
+ Deploy the pinned release:
26
+
27
+ ```bash
28
+ npx @envsync-cloud/deploy-cli deploy
29
+ ```
30
+
31
+ Running `envsync-deploy` with no subcommand shows the current operator status and the recommended next command.
32
+
33
+ ## ๐Ÿงญ What This CLI Does
34
+
35
+ - writes and normalizes the self-host deploy config
36
+ - renders the Swarm stack, Traefik, Keycloak, and runtime artifacts
37
+ - bootstraps generated secrets and self-host observability state
38
+ - deploys the inactive API slot first, then promotes traffic
39
+ - keeps the previous API slot available for rollback
40
+ - creates and restores full self-host backup archives
41
+
42
+ ## ๐Ÿ“ฆ Commands
43
+
44
+ - `preinstall` prepares Docker, Swarm, and required host packages.
45
+ - `setup` writes the desired self-host config.
46
+ - `bootstrap` destructively rebuilds managed infra and bootstrap state.
47
+ - `deploy` deploys the configured release.
48
+ - `promote [blue|green]` switches API traffic to a slot without rebuilding.
49
+ - `rollback` switches traffic back to the previously active API slot.
50
+ - `health --json` prints health JSON; plain `health` prints the operator summary view.
51
+ - `plan-topology [file]` renders the Enterprise topology plan from `deploy.yaml`.
52
+ - `validate-topology [file]` validates Enterprise edition topology rules before deployment.
53
+ - `upgrade [version]` pins a release target and deploys it.
54
+ - `upgrade-deps` refreshes dependency image pins and redeploys.
55
+ - `backup` creates a managed self-host backup archive.
56
+ - `restore <archive>` restores a backup archive into the managed roots.
57
+
58
+ ## ๐Ÿ”„ Upgrade Flow
59
+
60
+ `upgrade` now updates the pinned release target automatically. Without a version argument it uses the running deploy-cli package version.
61
+
62
+ ```bash
63
+ bunx @envsync-cloud/deploy-cli@0.6.26 upgrade
64
+ bunx @envsync-cloud/deploy-cli@0.6.26 upgrade 0.6.25
65
+ ```
66
+
67
+ Blue/green keeps the previous API slot around for rollback after promotion.
68
+
69
+ ## Frontend Runtime Config
70
+
71
+ Self-hosted frontend runtime values are injected at deploy time through `runtime-config.js`, not baked at build time.
72
+
73
+ Important behavior:
74
+
75
+ - `runtime-config.js` is written into both the staged release directory and the active `web/current` and `landing/current` directories during deploy.
76
+ - `runtime-config.js` is intentionally served with `Cache-Control: no-store` so frontend URLs and telemetry settings do not stay stale after upgrade.
77
+ - `index.html` is also served with `no-store` to avoid pinning old runtime references.
78
+
79
+ Post-deploy verification:
80
+
81
+ ```bash
82
+ curl -I https://app.example.com/runtime-config.js
83
+ curl -I https://example.com/runtime-config.js
84
+ curl -I https://app.example.com/index.html
85
+ curl -I https://example.com/index.html
86
+ curl -s https://app.example.com/runtime-config.js
87
+ curl -s https://example.com/runtime-config.js
88
+ ```
89
+
90
+ Expected:
91
+
92
+ - `Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0`
93
+ - runtime config values point to the real public `api`, `app`, and `auth` hosts rather than local `lvh.me` defaults
94
+
95
+ Operator visibility:
96
+
97
+ - `envsync-deploy health`
98
+ - `envsync-deploy health --json`
99
+
100
+ Both now surface the effective frontend runtime config for `web` and `landing`.
101
+
102
+ ## ๐Ÿ›Ÿ Rollback / Backup
103
+
104
+ Create a backup before upgrades:
105
+
106
+ ```bash
107
+ npx @envsync-cloud/deploy-cli backup
108
+ ```
109
+
110
+ Restore from an archive:
111
+
112
+ ```bash
113
+ npx @envsync-cloud/deploy-cli restore /path/to/envsync-backup.tar.gz
114
+ ```
115
+
116
+ Restore and start services immediately:
117
+
118
+ ```bash
119
+ npx @envsync-cloud/deploy-cli restore /path/to/envsync-backup.tar.gz --deploy
120
+ ```
121
+
122
+ Manual traffic control:
123
+
124
+ ```bash
125
+ npx @envsync-cloud/deploy-cli promote
126
+ npx @envsync-cloud/deploy-cli rollback
127
+ ```
128
+
129
+ ## ๐Ÿงช Local Smoke
130
+
131
+ Validate unpublished deploy-cli changes from the monorepo:
132
+
133
+ ```bash
134
+ bun run selfhost:smoke
135
+ ```
136
+
137
+ Validate the edition-aware Enterprise topology contract directly:
138
+
139
+ ```bash
140
+ bun run src/index.ts validate-topology /etc/envsync/deploy.yaml --json
141
+ bun run src/index.ts plan-topology /etc/envsync/deploy.yaml
142
+ ```
143
+
144
+ ## Important Notes
145
+
146
+ - Self-hosted releases use exact semver values, not `stable` or `latest`.
147
+ - `bootstrap` is destructive.
148
+ - `upgrade` and `deploy` reconcile managed versioned artifacts from `release.version`.
149
+ - Custom image overrides are still preserved for advanced self-host setups.
150
+ - Enterprise package publication now targets NPM Packages rather than the public npm registry.
151
+ - The full deployment guide lives in [SELFHOSTING.md](/Users/bravo68web/Projects/OSS/EnvSync/monorepo/SELFHOSTING.md).