vault-cortex 0.10.2 → 0.10.3
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/docker.js +26 -1
- package/dist/init.js +4 -3
- package/dist/lifecycle.js +4 -3
- package/package.json +1 -1
package/dist/docker.js
CHANGED
|
@@ -86,7 +86,10 @@ export const buildDockerRunArgs = (params) => {
|
|
|
86
86
|
args.push("--health-interval", "15s");
|
|
87
87
|
args.push("--health-timeout", "5s");
|
|
88
88
|
args.push("--health-retries", "5");
|
|
89
|
-
|
|
89
|
+
// 180s: the remote image's init chain runs the first vault sync to
|
|
90
|
+
// completion before the MCP server boots, so /healthz appears late on
|
|
91
|
+
// fresh deploys.
|
|
92
|
+
args.push("--health-start-period", "180s");
|
|
90
93
|
args.push("--log-driver", "json-file");
|
|
91
94
|
args.push("--log-opt", "max-size=10m");
|
|
92
95
|
args.push("--log-opt", "max-file=3");
|
|
@@ -191,6 +194,28 @@ export const probeHealth = async (params, fetchFn) => {
|
|
|
191
194
|
return false;
|
|
192
195
|
}
|
|
193
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* Health-poll budget by deployment mode. Remote gets a longer window because
|
|
199
|
+
* the container's init chain runs the first vault sync to completion before
|
|
200
|
+
* the server boots — /healthz can legitimately take minutes to appear on a
|
|
201
|
+
* fresh deploy (matches the 180s container health start period plus boot
|
|
202
|
+
* margin).
|
|
203
|
+
*/
|
|
204
|
+
export const healthPollTimeoutMs = (mode) => {
|
|
205
|
+
return mode === "remote" ? 240_000 : 120_000;
|
|
206
|
+
};
|
|
207
|
+
/** Health-poll failure message with the duration derived from the actual
|
|
208
|
+
* timeout, so mode-specific budgets can't drift out of the copy. Remote
|
|
209
|
+
* adds a first-sync hint: the container's init chain retries the first
|
|
210
|
+
* sync with no upper time bound, so an expired poll does not mean the
|
|
211
|
+
* server failed — it may flip healthy after the CLI stops waiting. */
|
|
212
|
+
export const healthTimeoutMessage = (mode, timeoutMs) => {
|
|
213
|
+
const baseMessage = `Server did not respond within ${timeoutMs / 60_000} minutes — check: docker logs ${CONTAINER_NAME}`;
|
|
214
|
+
if (mode === "remote") {
|
|
215
|
+
return `${baseMessage} (a long first sync may still be running — the container keeps starting in the background)`;
|
|
216
|
+
}
|
|
217
|
+
return baseMessage;
|
|
218
|
+
};
|
|
194
219
|
/**
|
|
195
220
|
* Polls the health endpoint until it responds OK or the timeout elapses.
|
|
196
221
|
* The first `docker run` pulls the image, so the default window is generous.
|
package/dist/init.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join, resolve } from "node:path";
|
|
|
3
3
|
import { buildLocalEnv, buildRemoteEnv } from "./env.js";
|
|
4
4
|
import { captureObsidianToken } from "./get-sync-token.js";
|
|
5
5
|
import { buildDaemonNotRunningMessage, buildDockerNotInstalledMessage, buildLocalConnectMessage, buildRemoteConnectMessage, startCommand, } from "./messages.js";
|
|
6
|
-
import { pollHealth } from "./docker.js";
|
|
6
|
+
import { healthPollTimeoutMs, healthTimeoutMessage, pollHealth, } from "./docker.js";
|
|
7
7
|
import { reportPublicUrlProbe } from "./lifecycle.js";
|
|
8
8
|
import { applyOptionalSettings, askOptionalSettings, derivePublicUrlOverride, } from "./optional-settings.js";
|
|
9
9
|
import { buildFilesToWrite, readEnvPort, readEnvPublicUrl, writeFiles, } from "./scaffold.js";
|
|
@@ -185,9 +185,10 @@ const offerDockerRun = async (params, deps) => {
|
|
|
185
185
|
}
|
|
186
186
|
const spinner = prompts.spinner();
|
|
187
187
|
spinner.start("Waiting for the server to come up (first run may take a moment)");
|
|
188
|
-
const
|
|
188
|
+
const timeoutMs = healthPollTimeoutMs(mode);
|
|
189
|
+
const healthy = await pollHealth({ url: `http://127.0.0.1:${port}/healthz`, timeoutMs }, fetchFn);
|
|
189
190
|
if (!healthy) {
|
|
190
|
-
spinner.stop(
|
|
191
|
+
spinner.stop(healthTimeoutMessage(mode, timeoutMs));
|
|
191
192
|
return false;
|
|
192
193
|
}
|
|
193
194
|
spinner.stop("Server is up — health check passed.");
|
package/dist/lifecycle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join, resolve } from "node:path";
|
|
2
|
-
import { CONTAINER_NAME, pollHealth, probeHealth, } from "./docker.js";
|
|
2
|
+
import { CONTAINER_NAME, healthPollTimeoutMs, healthTimeoutMessage, pollHealth, probeHealth, } from "./docker.js";
|
|
3
3
|
import { buildDaemonNotRunningMessage, buildDockerNotInstalledMessage, } from "./messages.js";
|
|
4
4
|
import { detectMode, hasEnvPublicUrl, readEnvPort, readEnvPublicUrl, readEnvVaultPath, } from "./scaffold.js";
|
|
5
5
|
import { expandTilde } from "./vault.js";
|
|
@@ -123,12 +123,13 @@ export const recreateContainer = async (params, deps) => {
|
|
|
123
123
|
}
|
|
124
124
|
const spinner = prompts.spinner();
|
|
125
125
|
spinner.start("Waiting for the server to come up");
|
|
126
|
+
const timeoutMs = healthTimeoutMs ?? healthPollTimeoutMs(deployment.mode);
|
|
126
127
|
const healthy = await pollHealth({
|
|
127
128
|
url: `http://127.0.0.1:${deployment.port}/healthz`,
|
|
128
|
-
timeoutMs
|
|
129
|
+
timeoutMs,
|
|
129
130
|
}, fetchFn);
|
|
130
131
|
if (!healthy) {
|
|
131
|
-
spinner.stop(
|
|
132
|
+
spinner.stop(healthTimeoutMessage(deployment.mode, timeoutMs));
|
|
132
133
|
return 1;
|
|
133
134
|
}
|
|
134
135
|
spinner.stop("Server is up — health check passed.");
|