@arcote.tech/arc-cli 0.8.3 → 0.8.4
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.
- package/dist/index.js +3 -1
- package/package.json +10 -10
- package/src/deploy/bootstrap.ts +22 -1
- package/src/deploy/remote-state.ts +9 -0
package/dist/index.js
CHANGED
|
@@ -35708,7 +35708,8 @@ async function bootstrap(inputs) {
|
|
|
35708
35708
|
});
|
|
35709
35709
|
ok("Host bootstrapped");
|
|
35710
35710
|
}
|
|
35711
|
-
const
|
|
35711
|
+
const artifactsHash = new Bun.CryptoHasher("sha256").update(generateCaddyfile(cfg)).update(generateCompose({ cfg })).digest("hex");
|
|
35712
|
+
const needUpStack = state.kind !== "ready" || state.marker === null || state.marker.configHash !== inputs.configHash || state.marker.cliVersion !== inputs.cliVersion || state.marker.artifactsHash !== artifactsHash || inputs.forceAnsible === true || !await isRegistryRunning(cfg);
|
|
35712
35713
|
if (needUpStack) {
|
|
35713
35714
|
await upStack(inputs);
|
|
35714
35715
|
ok("Docker stack up");
|
|
@@ -35722,6 +35723,7 @@ async function bootstrap(inputs) {
|
|
|
35722
35723
|
await writeStateMarker(cfg.target, {
|
|
35723
35724
|
cliVersion: inputs.cliVersion,
|
|
35724
35725
|
configHash: inputs.configHash,
|
|
35726
|
+
artifactsHash,
|
|
35725
35727
|
updatedAt: new Date().toISOString()
|
|
35726
35728
|
});
|
|
35727
35729
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "CLI tool for Arc framework",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"build": "bun build --target=bun ./src/index.ts --outdir=dist --external @arcote.tech/arc --external @arcote.tech/arc-ds --external @arcote.tech/arc-react --external @arcote.tech/platform --external @arcote.tech/arc-map --external '@opentelemetry/*' && chmod +x dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@arcote.tech/arc": "^0.8.
|
|
16
|
-
"@arcote.tech/arc-ds": "^0.8.
|
|
17
|
-
"@arcote.tech/arc-react": "^0.8.
|
|
18
|
-
"@arcote.tech/arc-host": "^0.8.
|
|
19
|
-
"@arcote.tech/arc-adapter-db-sqlite": "^0.8.
|
|
20
|
-
"@arcote.tech/arc-adapter-db-postgres": "^0.8.
|
|
21
|
-
"@arcote.tech/arc-otel": "^0.8.
|
|
15
|
+
"@arcote.tech/arc": "^0.8.4",
|
|
16
|
+
"@arcote.tech/arc-ds": "^0.8.4",
|
|
17
|
+
"@arcote.tech/arc-react": "^0.8.4",
|
|
18
|
+
"@arcote.tech/arc-host": "^0.8.4",
|
|
19
|
+
"@arcote.tech/arc-adapter-db-sqlite": "^0.8.4",
|
|
20
|
+
"@arcote.tech/arc-adapter-db-postgres": "^0.8.4",
|
|
21
|
+
"@arcote.tech/arc-otel": "^0.8.4",
|
|
22
22
|
"@opentelemetry/api": "^1.9.0",
|
|
23
23
|
"@opentelemetry/api-logs": "^0.57.0",
|
|
24
24
|
"@opentelemetry/core": "^1.30.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@opentelemetry/sdk-trace-base": "^1.30.0",
|
|
32
32
|
"@opentelemetry/sdk-trace-node": "^1.30.0",
|
|
33
33
|
"@opentelemetry/semantic-conventions": "^1.27.0",
|
|
34
|
-
"@arcote.tech/platform": "^0.8.
|
|
35
|
-
"@arcote.tech/arc-map": "^0.8.
|
|
34
|
+
"@arcote.tech/platform": "^0.8.4",
|
|
35
|
+
"@arcote.tech/arc-map": "^0.8.4",
|
|
36
36
|
"@clack/prompts": "^0.9.0",
|
|
37
37
|
"commander": "^11.1.0",
|
|
38
38
|
"chokidar": "^3.5.3",
|
package/src/deploy/bootstrap.ts
CHANGED
|
@@ -62,7 +62,11 @@ export interface BootstrapInputs {
|
|
|
62
62
|
cliVersion: string;
|
|
63
63
|
/** sha256 of deploy.arc.json — used for the remote state marker. */
|
|
64
64
|
configHash: string;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* `--force-bootstrap`: wymusza PEŁNY bootstrap mimo markera „ready" —
|
|
67
|
+
* zarówno Ansible, jak i upStack (re-render + wgranie Caddyfile/compose).
|
|
68
|
+
* Escape hatch po ręcznych edycjach hosta albo gdy marker się rozjechał.
|
|
69
|
+
*/
|
|
66
70
|
forceAnsible?: boolean;
|
|
67
71
|
}
|
|
68
72
|
|
|
@@ -137,6 +141,17 @@ export async function bootstrap(inputs: BootstrapInputs): Promise<void> {
|
|
|
137
141
|
ok("Host bootstrapped");
|
|
138
142
|
}
|
|
139
143
|
|
|
144
|
+
// Hash wyrenderowanych artefaktów stacku (Caddyfile + compose). Wykrywa
|
|
145
|
+
// zmianę GENERATORA w obrębie tej samej wersji CLI — bez tego republish tej
|
|
146
|
+
// samej wersji z poprawionym Caddyfile (np. dodane `encode`) NIE odświeżał
|
|
147
|
+
// configu na hoście (obraz aplikacji i tak leci co deploy, ale upStack był
|
|
148
|
+
// pomijany). Marker bez `artifactsHash` (starszy deploy) → undefined ≠ hash
|
|
149
|
+
// → jednorazowy upStack, po którym marker dostaje hash.
|
|
150
|
+
const artifactsHash = new Bun.CryptoHasher("sha256")
|
|
151
|
+
.update(generateCaddyfile(cfg))
|
|
152
|
+
.update(generateCompose({ cfg }))
|
|
153
|
+
.digest("hex");
|
|
154
|
+
|
|
140
155
|
// Force upStack whenever:
|
|
141
156
|
// - stack isn't fully ready, OR
|
|
142
157
|
// - marker is missing (legacy v0.5 deploy with no .arc-state.json), OR
|
|
@@ -144,6 +159,9 @@ export async function bootstrap(inputs: BootstrapInputs): Promise<void> {
|
|
|
144
159
|
// - the CLI version changed (generators evolve — compose/Caddyfile/
|
|
145
160
|
// observability configs must be re-rendered + re-uploaded even when
|
|
146
161
|
// deploy.arc.json itself is unchanged), OR
|
|
162
|
+
// - the RENDERED artifacts differ (generator changed within same CLI
|
|
163
|
+
// version — e.g. republished patch), OR
|
|
164
|
+
// - `--force-bootstrap` (wymusza pełny bootstrap, nie tylko Ansible), OR
|
|
147
165
|
// - registry container isn't running (e.g. legacy stack predates v0.7)
|
|
148
166
|
// Without this, an old v0.5 stack (no registry container) is classified as
|
|
149
167
|
// "ready" and bootstrap is skipped — then `docker login` on the next step
|
|
@@ -153,6 +171,8 @@ export async function bootstrap(inputs: BootstrapInputs): Promise<void> {
|
|
|
153
171
|
state.marker === null ||
|
|
154
172
|
state.marker.configHash !== inputs.configHash ||
|
|
155
173
|
state.marker.cliVersion !== inputs.cliVersion ||
|
|
174
|
+
state.marker.artifactsHash !== artifactsHash ||
|
|
175
|
+
inputs.forceAnsible === true ||
|
|
156
176
|
!(await isRegistryRunning(cfg));
|
|
157
177
|
|
|
158
178
|
if (needUpStack) {
|
|
@@ -180,6 +200,7 @@ export async function bootstrap(inputs: BootstrapInputs): Promise<void> {
|
|
|
180
200
|
await writeStateMarker(cfg.target, {
|
|
181
201
|
cliVersion: inputs.cliVersion,
|
|
182
202
|
configHash: inputs.configHash,
|
|
203
|
+
artifactsHash,
|
|
183
204
|
updatedAt: new Date().toISOString(),
|
|
184
205
|
});
|
|
185
206
|
}
|
|
@@ -24,6 +24,15 @@ export type RemoteState =
|
|
|
24
24
|
export interface RemoteStateMarker {
|
|
25
25
|
cliVersion: string;
|
|
26
26
|
configHash: string;
|
|
27
|
+
/**
|
|
28
|
+
* sha256 wyrenderowanych artefaktów stacku (Caddyfile + docker-compose).
|
|
29
|
+
* Wykrywa zmianę GENERATORA w obrębie tej samej wersji CLI — bez tego
|
|
30
|
+
* republish tej samej wersji z poprawionym Caddyfile (np. dodane `encode`)
|
|
31
|
+
* nie odświeżał configu na hoście (needUpStack patrzył tylko na cliVersion
|
|
32
|
+
* i configHash). Opcjonalny: starsze markery go nie mają → traktowane jako
|
|
33
|
+
* zmiana (wymusza jednorazowy upStack, po którym marker dostaje hash).
|
|
34
|
+
*/
|
|
35
|
+
artifactsHash?: string;
|
|
27
36
|
updatedAt: string;
|
|
28
37
|
}
|
|
29
38
|
|