@cotal-ai/cli 0.165.3 → 0.166.0
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/command.d.ts.map +1 -1
- package/dist/command.js +9 -4
- package/dist/command.js.map +1 -1
- package/dist/commands/ext.js +2 -2
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +3 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +2 -2
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/mint.js +1 -1
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/persona-remote.d.ts.map +1 -1
- package/dist/commands/persona-remote.js +5 -2
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +17 -2
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +8 -7
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +31 -14
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-up.d.ts +1 -0
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +79 -12
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +4 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/up.d.ts +2 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +43 -20
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +6 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +26 -8
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/broker-store-health.d.ts +7 -5
- package/dist/lib/broker-store-health.d.ts.map +1 -1
- package/dist/lib/broker-store-health.js +10 -7
- package/dist/lib/broker-store-health.js.map +1 -1
- package/dist/lib/credential-authority.d.ts +2 -2
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +4 -4
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/manager-proc.d.ts +1 -1
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +12 -2
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +11 -6
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +1 -2
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-systemd.d.ts.map +1 -1
- package/dist/lib/service-systemd.js +43 -1
- package/dist/lib/service-systemd.js.map +1 -1
- package/dist/lib/store-dir.d.ts +3 -1
- package/dist/lib/store-dir.d.ts.map +1 -1
- package/dist/lib/store-dir.js +6 -2
- package/dist/lib/store-dir.js.map +1 -1
- package/dist/seed/store.d.ts.map +1 -1
- package/dist/seed/store.js +15 -1
- package/dist/seed/store.js.map +1 -1
- package/package.json +4 -4
package/dist/commands/up.d.ts
CHANGED
|
@@ -211,12 +211,14 @@ export declare function prepareBrokerStart(opts: DetachOpts): Promise<{
|
|
|
211
211
|
confPath: string;
|
|
212
212
|
creds: string;
|
|
213
213
|
wsPort: number;
|
|
214
|
+
moveWebsocketPort: () => Promise<number>;
|
|
214
215
|
prepared?: AuthPrepared;
|
|
215
216
|
stateDir?: string;
|
|
216
217
|
authTimeout?: number;
|
|
217
218
|
maxPayload?: number;
|
|
218
219
|
accountResolver: "memory" | "full";
|
|
219
220
|
} | undefined;
|
|
221
|
+
maxPayload: number | undefined;
|
|
220
222
|
confPath: string;
|
|
221
223
|
args: string[];
|
|
222
224
|
bin: string;
|
|
@@ -1 +1 @@
|
|
|
1
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AAE,OAAO,CAAC;IAAC,sBAAsB,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CA4C/M;AAuLD;;;;;;oGAMoG;AACpG,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD3F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnF;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAExC;;mCAEmC;AACnC,eAAO,MAAM,oBAAoB,GAAI,GAAG,SAAS,EAAE,YAAY,UAAU,KAAG,IAAoC,CAAC"}
|
package/dist/commands/up.js
CHANGED
|
@@ -59,7 +59,7 @@ import { serviceSupervisorStore } from "../lib/service-supervision.js";
|
|
|
59
59
|
import { serviceInstallIntents } from "../lib/service-install-intent.js";
|
|
60
60
|
import { serviceUninstallIntents } from "../lib/service-uninstall-intent.js";
|
|
61
61
|
import { serviceUnitActionStore } from "../lib/service-unit-action.js";
|
|
62
|
-
import { assertStoreDirArgument, configuredStoreDir, lastServedStore, missingStoreWarning, servedStore, sharedStoreAtStart, sharedStoreWarning, storeWriteProblem, warnForeignStoreEntries } from "../lib/store-dir.js";
|
|
62
|
+
import { assertStoreDirArgument, configuredStoreDir, lastServedStore, lastServedStores, missingStoreWarning, servedStore, sharedStoreAtStart, sharedStoreWarning, storeWriteProblem, warnForeignStoreEntries } from "../lib/store-dir.js";
|
|
63
63
|
import { extensionNames, preflightRuntime } from "../ext-loader.js";
|
|
64
64
|
import { completingFlagValue } from "../lib/completion.js";
|
|
65
65
|
import { metadataPositionals } from "../lib/command-path.js";
|
|
@@ -221,13 +221,10 @@ export function validateUpArguments(args) {
|
|
|
221
221
|
if (args.values.file !== undefined || args.values.restore !== undefined)
|
|
222
222
|
throw new CommandFailure("refused", "USAGE_INVALID", `--auth-timeout cannot be combined with ${args.values.file !== undefined ? "--file/-f" : "--restore"}, which starts the broker its own record describes; nothing was started`, { remedy: "start it without --auth-timeout; a recorded timeout is rendered again" });
|
|
223
223
|
}
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
// record describes, so none of the three takes the flag.
|
|
224
|
+
// Both broker modes render the payload limit. A manifest or a restore starts the broker its own
|
|
225
|
+
// record describes, so neither takes the flag.
|
|
227
226
|
const requestedPayload = parseMaxPayload(args.values["max-payload"]);
|
|
228
227
|
if (requestedPayload !== undefined) {
|
|
229
|
-
if (args.values.open === true)
|
|
230
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "--max-payload sets the broker's message size limit, which the open broker configuration does not render; nothing was started", { remedy: "drop --max-payload, or start an auth space without --open" });
|
|
231
228
|
if (args.values.file !== undefined || args.values.restore !== undefined)
|
|
232
229
|
throw new CommandFailure("refused", "USAGE_INVALID", `--max-payload cannot be combined with ${args.values.file !== undefined ? "--file/-f" : "--restore"}, which starts the broker its own record describes; nothing was started`, { remedy: "start it without --max-payload; a recorded limit is rendered again" });
|
|
233
230
|
// A space that admits service endpoints is a space whose auth host asserts the caller payload
|
|
@@ -959,12 +956,14 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
959
956
|
if (values.space === undefined && unnamedDefault(root, stackSpace))
|
|
960
957
|
assertSelectionNotMoved(root, stackSpace);
|
|
961
958
|
recordOperationSpace(stackSpace);
|
|
962
|
-
if (!readMaintenanceJournal(root)
|
|
959
|
+
if (!readMaintenanceJournal(root)) {
|
|
960
|
+
const controller = controllerStackApplies(root, stackSpace, values);
|
|
963
961
|
const recordedStack = readStackJournal(root);
|
|
964
962
|
if ((recordedStack?.journal.mode ?? requestedStackMode(values)) === "user" && (!recordedStack || values.idp !== undefined)) {
|
|
965
963
|
const server = values.server ?? recordedStack?.journal.server ?? localMeshesForRoot(root).find((m) => m.space === stackSpace)?.server ?? (values.host ? reconcileHostAndServer(values.host, undefined) : DEFAULT_SERVER);
|
|
966
964
|
const transport = resolveTransport(values, undefined, root, { persist: false, quiet: true });
|
|
967
|
-
|
|
965
|
+
if (controller)
|
|
966
|
+
assertUserStackTransport(server, transport.kind === "tls-required");
|
|
968
967
|
await preflightUserStack(root, stackSpace, values.idp);
|
|
969
968
|
}
|
|
970
969
|
}
|
|
@@ -2087,7 +2086,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2087
2086
|
// A repair keeps its own store rules above, and a resume or restore names its store.
|
|
2088
2087
|
if (!resumeAttempt && !repairing) {
|
|
2089
2088
|
if (values["store-dir"] === undefined)
|
|
2090
|
-
|
|
2089
|
+
values["store-dir"] = reopenLastStore(cotalPath("nats"));
|
|
2091
2090
|
else
|
|
2092
2091
|
refuseMissingNamedStore(resolve(values["store-dir"]));
|
|
2093
2092
|
checkStartStore(values["store-dir"], values.space ?? folderSpace());
|
|
@@ -2224,12 +2223,13 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2224
2223
|
// the server, and the hostname is what the certificate has to match).
|
|
2225
2224
|
assertServesDialHost(transport, new URL(server).hostname);
|
|
2226
2225
|
const setup = useAuth ? await authSetup(storeDir, server, space, host, wantUser ? { idpUrl: values.idp } : undefined, transport, values["rotate-sys"], maxFileStore, false, { authTimeout, maxPayload, accountResolver, manager: values["no-manager"] !== true }) : undefined;
|
|
2226
|
+
const brokerMaxPayload = setup?.maxPayload ?? maxPayload ?? readBrokerPolicy(cotalRoot())?.maxPayload;
|
|
2227
2227
|
const port = Number(new URL(server).port) || 4222;
|
|
2228
2228
|
// Both modes go through a RENDERER, never bare CLI flags. Open mode used to start from
|
|
2229
2229
|
// `-js -sd … -p … -a …`, which never called a renderer at all — so the required transport union
|
|
2230
2230
|
// protected the auth path and was silent on the open one, and a cert/key pair passed to an
|
|
2231
2231
|
// open-mode `up` would have been accepted while the listener came up in cleartext.
|
|
2232
|
-
const confPath = setup ? setup.confPath : writeOpenBrokerConf(storeDir, space, { port, host, transport, maxFileStore });
|
|
2232
|
+
const confPath = setup ? setup.confPath : writeOpenBrokerConf(storeDir, space, { port, host, transport, maxFileStore, maxPayload: brokerMaxPayload });
|
|
2233
2233
|
const natsArgs = [
|
|
2234
2234
|
"-c", confPath,
|
|
2235
2235
|
...(boundListener ? ["--name", boundListener.serverName] : []),
|
|
@@ -2422,7 +2422,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2422
2422
|
})();
|
|
2423
2423
|
};
|
|
2424
2424
|
const { authService, controlPlane } = await serveReadyListener({
|
|
2425
|
-
child, server, space, storeDir, setup, seedFile, transport,
|
|
2425
|
+
child, server, space, storeDir, setup, seedFile, transport, maxPayload: brokerMaxPayload,
|
|
2426
2426
|
...(values["recreate-issued-stores"] !== undefined ? { recreateIssuedStores: resolve(values["recreate-issued-stores"]) } : {}),
|
|
2427
2427
|
...(values["recreate-membership-store"] ? { recreateMembershipStore: true } : {}),
|
|
2428
2428
|
host: values.host,
|
|
@@ -3401,7 +3401,7 @@ export function controllerStackNative() {
|
|
|
3401
3401
|
return {
|
|
3402
3402
|
prepareBroker: async (opts) => {
|
|
3403
3403
|
const prepared = await prepareBrokerStart({ transport: opts.transport, server: opts.server, space: opts.space, ...(opts.open ? { open: true } : {}), ...(opts.userAuth ? { userAuth: opts.userAuth } : {}), ...(opts.host ? { host: opts.host } : {}), ...(opts.storeDir ? { storeDir: opts.storeDir } : {}), ...(opts.existingStore ? { existingStore: opts.existingStore } : {}), ...(opts.maxFileStore !== undefined ? { maxFileStore: opts.maxFileStore } : {}), ...(opts.logFile !== undefined ? { logFile: opts.logFile } : {}), ...(opts.logfileSizeLimit !== undefined ? { logfileSizeLimit: opts.logfileSizeLimit } : {}), ...(opts.logfileMaxNum !== undefined ? { logfileMaxNum: opts.logfileMaxNum } : {}), ...(opts.authTimeout !== undefined ? { authTimeout: opts.authTimeout } : {}), ...(opts.maxPayload !== undefined ? { maxPayload: opts.maxPayload } : {}), ...(opts.accountResolver !== undefined ? { accountResolver: opts.accountResolver } : {}), ...(opts.noManager ? { noManager: true } : {}), ...(opts.seed !== undefined ? { seed: opts.seed } : opts.channels ? { channels: opts.channels } : {}), quietBoot: true });
|
|
3404
|
-
return { root: prepared.root, server: prepared.server, space: prepared.space, storeDir: prepared.storeDir, transport: prepared.transport, ...(prepared.setup ? { setup: { creds: prepared.setup.creds, wsPort: prepared.setup.wsPort } } : {}), ...(prepared.setup?.prepared && prepared.setup.stateDir ? { user: { prepared: prepared.setup.prepared, stateDir: prepared.setup.stateDir } } : {}), confPath: prepared.confPath, bin: prepared.bin, source: prepared.source, version: prepared.version, seedFile: prepared.seedFile, ...(prepared.setup?.authTimeout !== undefined ? { authTimeout: prepared.setup.authTimeout } : {}), ...(prepared.
|
|
3404
|
+
return { root: prepared.root, server: prepared.server, space: prepared.space, storeDir: prepared.storeDir, transport: prepared.transport, ...(prepared.setup ? { setup: { creds: prepared.setup.creds, wsPort: prepared.setup.wsPort, moveWebsocketPort: prepared.setup.moveWebsocketPort } } : {}), ...(prepared.setup?.prepared && prepared.setup.stateDir ? { user: { prepared: prepared.setup.prepared, stateDir: prepared.setup.stateDir } } : {}), confPath: prepared.confPath, bin: prepared.bin, source: prepared.source, version: prepared.version, seedFile: prepared.seedFile, ...(prepared.setup?.authTimeout !== undefined ? { authTimeout: prepared.setup.authTimeout } : {}), ...(prepared.maxPayload !== undefined ? { maxPayload: prepared.maxPayload } : {}), ...(prepared.setup?.accountResolver !== undefined ? { accountResolver: prepared.setup.accountResolver } : {}) };
|
|
3405
3405
|
},
|
|
3406
3406
|
initializeStreams: (server, space, setup, seedFile, recreateIssuedStores, recreateMembershipStore) => postStart(server, space, setup, seedFile, recreateIssuedStores, recreateMembershipStore, true),
|
|
3407
3407
|
recreateDeletedStreams: ({ seed, ...opts }) => recreateDeletedStreams({ ...opts, ...(seed !== undefined ? { seed: seed } : {}) }),
|
|
@@ -3534,6 +3534,8 @@ async function upManifest(file, opts) {
|
|
|
3534
3534
|
refuseUnnamedLastStore(cotalPath("nats"));
|
|
3535
3535
|
else
|
|
3536
3536
|
refuseMissingNamedStore(resolve(opts.storeDir));
|
|
3537
|
+
if (userAuth)
|
|
3538
|
+
await preflightUserStack(cotalRoot(), m.space, userAuth.idpUrl);
|
|
3537
3539
|
checkStartStore(opts.storeDir, m.space);
|
|
3538
3540
|
if (opts.dryRun) {
|
|
3539
3541
|
// Dial-host SAN must refuse here too (S6). The real route runs assertServesDialHost after
|
|
@@ -3977,7 +3979,7 @@ async function serveReadyListener(l) {
|
|
|
3977
3979
|
// Commit the policy only for a listener that is up and recorded (S5), and before the control
|
|
3978
3980
|
// plane (S9). startDeliveryWithBroker is HANDED the transport decision, so it does not depend on
|
|
3979
3981
|
// the file at all.
|
|
3980
|
-
commitTransportPolicy(cotalRoot(), transport, l.quietBoot, server, { authTimeout: setup?.authTimeout, maxPayload: setup?.maxPayload, accountResolver: setup?.accountResolver });
|
|
3982
|
+
commitTransportPolicy(cotalRoot(), transport, l.quietBoot, server, { authTimeout: setup?.authTimeout, maxPayload: l.maxPayload ?? setup?.maxPayload, accountResolver: setup?.accountResolver });
|
|
3981
3983
|
// An open mesh has no delivery daemon. Its mode is passed down because the root can still hold a
|
|
3982
3984
|
// static stack's accounts. Class-2 credential renewal is NOT wired here: the MANAGER is the
|
|
3983
3985
|
// renewal owner (it is resident in every mesh mode, where a foreground `up` process is not).
|
|
@@ -4052,10 +4054,11 @@ export async function prepareBrokerStart(opts) {
|
|
|
4052
4054
|
}
|
|
4053
4055
|
}
|
|
4054
4056
|
const setup = useAuth ? await authSetup(storeDir, server, space, host, opts.userAuth, transport, opts.rotateSys, opts.maxFileStore, opts.quietBoot, { authTimeout: opts.authTimeout, maxPayload: opts.maxPayload, accountResolver: opts.accountResolver, manager: opts.noManager !== true, logFile, logfileSizeLimit: opts.logfileSizeLimit, logfileMaxNum: opts.logfileMaxNum }) : undefined;
|
|
4057
|
+
const maxPayload = setup?.maxPayload ?? opts.maxPayload ?? readBrokerPolicy(root)?.maxPayload;
|
|
4055
4058
|
const port = Number(new URL(server).port) || 4222;
|
|
4056
4059
|
// Same rule as the foreground path: every route to a listener names its transport (see
|
|
4057
4060
|
// `writeOpenBrokerConf`). Detach must not be the mode where the fence quietly does not apply.
|
|
4058
|
-
const confPath = setup ? setup.confPath : writeOpenBrokerConf(storeDir, space, { port, host, transport, maxFileStore: opts.maxFileStore, logFile, logfileSizeLimit: opts.logfileSizeLimit, logfileMaxNum: opts.logfileMaxNum });
|
|
4061
|
+
const confPath = setup ? setup.confPath : writeOpenBrokerConf(storeDir, space, { port, host, transport, maxFileStore: opts.maxFileStore, maxPayload, logFile, logfileSizeLimit: opts.logfileSizeLimit, logfileMaxNum: opts.logfileMaxNum });
|
|
4059
4062
|
// Trust preparation awaits; the pinned store is checked again before its config is handed back.
|
|
4060
4063
|
if (opts.existingStore)
|
|
4061
4064
|
recheckExistingStore(opts.existingStore, { space, storeDir });
|
|
@@ -4064,7 +4067,7 @@ export async function prepareBrokerStart(opts) {
|
|
|
4064
4067
|
...(opts.boundListener ? ["--name", opts.boundListener.serverName] : []),
|
|
4065
4068
|
];
|
|
4066
4069
|
const { path: bin, source, version } = await resolveNatsServer();
|
|
4067
|
-
return { root, server, space, useAuth, storeDir, seedFile, host, transport, setup, confPath, args, bin, source, version };
|
|
4070
|
+
return { root, server, space, useAuth, storeDir, seedFile, host, transport, setup, maxPayload, confPath, args, bin, source, version };
|
|
4068
4071
|
}
|
|
4069
4072
|
/**
|
|
4070
4073
|
* Open the detached broker's log with {@link openPrivateAppend}: created `0600` whatever the umask,
|
|
@@ -4090,7 +4093,7 @@ export async function startMeshDetached(
|
|
|
4090
4093
|
// The `= {}` default is gone with the optional transport: an options object that can be omitted
|
|
4091
4094
|
// entirely cannot carry a mandatory decision.
|
|
4092
4095
|
opts) {
|
|
4093
|
-
const { server, space, useAuth, storeDir, seedFile, transport, setup, args, bin, source, version } = await prepareBrokerStart(opts);
|
|
4096
|
+
const { server, space, useAuth, storeDir, seedFile, transport, setup, maxPayload, args, bin, source, version } = await prepareBrokerStart(opts);
|
|
4094
4097
|
await seedBeforeLaunch();
|
|
4095
4098
|
const logPath = cotalPath("nats.log");
|
|
4096
4099
|
const fd = openBrokerLog(logPath);
|
|
@@ -4106,7 +4109,7 @@ opts) {
|
|
|
4106
4109
|
child.unref();
|
|
4107
4110
|
await awaitSpawnedListener({ child, executable: { path: bin, source, version }, server, space, creds: setup?.creds, tls: transport.kind === "tls-required", log: logPath, boundListener: opts.boundListener });
|
|
4108
4111
|
const { authService, controlPlane } = await serveReadyListener({
|
|
4109
|
-
child, server, space, storeDir, setup, seedFile, transport,
|
|
4112
|
+
child, server, space, storeDir, setup, seedFile, transport, maxPayload,
|
|
4110
4113
|
...(opts.recreateIssuedStores !== undefined ? { recreateIssuedStores: opts.recreateIssuedStores } : {}),
|
|
4111
4114
|
...(opts.recreateMembershipStore ? { recreateMembershipStore: true } : {}),
|
|
4112
4115
|
host: opts.host,
|
|
@@ -5332,6 +5335,21 @@ function refuseUnnamedLastStore(storeDir) {
|
|
|
5332
5335
|
if (last !== undefined)
|
|
5333
5336
|
throw new CommandFailure("refused", "CONFLICT", `this root's last broker served the store ${last}, and this start names no store, so it would open a new empty one at ${storeDir}; nothing was started`, { target: { root: cotalRoot(), storeDir: last }, remedy: `reopen it with --store-dir ${last}, or move that store away to start empty` });
|
|
5334
5337
|
}
|
|
5338
|
+
/** The store a bare start that names none opens: the store this root's last broker served, while
|
|
5339
|
+
* it holds data and the default store holds none, since the default would open empty and leave the
|
|
5340
|
+
* data where it was. When the broker configs name two such stores, the start refuses as
|
|
5341
|
+
* {@link refuseUnnamedLastStore} does, because which one to reopen is the operator's choice. */
|
|
5342
|
+
function reopenLastStore(storeDir) {
|
|
5343
|
+
if (existsSync(join(storeDir, "jetstream")))
|
|
5344
|
+
return undefined;
|
|
5345
|
+
const last = lastServedStores(cotalRoot(), storeDir);
|
|
5346
|
+
if (last.length > 1)
|
|
5347
|
+
refuseUnnamedLastStore(storeDir);
|
|
5348
|
+
if (last.length === 1)
|
|
5349
|
+
for (const line of hang("", `reopening ${last[0]}, the store this root's last broker served`, terminalWidth(process.stdout), c.dim))
|
|
5350
|
+
console.log(line);
|
|
5351
|
+
return last[0];
|
|
5352
|
+
}
|
|
5335
5353
|
/** A `--store-dir` that does not exist yet, while the last served store holds data, is taken for a
|
|
5336
5354
|
* mistyped path: the start would open a new empty store there. Creating the directory first names a
|
|
5337
5355
|
* new store on purpose. */
|
|
@@ -5367,7 +5385,7 @@ function checkStartStore(storeDir, space) {
|
|
|
5367
5385
|
*/
|
|
5368
5386
|
function writeOpenBrokerConf(storeDir, space, opts) {
|
|
5369
5387
|
const confPath = cotalPath("server-open.conf");
|
|
5370
|
-
writeBrokerConfig(confPath, namedOpenConfig(openServerConfig({ port: opts.port, host: opts.host, storeDir: configuredStoreDir(cotalRoot(), storeDir), maxFileStore: opts.maxFileStore, logFile: opts.logFile, logfileSizeLimit: opts.logfileSizeLimit, logfileMaxNum: opts.logfileMaxNum, transport: opts.transport }), space));
|
|
5388
|
+
writeBrokerConfig(confPath, namedOpenConfig(openServerConfig({ port: opts.port, host: opts.host, storeDir: configuredStoreDir(cotalRoot(), storeDir), maxFileStore: opts.maxFileStore, maxPayload: opts.maxPayload, logFile: opts.logFile, logfileSizeLimit: opts.logfileSizeLimit, logfileMaxNum: opts.logfileMaxNum, transport: opts.transport }), space));
|
|
5371
5389
|
return confPath;
|
|
5372
5390
|
}
|
|
5373
5391
|
/** Write a broker configuration that `up` renders again on every start. Something other than this
|
|
@@ -5559,12 +5577,17 @@ requested = {}) {
|
|
|
5559
5577
|
// Owner-private like the auth dir: nats-server writes each pushed claim here.
|
|
5560
5578
|
if (accountResolver.kind === "full")
|
|
5561
5579
|
mkSecretDir(accountResolver.directory);
|
|
5562
|
-
writeBrokerConfig(confPath, serverConfig(auth, spaces, { transport, port, storeDir: configuredStoreDir(cotalRoot(), storeDir), maxFileStore, authTimeout, maxPayload, accountResolver, logFile: requested.logFile, logfileSizeLimit: requested.logfileSizeLimit, logfileMaxNum: requested.logfileMaxNum, host, wsPort, wsHost: host, extraAccounts }));
|
|
5580
|
+
const render = (ws) => writeBrokerConfig(confPath, serverConfig(auth, spaces, { transport, port, storeDir: configuredStoreDir(cotalRoot(), storeDir), maxFileStore, authTimeout, maxPayload, accountResolver, logFile: requested.logFile, logfileSizeLimit: requested.logfileSizeLimit, logfileMaxNum: requested.logfileMaxNum, host, wsPort: ws, wsHost: host, extraAccounts }));
|
|
5581
|
+
render(wsPort);
|
|
5582
|
+
// The chosen port is free now, but nothing holds it until the broker binds it. When another process
|
|
5583
|
+
// takes it first, the broker exits before readiness, and a controller stack start renders this
|
|
5584
|
+
// configuration again on a newly chosen port.
|
|
5585
|
+
const moveWebsocketPort = async () => { const moved = await freePort(host); render(moved); return moved; };
|
|
5563
5586
|
// Ephemeral setup cred: used only to probe reachability, pre-create the space streams/buckets
|
|
5564
5587
|
// (setupSpaceStreams) and seed the channel registry (seedChannelRegistry) — all within the
|
|
5565
5588
|
// enumerated `provisioner` scope. No broad `manager` residual for the up path.
|
|
5566
5589
|
const creds = await mintCreds(auth, newIdentity(), "provisioner");
|
|
5567
|
-
return { confPath, creds, wsPort, ...(prepared ? { prepared, stateDir } : {}), ...(authTimeout !== undefined ? { authTimeout } : {}), ...(maxPayload !== undefined ? { maxPayload } : {}), accountResolver: resolverChoice };
|
|
5590
|
+
return { confPath, creds, wsPort, moveWebsocketPort, ...(prepared ? { prepared, stateDir } : {}), ...(authTimeout !== undefined ? { authTimeout } : {}), ...(maxPayload !== undefined ? { maxPayload } : {}), accountResolver: resolverChoice };
|
|
5568
5591
|
}
|
|
5569
5592
|
/**
|
|
5570
5593
|
* Refuse the rotation if this root's own bookkeeping still shows a broker running. This is a
|