@forgezero/agent 0.1.58 → 0.1.59
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/README.md +13 -12
- package/dist/agent-heartbeat.js +1 -1
- package/dist/bootstrap.d.ts +22 -11
- package/dist/bootstrap.js +193 -156
- package/dist/cli/cloudflare-bootstrap.d.ts +5 -7
- package/dist/cloudflare-bootstrap.d.ts +10 -29
- package/dist/cloudflare-bootstrap.js +50 -78
- package/dist/cloudflare-edge.d.ts +10 -0
- package/dist/cloudflare-edge.js +13 -0
- package/dist/credential-schema.d.ts +9 -9
- package/dist/credential-schema.js +7 -7
- package/dist/fz-agent.js +27 -22
- package/dist/fz.js +308 -272
- package/dist/metal-bootstrap.js +1 -1
- package/dist/operator-bootstrap.d.ts +4 -1
- package/dist/operator-bootstrap.js +210 -176
- package/dist/platform-bootstrap-runtime.d.ts +1 -1
- package/dist/platform-bootstrap-runtime.js +3 -2
- package/dist/platform-fleet-verification.js +21 -14
- package/dist/provision.js +12 -6
- package/dist/recovery-host.js +2 -2
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ export declare function validatePlatformSharedEnvironment(input: PlatformSharedE
|
|
|
68
68
|
/** Render only non-secret runtime coordinates. Passwords/tokens have no field in this contract. */
|
|
69
69
|
export declare function renderPlatformSharedEnvironment(input: PlatformSharedEnvironment): string;
|
|
70
70
|
export interface SystemdCredentialSpec {
|
|
71
|
-
name: 'arangodb-jwt' | 'seed-sync-root' | '
|
|
71
|
+
name: 'arangodb-jwt' | 'seed-sync-root' | 'fz_smtp.password' | 'fz_jetemail.apiKey' | 'CF_API_TOKEN' | 'CF_TUNNEL_TOKEN' | 'REALTIME_PUBLISH_SECRET' | 'REALTIME_TICKET_SECRET';
|
|
72
72
|
encryptedPath: string;
|
|
73
73
|
required: boolean;
|
|
74
74
|
}
|
|
@@ -212,9 +212,10 @@ function renderPlatformSharedEnvironment(input) {
|
|
|
212
212
|
}
|
|
213
213
|
function platformApiCredentialSpecs(options) {
|
|
214
214
|
const optional = [
|
|
215
|
-
["
|
|
216
|
-
["
|
|
215
|
+
["fz_smtp.password", options.emailProvider === "smtp"],
|
|
216
|
+
["fz_jetemail.apiKey", options.emailProvider === "jetemail"],
|
|
217
217
|
["CF_API_TOKEN", options.cloudflareKv],
|
|
218
|
+
["CF_TUNNEL_TOKEN", options.cloudflareKv],
|
|
218
219
|
["REALTIME_PUBLISH_SECRET", options.realtime],
|
|
219
220
|
["REALTIME_TICKET_SECRET", options.realtime]
|
|
220
221
|
];
|
|
@@ -2086,7 +2086,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
|
|
|
2086
2086
|
}
|
|
2087
2087
|
|
|
2088
2088
|
// src/version.ts
|
|
2089
|
-
var VERSION3 = "0.1.
|
|
2089
|
+
var VERSION3 = "0.1.59";
|
|
2090
2090
|
|
|
2091
2091
|
// src/egress-policy.ts
|
|
2092
2092
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
@@ -2886,10 +2886,11 @@ function planProvision(options) {
|
|
|
2886
2886
|
const warpEnabled = warpValues.every(Boolean);
|
|
2887
2887
|
if (warpValues.some(Boolean) && !warpEnabled)
|
|
2888
2888
|
throw new Error("WARP configuration must be supplied together");
|
|
2889
|
-
const enrolmentEnabled = Boolean(options.
|
|
2890
|
-
if (Boolean(options.
|
|
2891
|
-
throw new Error("direct enrolment paths must be supplied together");
|
|
2892
|
-
|
|
2889
|
+
const enrolmentEnabled = Boolean(options.enrolTokenCredentialPath && options.enrolStatePath);
|
|
2890
|
+
if (Boolean(options.enrolTokenCredentialPath) !== Boolean(options.enrolStatePath) || options.enrolTokenSourcePath && !enrolmentEnabled) {
|
|
2891
|
+
throw new Error("direct enrolment credential and state paths must be supplied together");
|
|
2892
|
+
}
|
|
2893
|
+
const enrolTokenSourcePath = options.enrolTokenSourcePath ? systemdPath(options.enrolTokenSourcePath, "enrolment source") : undefined;
|
|
2893
2894
|
const enrolTokenCredentialPath = enrolmentEnabled ? systemdPath(options.enrolTokenCredentialPath, "enrolment credential") : undefined;
|
|
2894
2895
|
const enrolStatePath = enrolmentEnabled ? systemdPath(options.enrolStatePath, "enrolment state") : undefined;
|
|
2895
2896
|
const enrolStateDir = enrolStatePath?.replace(/\/[^/]+$/, "");
|
|
@@ -3017,7 +3018,12 @@ function planProvision(options) {
|
|
|
3017
3018
|
] : [],
|
|
3018
3019
|
...enrolmentEnabled ? [
|
|
3019
3020
|
step("enrolment state directory", { kind: "directories", directories: [{ path: enrolStateDir, mode: 448, owner: user, group: user }] }),
|
|
3020
|
-
step("encrypted one-time enrolment capability", {
|
|
3021
|
+
...enrolTokenSourcePath ? [step("encrypted one-time enrolment capability", {
|
|
3022
|
+
kind: "ensure-enrolment",
|
|
3023
|
+
state: enrolStatePath,
|
|
3024
|
+
source: enrolTokenSourcePath,
|
|
3025
|
+
credential: enrolTokenCredentialPath
|
|
3026
|
+
})] : []
|
|
3021
3027
|
] : [],
|
|
3022
3028
|
...deploymentEnabled ? [step("deployment directories", { kind: "directories", directories: [
|
|
3023
3029
|
{ path: deployRoot, mode: 493, owner: "root", group: "root" },
|
|
@@ -3274,9 +3280,10 @@ function renderPlatformSharedEnvironment(input) {
|
|
|
3274
3280
|
}
|
|
3275
3281
|
function platformApiCredentialSpecs(options) {
|
|
3276
3282
|
const optional = [
|
|
3277
|
-
["
|
|
3278
|
-
["
|
|
3283
|
+
["fz_smtp.password", options.emailProvider === "smtp"],
|
|
3284
|
+
["fz_jetemail.apiKey", options.emailProvider === "jetemail"],
|
|
3279
3285
|
["CF_API_TOKEN", options.cloudflareKv],
|
|
3286
|
+
["CF_TUNNEL_TOKEN", options.cloudflareKv],
|
|
3280
3287
|
["REALTIME_PUBLISH_SECRET", options.realtime],
|
|
3281
3288
|
["REALTIME_TICKET_SECRET", options.realtime]
|
|
3282
3289
|
];
|
|
@@ -3588,7 +3595,7 @@ function planLocalOtlpProof(endpoint, collectorUnit) {
|
|
|
3588
3595
|
import { lstatSync as lstatSync4 } from "node:fs";
|
|
3589
3596
|
|
|
3590
3597
|
// src/bootstrap.ts
|
|
3591
|
-
import { createHash as createHash5, createHmac, randomBytes as
|
|
3598
|
+
import { createHash as createHash5, createHmac as createHmac2, randomBytes as randomBytes2 } from "node:crypto";
|
|
3592
3599
|
import {
|
|
3593
3600
|
chmodSync as chmodSync7,
|
|
3594
3601
|
existsSync as existsSync9,
|
|
@@ -3897,7 +3904,7 @@ async function applyPlan(plan, run2) {
|
|
|
3897
3904
|
|
|
3898
3905
|
// src/cloudflare-bootstrap.ts
|
|
3899
3906
|
import { constants } from "node:fs";
|
|
3900
|
-
import {
|
|
3907
|
+
import { createHmac, randomUUID as randomUUID3 } from "node:crypto";
|
|
3901
3908
|
import { chmod, lstat, mkdir, open, readdir, rename, rmdir, stat, unlink } from "node:fs/promises";
|
|
3902
3909
|
import { dirname as dirname7, join as join6, resolve as resolve5 } from "node:path";
|
|
3903
3910
|
import { isIP as isIP3 } from "node:net";
|
|
@@ -3919,6 +3926,7 @@ var JWT_CREDENTIAL = `${CREDS}/arangodb-jwt.cred`;
|
|
|
3919
3926
|
var ENROL_CREDENTIAL = `${CREDS}/enrol-token.cred`;
|
|
3920
3927
|
var TUNNEL_CREDENTIAL = `${CREDS}/CF_TUNNEL_CONNECTOR_TOKEN.cred`;
|
|
3921
3928
|
var CF_API_CREDENTIAL = `${CREDS}/CF_API_TOKEN.cred`;
|
|
3929
|
+
var CF_TUNNEL_API_CREDENTIAL = `${CREDS}/CF_TUNNEL_TOKEN.cred`;
|
|
3922
3930
|
var WARP_CONNECTOR_CREDENTIAL = `${CREDS}/CF_WARP_CONNECTOR_TOKEN.cred`;
|
|
3923
3931
|
var REALTIME_PUBLISH_CREDENTIAL = `${CREDS}/REALTIME_PUBLISH_SECRET.cred`;
|
|
3924
3932
|
var REALTIME_TICKET_CREDENTIAL = `${CREDS}/REALTIME_TICKET_SECRET.cred`;
|
|
@@ -4149,10 +4157,10 @@ function localBootstrapHost() {
|
|
|
4149
4157
|
throw new Error(`Agent software requirements failed: ${result.output.trim()}`);
|
|
4150
4158
|
return result;
|
|
4151
4159
|
},
|
|
4152
|
-
async installAgent(config
|
|
4160
|
+
async installAgent(config) {
|
|
4153
4161
|
const capabilities = await readCapabilities(localRunner);
|
|
4154
4162
|
const deployRoot = config.deployRoot ?? "/opt/forgezero";
|
|
4155
|
-
const hasBinding = config.kind === "enrolled-compute" ||
|
|
4163
|
+
const hasBinding = config.kind === "enrolled-compute" || existsSync9(ENROL_CREDENTIAL) || existsSync9("/var/lib/forgezero/enrolment.json");
|
|
4156
4164
|
if (config.kind === "platform") {
|
|
4157
4165
|
const lifecycle = config.database.role === "none" ? {
|
|
4158
4166
|
apiUnits: ["forgezero@blue.service", "forgezero@green.service"],
|
|
@@ -4195,8 +4203,7 @@ function localBootstrapHost() {
|
|
|
4195
4203
|
telemetryEndpoint: config.telemetryEndpoint,
|
|
4196
4204
|
binPath: "/usr/local/lib/forgezero/agent/fz-agent",
|
|
4197
4205
|
sourceBinPath: PACKAGED_AGENT_BIN,
|
|
4198
|
-
...
|
|
4199
|
-
enrolTokenSourcePath: config.kind === "enrolled-compute" ? config.enrolTokenFile : enrolTokenSourcePath,
|
|
4206
|
+
...hasBinding ? {
|
|
4200
4207
|
enrolTokenCredentialPath: ENROL_CREDENTIAL,
|
|
4201
4208
|
enrolStatePath: "/var/lib/forgezero/enrolment.json",
|
|
4202
4209
|
apiUrl: config.apiUrl,
|
package/dist/provision.js
CHANGED
|
@@ -2086,7 +2086,7 @@ function requestSoftware(requirements, socketPath = DEFAULT_SOFTWARE_HELPER_SOCK
|
|
|
2086
2086
|
}
|
|
2087
2087
|
|
|
2088
2088
|
// src/version.ts
|
|
2089
|
-
var VERSION3 = "0.1.
|
|
2089
|
+
var VERSION3 = "0.1.59";
|
|
2090
2090
|
|
|
2091
2091
|
// src/egress-policy.ts
|
|
2092
2092
|
import { realpathSync as realpathSync3 } from "node:fs";
|
|
@@ -2886,10 +2886,11 @@ function planProvision(options) {
|
|
|
2886
2886
|
const warpEnabled = warpValues.every(Boolean);
|
|
2887
2887
|
if (warpValues.some(Boolean) && !warpEnabled)
|
|
2888
2888
|
throw new Error("WARP configuration must be supplied together");
|
|
2889
|
-
const enrolmentEnabled = Boolean(options.
|
|
2890
|
-
if (Boolean(options.
|
|
2891
|
-
throw new Error("direct enrolment paths must be supplied together");
|
|
2892
|
-
|
|
2889
|
+
const enrolmentEnabled = Boolean(options.enrolTokenCredentialPath && options.enrolStatePath);
|
|
2890
|
+
if (Boolean(options.enrolTokenCredentialPath) !== Boolean(options.enrolStatePath) || options.enrolTokenSourcePath && !enrolmentEnabled) {
|
|
2891
|
+
throw new Error("direct enrolment credential and state paths must be supplied together");
|
|
2892
|
+
}
|
|
2893
|
+
const enrolTokenSourcePath = options.enrolTokenSourcePath ? systemdPath(options.enrolTokenSourcePath, "enrolment source") : undefined;
|
|
2893
2894
|
const enrolTokenCredentialPath = enrolmentEnabled ? systemdPath(options.enrolTokenCredentialPath, "enrolment credential") : undefined;
|
|
2894
2895
|
const enrolStatePath = enrolmentEnabled ? systemdPath(options.enrolStatePath, "enrolment state") : undefined;
|
|
2895
2896
|
const enrolStateDir = enrolStatePath?.replace(/\/[^/]+$/, "");
|
|
@@ -3017,7 +3018,12 @@ function planProvision(options) {
|
|
|
3017
3018
|
] : [],
|
|
3018
3019
|
...enrolmentEnabled ? [
|
|
3019
3020
|
step("enrolment state directory", { kind: "directories", directories: [{ path: enrolStateDir, mode: 448, owner: user, group: user }] }),
|
|
3020
|
-
step("encrypted one-time enrolment capability", {
|
|
3021
|
+
...enrolTokenSourcePath ? [step("encrypted one-time enrolment capability", {
|
|
3022
|
+
kind: "ensure-enrolment",
|
|
3023
|
+
state: enrolStatePath,
|
|
3024
|
+
source: enrolTokenSourcePath,
|
|
3025
|
+
credential: enrolTokenCredentialPath
|
|
3026
|
+
})] : []
|
|
3021
3027
|
] : [],
|
|
3022
3028
|
...deploymentEnabled ? [step("deployment directories", { kind: "directories", directories: [
|
|
3023
3029
|
{ path: deployRoot, mode: 493, owner: "root", group: "root" },
|
package/dist/recovery-host.js
CHANGED
|
@@ -63,7 +63,7 @@ async function runRecoveryHost(args, run = execute) {
|
|
|
63
63
|
nonEmpty("/etc/forgezero/creds/arangodb-jwt.cred");
|
|
64
64
|
const hasDatabase = role !== "none";
|
|
65
65
|
if (hasDatabase) {
|
|
66
|
-
nonEmpty("/etc/forgezero/creds/backup
|
|
66
|
+
nonEmpty("/etc/forgezero/creds/backup.s3.secretAccessKey.cred");
|
|
67
67
|
nonEmpty("/etc/forgezero/creds/backup-recovery-root.cred");
|
|
68
68
|
}
|
|
69
69
|
const slot = activeSlot();
|
|
@@ -110,7 +110,7 @@ async function runRecoveryHost(args, run = execute) {
|
|
|
110
110
|
"--property=LoadCredentialEncrypted=arangodb-jwt:/etc/forgezero/creds/arangodb-jwt.cred",
|
|
111
111
|
...args.includes("--fleet-fenced") ? ["--property=Environment=FZ_RECOVERY_FLEET_FENCED=all-api-and-scheduler-replicas-are-stopped"] : [],
|
|
112
112
|
...args.includes("--backup-credentials") ? [
|
|
113
|
-
"--property=LoadCredentialEncrypted=backup
|
|
113
|
+
"--property=LoadCredentialEncrypted=backup.s3.secretAccessKey:/etc/forgezero/creds/backup.s3.secretAccessKey.cred",
|
|
114
114
|
"--property=LoadCredentialEncrypted=backup-recovery-root:/etc/forgezero/creds/backup-recovery-root.cred"
|
|
115
115
|
] : []
|
|
116
116
|
];
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** One package version shared by both public binaries. Pinned to package.json by tests. */
|
|
2
|
-
export declare const VERSION = "0.1.
|
|
2
|
+
export declare const VERSION = "0.1.59";
|