@semiont/cli 0.4.4 → 0.4.6
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/cli.mjs +297 -326
- package/dist/templates/envoy.yaml +13 -18
- package/package.json +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -6,16 +6,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
-
}) : x)(function(x) {
|
|
12
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
-
});
|
|
15
9
|
var __esm = (fn, res) => function __init() {
|
|
16
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
11
|
};
|
|
18
|
-
var __commonJS = (cb, mod) => function
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
19
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
14
|
};
|
|
21
15
|
var __export = (target, all) => {
|
|
@@ -6891,6 +6885,14 @@ function resolveBackendNpmPackage(projectRoot) {
|
|
|
6891
6885
|
return null;
|
|
6892
6886
|
}
|
|
6893
6887
|
}
|
|
6888
|
+
function resolveBackendEntryPoint(projectRoot) {
|
|
6889
|
+
try {
|
|
6890
|
+
const require2 = createRequire(path9.join(projectRoot, "node_modules", ".package.json"));
|
|
6891
|
+
return require2.resolve("@semiont/backend");
|
|
6892
|
+
} catch {
|
|
6893
|
+
return null;
|
|
6894
|
+
}
|
|
6895
|
+
}
|
|
6894
6896
|
var init_backend_paths = __esm({
|
|
6895
6897
|
"src/platforms/posix/handlers/backend-paths.ts"() {
|
|
6896
6898
|
"use strict";
|
|
@@ -6900,6 +6902,7 @@ var init_backend_paths = __esm({
|
|
|
6900
6902
|
// src/platforms/posix/handlers/backend-check.ts
|
|
6901
6903
|
import * as fs10 from "fs";
|
|
6902
6904
|
import * as path10 from "path";
|
|
6905
|
+
import { execFileSync as execFileSync8 } from "child_process";
|
|
6903
6906
|
import { SemiontProject as SemiontProject4 } from "@semiont/core/node";
|
|
6904
6907
|
import { baseUrl } from "@semiont/core";
|
|
6905
6908
|
import { SemiontApiClient } from "@semiont/api-client";
|
|
@@ -6916,7 +6919,7 @@ var init_backend_check = __esm({
|
|
|
6916
6919
|
const config = service.config;
|
|
6917
6920
|
const projectRoot = service.projectRoot;
|
|
6918
6921
|
const npmDir = resolveBackendNpmPackage(projectRoot);
|
|
6919
|
-
const entryPoint = npmDir ? path10.join(npmDir, "dist", "index.js") : null;
|
|
6922
|
+
const entryPoint = npmDir ? resolveBackendEntryPoint(projectRoot) ?? path10.join(npmDir, "dist", "index.js") : null;
|
|
6920
6923
|
const project = new SemiontProject4(projectRoot);
|
|
6921
6924
|
const pidFile = project.backendPidFile;
|
|
6922
6925
|
const appLogPath = project.backendAppLogFile;
|
|
@@ -6945,10 +6948,10 @@ var init_backend_check = __esm({
|
|
|
6945
6948
|
try {
|
|
6946
6949
|
pid = parseInt(fs10.readFileSync(pidFile, "utf-8"));
|
|
6947
6950
|
process.kill(pid, 0);
|
|
6948
|
-
status = "
|
|
6951
|
+
status = "unhealthy";
|
|
6949
6952
|
details.pid = pid;
|
|
6950
6953
|
try {
|
|
6951
|
-
const psOutput =
|
|
6954
|
+
const psOutput = execFileSync8("ps", ["-p", String(pid), "-o", "comm=,rss=,pcpu="], { encoding: "utf-8" }).trim();
|
|
6952
6955
|
if (psOutput) {
|
|
6953
6956
|
const [command, rss, cpu] = psOutput.split(/\s+/);
|
|
6954
6957
|
details.process = {
|
|
@@ -6967,7 +6970,7 @@ var init_backend_check = __esm({
|
|
|
6967
6970
|
} else {
|
|
6968
6971
|
if (savedState?.resources?.platform === "posix" && savedState.resources.data.pid && StateManager.isProcessRunning(savedState.resources.data.pid)) {
|
|
6969
6972
|
pid = savedState.resources.data.pid;
|
|
6970
|
-
status = "
|
|
6973
|
+
status = "unhealthy";
|
|
6971
6974
|
details.pid = pid;
|
|
6972
6975
|
details.fromSavedState = true;
|
|
6973
6976
|
} else {
|
|
@@ -6978,39 +6981,27 @@ var init_backend_check = __esm({
|
|
|
6978
6981
|
}
|
|
6979
6982
|
}
|
|
6980
6983
|
}
|
|
6981
|
-
if (status === "
|
|
6984
|
+
if (status === "unhealthy" || status === "unknown") {
|
|
6982
6985
|
const localUrl = `http://localhost:${config.port}`;
|
|
6983
6986
|
const client = new SemiontApiClient({ baseUrl: baseUrl(localUrl) });
|
|
6984
6987
|
try {
|
|
6985
6988
|
const healthData = await client.healthCheck();
|
|
6986
6989
|
healthy = true;
|
|
6990
|
+
status = "running";
|
|
6987
6991
|
details.health = healthData;
|
|
6988
6992
|
details.message = "Backend is running and healthy";
|
|
6989
|
-
try {
|
|
6990
|
-
const apiResponse = await fetch(`${localUrl}/api`, {
|
|
6991
|
-
signal: AbortSignal.timeout(2e3)
|
|
6992
|
-
});
|
|
6993
|
-
if (apiResponse.ok) {
|
|
6994
|
-
details.apiAvailable = true;
|
|
6995
|
-
}
|
|
6996
|
-
} catch {
|
|
6997
|
-
}
|
|
6998
6993
|
} catch (error) {
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
details.message = "Process is running but health check failed";
|
|
7002
|
-
details.healthError = error.toString();
|
|
7003
|
-
}
|
|
6994
|
+
details.message = "Process is running but health check failed";
|
|
6995
|
+
details.healthError = error.toString();
|
|
7004
6996
|
}
|
|
7005
6997
|
}
|
|
7006
6998
|
let logs;
|
|
7007
6999
|
if (fs10.existsSync(appLogPath)) {
|
|
7008
7000
|
try {
|
|
7009
|
-
const {
|
|
7010
|
-
const recentLogs = execFileSync43("tail", ["-10", appLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7001
|
+
const recentLogs = execFileSync8("tail", ["-10", appLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7011
7002
|
let errorLogs = [];
|
|
7012
7003
|
if (fs10.existsSync(errorLogPath)) {
|
|
7013
|
-
errorLogs =
|
|
7004
|
+
errorLogs = execFileSync8("tail", ["-5", errorLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7014
7005
|
}
|
|
7015
7006
|
logs = {
|
|
7016
7007
|
recent: recentLogs,
|
|
@@ -7078,6 +7069,14 @@ function resolveFrontendNpmPackage(projectRoot) {
|
|
|
7078
7069
|
return null;
|
|
7079
7070
|
}
|
|
7080
7071
|
}
|
|
7072
|
+
function resolveFrontendServerScript(projectRoot) {
|
|
7073
|
+
try {
|
|
7074
|
+
const require2 = createRequire2(path11.join(projectRoot, "node_modules", ".package.json"));
|
|
7075
|
+
return require2.resolve("@semiont/frontend");
|
|
7076
|
+
} catch {
|
|
7077
|
+
return null;
|
|
7078
|
+
}
|
|
7079
|
+
}
|
|
7081
7080
|
var init_frontend_paths = __esm({
|
|
7082
7081
|
"src/platforms/posix/handlers/frontend-paths.ts"() {
|
|
7083
7082
|
"use strict";
|
|
@@ -7087,6 +7086,7 @@ var init_frontend_paths = __esm({
|
|
|
7087
7086
|
// src/platforms/posix/handlers/frontend-check.ts
|
|
7088
7087
|
import * as fs11 from "fs";
|
|
7089
7088
|
import * as path12 from "path";
|
|
7089
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
7090
7090
|
import { SemiontProject as SemiontProject5 } from "@semiont/core/node";
|
|
7091
7091
|
var checkFrontendService, preflightFrontendCheck, frontendCheckDescriptor;
|
|
7092
7092
|
var init_frontend_check = __esm({
|
|
@@ -7101,7 +7101,7 @@ var init_frontend_check = __esm({
|
|
|
7101
7101
|
const config = service.config;
|
|
7102
7102
|
const projectRoot = service.projectRoot;
|
|
7103
7103
|
const npmDir = resolveFrontendNpmPackage(projectRoot);
|
|
7104
|
-
const serverScript = npmDir ? path12.join(npmDir, "
|
|
7104
|
+
const serverScript = npmDir ? resolveFrontendServerScript(projectRoot) ?? path12.join(npmDir, "server.js") : null;
|
|
7105
7105
|
const project = new SemiontProject5(projectRoot);
|
|
7106
7106
|
const pidFile = project.frontendPidFile;
|
|
7107
7107
|
const appLogPath = project.frontendAppLogFile;
|
|
@@ -7130,10 +7130,10 @@ var init_frontend_check = __esm({
|
|
|
7130
7130
|
try {
|
|
7131
7131
|
pid = parseInt(fs11.readFileSync(pidFile, "utf-8"));
|
|
7132
7132
|
process.kill(pid, 0);
|
|
7133
|
-
status = "
|
|
7133
|
+
status = "unhealthy";
|
|
7134
7134
|
details.pid = pid;
|
|
7135
7135
|
try {
|
|
7136
|
-
const psOutput =
|
|
7136
|
+
const psOutput = execFileSync9("ps", ["-p", String(pid), "-o", "comm=,rss=,pcpu="], { encoding: "utf-8" }).trim();
|
|
7137
7137
|
if (psOutput) {
|
|
7138
7138
|
const [command, rss, cpu] = psOutput.split(/\s+/);
|
|
7139
7139
|
details.process = {
|
|
@@ -7163,7 +7163,7 @@ var init_frontend_check = __esm({
|
|
|
7163
7163
|
}
|
|
7164
7164
|
}
|
|
7165
7165
|
}
|
|
7166
|
-
if (status === "
|
|
7166
|
+
if (status === "unhealthy" || status === "unknown") {
|
|
7167
7167
|
const healthUrl = `http://localhost:${config.port}`;
|
|
7168
7168
|
try {
|
|
7169
7169
|
const response = await fetch(healthUrl, {
|
|
@@ -7173,44 +7173,29 @@ var init_frontend_check = __esm({
|
|
|
7173
7173
|
});
|
|
7174
7174
|
if (response.ok) {
|
|
7175
7175
|
healthy = true;
|
|
7176
|
+
status = "running";
|
|
7176
7177
|
details.message = "Frontend is running and healthy";
|
|
7177
7178
|
details.statusCode = response.status;
|
|
7178
7179
|
const contentType = response.headers.get("content-type");
|
|
7179
7180
|
if (contentType?.includes("text/html")) {
|
|
7180
|
-
details.framework = "Next.js";
|
|
7181
7181
|
details.htmlAvailable = true;
|
|
7182
7182
|
}
|
|
7183
|
-
try {
|
|
7184
|
-
const apiResponse = await fetch(`${healthUrl}/api/health`, {
|
|
7185
|
-
redirect: "follow",
|
|
7186
|
-
signal: AbortSignal.timeout(2e3)
|
|
7187
|
-
});
|
|
7188
|
-
if (apiResponse.ok) {
|
|
7189
|
-
details.apiRouteAvailable = true;
|
|
7190
|
-
}
|
|
7191
|
-
} catch {
|
|
7192
|
-
}
|
|
7193
7183
|
} else {
|
|
7194
|
-
status = "unhealthy";
|
|
7195
7184
|
details.message = `Health check failed with status ${response.status}`;
|
|
7196
7185
|
details.healthStatus = response.status;
|
|
7197
7186
|
}
|
|
7198
7187
|
} catch (error) {
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
details.message = "Process is running but health check failed";
|
|
7202
|
-
details.healthError = error.toString();
|
|
7203
|
-
}
|
|
7188
|
+
details.message = "Process is running but health check failed";
|
|
7189
|
+
details.healthError = error.toString();
|
|
7204
7190
|
}
|
|
7205
7191
|
}
|
|
7206
7192
|
let logs;
|
|
7207
7193
|
if (fs11.existsSync(appLogPath)) {
|
|
7208
7194
|
try {
|
|
7209
|
-
const {
|
|
7210
|
-
const recentLogs = execFileSync43("tail", ["-10", appLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7195
|
+
const recentLogs = execFileSync9("tail", ["-10", appLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7211
7196
|
let errorLogs = [];
|
|
7212
7197
|
if (fs11.existsSync(errorLogPath)) {
|
|
7213
|
-
errorLogs =
|
|
7198
|
+
errorLogs = execFileSync9("tail", ["-5", errorLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7214
7199
|
}
|
|
7215
7200
|
logs = {
|
|
7216
7201
|
recent: recentLogs,
|
|
@@ -7729,8 +7714,8 @@ async function startJanusGraph(context) {
|
|
|
7729
7714
|
for (let i = 0; i < maxAttempts; i++) {
|
|
7730
7715
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
7731
7716
|
try {
|
|
7732
|
-
const { execFileSync:
|
|
7733
|
-
|
|
7717
|
+
const { execFileSync: execFileSync45 } = await import("child_process");
|
|
7718
|
+
execFileSync45(gremlinShellScript, ["-e", "g.V().count()"], {
|
|
7734
7719
|
stdio: "ignore",
|
|
7735
7720
|
timeout: 5e3
|
|
7736
7721
|
});
|
|
@@ -7828,7 +7813,7 @@ var init_graph_start = __esm({
|
|
|
7828
7813
|
});
|
|
7829
7814
|
|
|
7830
7815
|
// src/platforms/posix/handlers/backend-start.ts
|
|
7831
|
-
import { spawn as spawn4, execFileSync as
|
|
7816
|
+
import { spawn as spawn4, execFileSync as execFileSync10 } from "child_process";
|
|
7832
7817
|
import * as fs16 from "fs";
|
|
7833
7818
|
import * as path16 from "path";
|
|
7834
7819
|
import { SemiontProject as SemiontProject7 } from "@semiont/core/node";
|
|
@@ -7852,7 +7837,7 @@ var init_backend_start = __esm({
|
|
|
7852
7837
|
metadata: { serviceType: "backend" }
|
|
7853
7838
|
};
|
|
7854
7839
|
}
|
|
7855
|
-
const entryPoint = path16.join(npmDir, "dist", "index.js");
|
|
7840
|
+
const entryPoint = resolveBackendEntryPoint(projectRoot) ?? path16.join(npmDir, "dist", "index.js");
|
|
7856
7841
|
const project = new SemiontProject7(projectRoot);
|
|
7857
7842
|
const pidFile = project.backendPidFile;
|
|
7858
7843
|
const logsDir = project.backendLogsDir;
|
|
@@ -7877,10 +7862,12 @@ var init_backend_start = __esm({
|
|
|
7877
7862
|
const pid = parseInt(fs16.readFileSync(pidFile, "utf-8"));
|
|
7878
7863
|
try {
|
|
7879
7864
|
process.kill(pid, 0);
|
|
7865
|
+
if (!service.quiet) {
|
|
7866
|
+
printInfo(`Backend is already running with PID ${pid}`);
|
|
7867
|
+
}
|
|
7880
7868
|
return {
|
|
7881
|
-
success:
|
|
7882
|
-
|
|
7883
|
-
metadata: { serviceType: "backend", pid }
|
|
7869
|
+
success: true,
|
|
7870
|
+
metadata: { serviceType: "backend", pid, alreadyRunning: true }
|
|
7884
7871
|
};
|
|
7885
7872
|
} catch {
|
|
7886
7873
|
fs16.unlinkSync(pidFile);
|
|
@@ -7971,7 +7958,7 @@ var init_backend_start = __esm({
|
|
|
7971
7958
|
printInfo("Running database migrations...");
|
|
7972
7959
|
}
|
|
7973
7960
|
try {
|
|
7974
|
-
|
|
7961
|
+
execFileSync10("npx", ["prisma", "migrate", "deploy", `--schema=${prismaSchemaPath}`], {
|
|
7975
7962
|
cwd: packageDir,
|
|
7976
7963
|
env: { ...process.env, DATABASE_URL: databaseUrl },
|
|
7977
7964
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -8095,7 +8082,7 @@ var init_backend_start = __esm({
|
|
|
8095
8082
|
checks.push(await checkPortFree(config.port));
|
|
8096
8083
|
}
|
|
8097
8084
|
if (npmDir) {
|
|
8098
|
-
checks.push(checkFileExists(path16.join(npmDir, "dist", "index.js"), "backend dist/index.js"));
|
|
8085
|
+
checks.push(checkFileExists(resolveBackendEntryPoint(projectRoot) ?? path16.join(npmDir, "dist", "index.js"), "backend dist/index.js"));
|
|
8099
8086
|
} else {
|
|
8100
8087
|
checks.push({ name: "backend-npm-package", pass: false, message: "@semiont/backend not installed \u2014 run: semiont provision" });
|
|
8101
8088
|
}
|
|
@@ -8141,7 +8128,7 @@ var init_frontend_start = __esm({
|
|
|
8141
8128
|
metadata: { serviceType: "frontend" }
|
|
8142
8129
|
};
|
|
8143
8130
|
}
|
|
8144
|
-
const serverScript = path17.join(npmDir, "
|
|
8131
|
+
const serverScript = resolveFrontendServerScript(projectRoot) ?? path17.join(npmDir, "server.js");
|
|
8145
8132
|
const project = new SemiontProject8(projectRoot);
|
|
8146
8133
|
const pidFile = project.frontendPidFile;
|
|
8147
8134
|
const logsDir = project.frontendLogsDir;
|
|
@@ -8166,10 +8153,12 @@ var init_frontend_start = __esm({
|
|
|
8166
8153
|
const pid = parseInt(fs17.readFileSync(pidFile, "utf-8"));
|
|
8167
8154
|
try {
|
|
8168
8155
|
process.kill(pid, 0);
|
|
8156
|
+
if (!service.quiet) {
|
|
8157
|
+
printInfo(`Frontend is already running with PID ${pid}`);
|
|
8158
|
+
}
|
|
8169
8159
|
return {
|
|
8170
|
-
success:
|
|
8171
|
-
|
|
8172
|
-
metadata: { serviceType: "frontend", pid }
|
|
8160
|
+
success: true,
|
|
8161
|
+
metadata: { serviceType: "frontend", pid, alreadyRunning: true }
|
|
8173
8162
|
};
|
|
8174
8163
|
} catch {
|
|
8175
8164
|
fs17.unlinkSync(pidFile);
|
|
@@ -8183,8 +8172,6 @@ var init_frontend_start = __esm({
|
|
|
8183
8172
|
metadata: { serviceType: "frontend", port }
|
|
8184
8173
|
};
|
|
8185
8174
|
}
|
|
8186
|
-
const jwtSecret = readSecret("JWT_SECRET");
|
|
8187
|
-
if (!jwtSecret) throw new Error(`JWT_SECRET not found in ${getSecretsFilePath()} \u2014 run: semiont provision`);
|
|
8188
8175
|
const envConfig = service.environmentConfig;
|
|
8189
8176
|
const backendService = envConfig.services["backend"];
|
|
8190
8177
|
const backendUrl = `http://127.0.0.1:${backendService.port}`;
|
|
@@ -8197,20 +8184,12 @@ var init_frontend_start = __esm({
|
|
|
8197
8184
|
...Object.fromEntries(Object.entries(process.env).filter(([, v]) => v !== void 0)),
|
|
8198
8185
|
NODE_ENV: envConfig.env?.NODE_ENV ?? "development",
|
|
8199
8186
|
PORT: port.toString(),
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
NEXT_PUBLIC_ALLOWED_ORIGINS: allowedOrigins.join(","),
|
|
8206
|
-
LOG_DIR: logsDir,
|
|
8207
|
-
NEXTAUTH_SECRET: jwtSecret
|
|
8187
|
+
SEMIONT_BACKEND_URL: backendUrl,
|
|
8188
|
+
SEMIONT_SITE_NAME: config.siteName,
|
|
8189
|
+
SEMIONT_BASE_URL: frontendUrl,
|
|
8190
|
+
SEMIONT_OAUTH_ALLOWED_DOMAINS: oauthAllowedDomains.join(","),
|
|
8191
|
+
LOG_DIR: logsDir
|
|
8208
8192
|
};
|
|
8209
|
-
const nextPublicVars = Object.keys(env).filter((k) => k.startsWith("NEXT_PUBLIC_"));
|
|
8210
|
-
if (!service.quiet) {
|
|
8211
|
-
printInfo(`Environment variables: ${nextPublicVars.length} NEXT_PUBLIC_* vars found`);
|
|
8212
|
-
nextPublicVars.forEach((k) => printInfo(` ${k}=${env[k]}`));
|
|
8213
|
-
}
|
|
8214
8193
|
fs17.mkdirSync(logsDir, { recursive: true });
|
|
8215
8194
|
fs17.mkdirSync(path17.dirname(pidFile), { recursive: true });
|
|
8216
8195
|
const appLogPath = path17.join(logsDir, "app.log");
|
|
@@ -8331,16 +8310,13 @@ var init_frontend_start = __esm({
|
|
|
8331
8310
|
checks.push(await checkPortFree(config.port));
|
|
8332
8311
|
}
|
|
8333
8312
|
if (npmDir) {
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
"frontend server.js"
|
|
8337
|
-
));
|
|
8313
|
+
const serverScript = resolveFrontendServerScript(projectRoot) ?? path17.join(npmDir, "server.js");
|
|
8314
|
+
checks.push(checkFileExists(serverScript, "frontend server.js"));
|
|
8338
8315
|
} else {
|
|
8339
8316
|
checks.push({ name: "frontend-npm-package", pass: false, message: "@semiont/frontend not installed \u2014 run: semiont provision" });
|
|
8340
8317
|
}
|
|
8341
8318
|
checks.push(
|
|
8342
|
-
checkFileExists(project.frontendLogsDir, "frontend logs dir (run: semiont provision)")
|
|
8343
|
-
checkJwtSecretExists()
|
|
8319
|
+
checkFileExists(project.frontendLogsDir, "frontend logs dir (run: semiont provision)")
|
|
8344
8320
|
);
|
|
8345
8321
|
return preflightFromChecks(checks);
|
|
8346
8322
|
};
|
|
@@ -8380,10 +8356,12 @@ var init_proxy_start = __esm({
|
|
|
8380
8356
|
const pid = parseInt(fs18.readFileSync(paths.pidFile, "utf-8"));
|
|
8381
8357
|
try {
|
|
8382
8358
|
process.kill(pid, 0);
|
|
8359
|
+
if (!service.quiet) {
|
|
8360
|
+
printInfo(`Proxy is already running with PID ${pid}`);
|
|
8361
|
+
}
|
|
8383
8362
|
return {
|
|
8384
|
-
success:
|
|
8385
|
-
|
|
8386
|
-
metadata: { serviceType: "proxy", pid }
|
|
8363
|
+
success: true,
|
|
8364
|
+
metadata: { serviceType: "proxy", pid, alreadyRunning: true }
|
|
8387
8365
|
};
|
|
8388
8366
|
} catch {
|
|
8389
8367
|
fs18.unlinkSync(paths.pidFile);
|
|
@@ -8664,7 +8642,7 @@ var init_mcp_provision = __esm({
|
|
|
8664
8642
|
|
|
8665
8643
|
// src/platforms/posix/handlers/graph-provision.ts
|
|
8666
8644
|
import * as fs20 from "fs/promises";
|
|
8667
|
-
import { execFileSync as
|
|
8645
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
8668
8646
|
async function fileExists2(path46) {
|
|
8669
8647
|
try {
|
|
8670
8648
|
await fs20.access(path46);
|
|
@@ -8708,7 +8686,7 @@ var init_graph_provision = __esm({
|
|
|
8708
8686
|
dataStorageDir
|
|
8709
8687
|
} = paths;
|
|
8710
8688
|
try {
|
|
8711
|
-
|
|
8689
|
+
execFileSync11("java", ["-version"], { stdio: "ignore" });
|
|
8712
8690
|
} catch {
|
|
8713
8691
|
return {
|
|
8714
8692
|
success: false,
|
|
@@ -8721,9 +8699,9 @@ var init_graph_provision = __esm({
|
|
|
8721
8699
|
const downloadUrl = `https://github.com/JanusGraph/janusgraph/releases/download/v${janusgraphVersion}/janusgraph-${janusgraphVersion}.zip`;
|
|
8722
8700
|
if (!await fileExists2(janusgraphDir)) {
|
|
8723
8701
|
console.log(`Downloading JanusGraph ${janusgraphVersion}...`);
|
|
8724
|
-
|
|
8702
|
+
execFileSync11("curl", ["-L", "-o", zipPath, downloadUrl], { stdio: "inherit" });
|
|
8725
8703
|
console.log("Extracting JanusGraph...");
|
|
8726
|
-
|
|
8704
|
+
execFileSync11("unzip", ["-q", zipPath, "-d", dataDir], { stdio: "inherit" });
|
|
8727
8705
|
await fs20.unlink(zipPath);
|
|
8728
8706
|
}
|
|
8729
8707
|
let graphProperties = `
|
|
@@ -8852,7 +8830,7 @@ ssl: {
|
|
|
8852
8830
|
import * as fs21 from "fs";
|
|
8853
8831
|
import * as path18 from "path";
|
|
8854
8832
|
import * as crypto from "crypto";
|
|
8855
|
-
import { execFileSync as
|
|
8833
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
8856
8834
|
import { SemiontProject as SemiontProject9 } from "@semiont/core/node";
|
|
8857
8835
|
var SEMIONT_VERSION, provisionBackendService, preflightBackendProvision, backendProvisionDescriptor;
|
|
8858
8836
|
var init_backend_provision = __esm({
|
|
@@ -8861,7 +8839,7 @@ var init_backend_provision = __esm({
|
|
|
8861
8839
|
init_cli_logger();
|
|
8862
8840
|
init_backend_paths();
|
|
8863
8841
|
init_preflight_utils();
|
|
8864
|
-
SEMIONT_VERSION = "0.4.
|
|
8842
|
+
SEMIONT_VERSION = "0.4.6";
|
|
8865
8843
|
provisionBackendService = async (context) => {
|
|
8866
8844
|
const { service, options } = context;
|
|
8867
8845
|
const projectRoot = service.projectRoot;
|
|
@@ -8870,7 +8848,7 @@ var init_backend_provision = __esm({
|
|
|
8870
8848
|
printInfo(`Installing ${packageSpec}...`);
|
|
8871
8849
|
}
|
|
8872
8850
|
try {
|
|
8873
|
-
|
|
8851
|
+
execFileSync12("npm", ["install", packageSpec, "--prefix", projectRoot], {
|
|
8874
8852
|
cwd: projectRoot,
|
|
8875
8853
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8876
8854
|
});
|
|
@@ -8892,7 +8870,7 @@ var init_backend_provision = __esm({
|
|
|
8892
8870
|
metadata: { serviceType: "backend" }
|
|
8893
8871
|
};
|
|
8894
8872
|
}
|
|
8895
|
-
const entryPoint = path18.join(npmDir, "dist", "index.js");
|
|
8873
|
+
const entryPoint = resolveBackendEntryPoint(projectRoot) ?? path18.join(npmDir, "dist", "index.js");
|
|
8896
8874
|
const project = new SemiontProject9(projectRoot);
|
|
8897
8875
|
if (!service.quiet) {
|
|
8898
8876
|
printInfo(`Provisioning backend service ${service.name}...`);
|
|
@@ -8931,7 +8909,7 @@ var init_backend_provision = __esm({
|
|
|
8931
8909
|
printInfo("Generating Prisma client...");
|
|
8932
8910
|
}
|
|
8933
8911
|
try {
|
|
8934
|
-
|
|
8912
|
+
execFileSync12("npx", ["prisma", "generate", `--schema=${prismaSchemaPath}`], {
|
|
8935
8913
|
cwd: packageDir,
|
|
8936
8914
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8937
8915
|
});
|
|
@@ -9003,8 +8981,7 @@ var init_backend_provision = __esm({
|
|
|
9003
8981
|
// src/platforms/posix/handlers/frontend-provision.ts
|
|
9004
8982
|
import * as fs22 from "fs";
|
|
9005
8983
|
import * as path19 from "path";
|
|
9006
|
-
import
|
|
9007
|
-
import { execFileSync as execFileSync11 } from "child_process";
|
|
8984
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
9008
8985
|
import { SemiontProject as SemiontProject10 } from "@semiont/core/node";
|
|
9009
8986
|
var SEMIONT_VERSION2, provisionFrontendService, preflightFrontendProvision, frontendProvisionDescriptor;
|
|
9010
8987
|
var init_frontend_provision = __esm({
|
|
@@ -9013,16 +8990,16 @@ var init_frontend_provision = __esm({
|
|
|
9013
8990
|
init_cli_logger();
|
|
9014
8991
|
init_frontend_paths();
|
|
9015
8992
|
init_preflight_utils();
|
|
9016
|
-
SEMIONT_VERSION2 = "0.4.
|
|
8993
|
+
SEMIONT_VERSION2 = "0.4.6";
|
|
9017
8994
|
provisionFrontendService = async (context) => {
|
|
9018
|
-
const { service
|
|
8995
|
+
const { service } = context;
|
|
9019
8996
|
const projectRoot = service.projectRoot;
|
|
9020
8997
|
const packageSpec = `@semiont/frontend@${SEMIONT_VERSION2}`;
|
|
9021
8998
|
if (!service.quiet) {
|
|
9022
8999
|
printInfo(`Installing ${packageSpec}...`);
|
|
9023
9000
|
}
|
|
9024
9001
|
try {
|
|
9025
|
-
|
|
9002
|
+
execFileSync13("npm", ["install", packageSpec, "--prefix", projectRoot], {
|
|
9026
9003
|
cwd: projectRoot,
|
|
9027
9004
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
9028
9005
|
});
|
|
@@ -9044,7 +9021,7 @@ var init_frontend_provision = __esm({
|
|
|
9044
9021
|
metadata: { serviceType: "frontend" }
|
|
9045
9022
|
};
|
|
9046
9023
|
}
|
|
9047
|
-
const serverScript = path19.join(npmDir, "
|
|
9024
|
+
const serverScript = path19.join(npmDir, "server.js");
|
|
9048
9025
|
const project = new SemiontProject10(projectRoot);
|
|
9049
9026
|
if (!service.quiet) {
|
|
9050
9027
|
printInfo(`Provisioning frontend service ${service.name}...`);
|
|
@@ -9055,14 +9032,6 @@ var init_frontend_provision = __esm({
|
|
|
9055
9032
|
if (!service.quiet) {
|
|
9056
9033
|
printInfo(`Created runtime directories in: ${project.frontendLogsDir}`);
|
|
9057
9034
|
}
|
|
9058
|
-
let nextAuthSecret = options.rotateSecret ? void 0 : readSecret("JWT_SECRET");
|
|
9059
|
-
if (!nextAuthSecret) {
|
|
9060
|
-
nextAuthSecret = crypto2.randomBytes(32).toString("base64");
|
|
9061
|
-
writeSecret("JWT_SECRET", nextAuthSecret);
|
|
9062
|
-
printInfo(options.rotateSecret ? "Generated new JWT_SECRET (--rotate-secret)" : "Generated new JWT_SECRET");
|
|
9063
|
-
} else {
|
|
9064
|
-
printInfo("Using existing JWT_SECRET from secrets file");
|
|
9065
|
-
}
|
|
9066
9035
|
if (!service.quiet) {
|
|
9067
9036
|
printInfo("Using pre-built npm package \u2014 skipping install, build, and workspace steps");
|
|
9068
9037
|
}
|
|
@@ -9409,7 +9378,7 @@ var init_graph_stop = __esm({
|
|
|
9409
9378
|
});
|
|
9410
9379
|
|
|
9411
9380
|
// src/platforms/posix/utils/process-manager.ts
|
|
9412
|
-
import { execFileSync as
|
|
9381
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
9413
9382
|
async function killProcessGroupAndRelated(pid, serviceType, verbose = false) {
|
|
9414
9383
|
let killed = false;
|
|
9415
9384
|
try {
|
|
@@ -9449,7 +9418,7 @@ async function killProcessGroupAndRelated(pid, serviceType, verbose = false) {
|
|
|
9449
9418
|
try {
|
|
9450
9419
|
for (const pattern of cleanupPatterns.patterns) {
|
|
9451
9420
|
try {
|
|
9452
|
-
|
|
9421
|
+
execFileSync14("pkill", ["-f", pattern], { stdio: "ignore" });
|
|
9453
9422
|
} catch {
|
|
9454
9423
|
}
|
|
9455
9424
|
}
|
|
@@ -9526,7 +9495,7 @@ var init_backend_stop = __esm({
|
|
|
9526
9495
|
const { service } = context;
|
|
9527
9496
|
const projectRoot = service.projectRoot;
|
|
9528
9497
|
const npmDir = resolveBackendNpmPackage(projectRoot);
|
|
9529
|
-
const entryPoint = npmDir ? path22.join(npmDir, "dist", "index.js") : null;
|
|
9498
|
+
const entryPoint = npmDir ? resolveBackendEntryPoint(projectRoot) ?? path22.join(npmDir, "dist", "index.js") : null;
|
|
9530
9499
|
const project = new SemiontProject11(projectRoot);
|
|
9531
9500
|
const pidFile = project.backendPidFile;
|
|
9532
9501
|
const appLogPath = project.backendAppLogFile;
|
|
@@ -10257,12 +10226,12 @@ var init_inference_stop = __esm({
|
|
|
10257
10226
|
|
|
10258
10227
|
// src/platforms/posix/handlers/inference-provision.ts
|
|
10259
10228
|
import * as fs30 from "fs";
|
|
10260
|
-
import { execFileSync as
|
|
10229
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
10261
10230
|
function detectGpu() {
|
|
10262
10231
|
const platform = process.platform;
|
|
10263
10232
|
if (platform === "darwin") {
|
|
10264
10233
|
try {
|
|
10265
|
-
const brand =
|
|
10234
|
+
const brand = execFileSync15("sysctl", ["-n", "machdep.cpu.brand_string"], {
|
|
10266
10235
|
encoding: "utf-8"
|
|
10267
10236
|
}).trim();
|
|
10268
10237
|
if (brand.includes("Apple")) {
|
|
@@ -10274,7 +10243,7 @@ function detectGpu() {
|
|
|
10274
10243
|
}
|
|
10275
10244
|
}
|
|
10276
10245
|
try {
|
|
10277
|
-
const gpuName =
|
|
10246
|
+
const gpuName = execFileSync15("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
10278
10247
|
encoding: "utf-8",
|
|
10279
10248
|
stdio: ["ignore", "pipe", "ignore"]
|
|
10280
10249
|
}).trim();
|
|
@@ -10284,7 +10253,7 @@ function detectGpu() {
|
|
|
10284
10253
|
} catch {
|
|
10285
10254
|
}
|
|
10286
10255
|
try {
|
|
10287
|
-
const output =
|
|
10256
|
+
const output = execFileSync15("rocm-smi", ["--showproductname"], {
|
|
10288
10257
|
encoding: "utf-8",
|
|
10289
10258
|
stdio: ["ignore", "pipe", "ignore"]
|
|
10290
10259
|
}).trim();
|
|
@@ -10320,7 +10289,7 @@ var init_inference_provision = __esm({
|
|
|
10320
10289
|
printInfo(`Pulling model ${model}...`);
|
|
10321
10290
|
}
|
|
10322
10291
|
try {
|
|
10323
|
-
|
|
10292
|
+
execFileSync15("ollama", ["pull", model], {
|
|
10324
10293
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
10325
10294
|
});
|
|
10326
10295
|
pulledModels.push(model);
|
|
@@ -10437,7 +10406,7 @@ var init_handlers = __esm({
|
|
|
10437
10406
|
});
|
|
10438
10407
|
|
|
10439
10408
|
// src/platforms/posix/platform.ts
|
|
10440
|
-
import { execFileSync as
|
|
10409
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
10441
10410
|
import * as fs31 from "fs";
|
|
10442
10411
|
import * as path25 from "path";
|
|
10443
10412
|
var PosixPlatform;
|
|
@@ -10527,7 +10496,7 @@ var init_platform2 = __esm({
|
|
|
10527
10496
|
try {
|
|
10528
10497
|
if (process.platform === "darwin") {
|
|
10529
10498
|
try {
|
|
10530
|
-
const output =
|
|
10499
|
+
const output = execFileSync16(
|
|
10531
10500
|
"log",
|
|
10532
10501
|
["show", "--process", String(pid), "--last", `${tail}m`, "--style", "json"],
|
|
10533
10502
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -10549,7 +10518,7 @@ var init_platform2 = __esm({
|
|
|
10549
10518
|
}
|
|
10550
10519
|
} else {
|
|
10551
10520
|
try {
|
|
10552
|
-
const output =
|
|
10521
|
+
const output = execFileSync16(
|
|
10553
10522
|
"journalctl",
|
|
10554
10523
|
[`_PID=${pid}`, "-n", String(tail), "--no-pager", "--output=json"],
|
|
10555
10524
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -10656,13 +10625,13 @@ var init_platform2 = __esm({
|
|
|
10656
10625
|
tailFile(filePath, lines) {
|
|
10657
10626
|
try {
|
|
10658
10627
|
if (process.platform === "win32") {
|
|
10659
|
-
return
|
|
10628
|
+
return execFileSync16(
|
|
10660
10629
|
"powershell",
|
|
10661
10630
|
["-Command", `Get-Content '${filePath}' -Tail ${lines}`],
|
|
10662
10631
|
{ encoding: "utf-8" }
|
|
10663
10632
|
);
|
|
10664
10633
|
} else {
|
|
10665
|
-
return
|
|
10634
|
+
return execFileSync16(
|
|
10666
10635
|
"tail",
|
|
10667
10636
|
["-n", String(lines), filePath],
|
|
10668
10637
|
{ encoding: "utf-8" }
|
|
@@ -10725,7 +10694,7 @@ var init_platform2 = __esm({
|
|
|
10725
10694
|
});
|
|
10726
10695
|
|
|
10727
10696
|
// src/platforms/container/handlers/web-check.ts
|
|
10728
|
-
import { execFileSync as
|
|
10697
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
10729
10698
|
import { baseUrl as baseUrl2 } from "@semiont/core";
|
|
10730
10699
|
import { SemiontApiClient as SemiontApiClient2 } from "@semiont/api-client";
|
|
10731
10700
|
var checkWebContainer, preflightWebCheck, webCheckDescriptor;
|
|
@@ -10737,7 +10706,7 @@ var init_web_check = __esm({
|
|
|
10737
10706
|
const { platform, service, runtime, containerName } = context;
|
|
10738
10707
|
const config = service.config;
|
|
10739
10708
|
try {
|
|
10740
|
-
const containerStatus =
|
|
10709
|
+
const containerStatus = execFileSync17(
|
|
10741
10710
|
runtime,
|
|
10742
10711
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10743
10712
|
{ encoding: "utf-8" }
|
|
@@ -10753,14 +10722,14 @@ var init_web_check = __esm({
|
|
|
10753
10722
|
metadata: { containerStatus }
|
|
10754
10723
|
};
|
|
10755
10724
|
}
|
|
10756
|
-
const containerId =
|
|
10725
|
+
const containerId = execFileSync17(
|
|
10757
10726
|
runtime,
|
|
10758
10727
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
10759
10728
|
{ encoding: "utf-8" }
|
|
10760
10729
|
).trim().substring(0, 12);
|
|
10761
10730
|
let dockerHealthStatus;
|
|
10762
10731
|
try {
|
|
10763
|
-
dockerHealthStatus =
|
|
10732
|
+
dockerHealthStatus = execFileSync17(
|
|
10764
10733
|
runtime,
|
|
10765
10734
|
["inspect", containerName, "--format", "{{.State.Health.Status}}"],
|
|
10766
10735
|
{ encoding: "utf-8" }
|
|
@@ -10901,7 +10870,7 @@ var init_web_check = __esm({
|
|
|
10901
10870
|
});
|
|
10902
10871
|
|
|
10903
10872
|
// src/platforms/container/handlers/database-check.ts
|
|
10904
|
-
import { execFileSync as
|
|
10873
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
10905
10874
|
var checkDatabaseContainer, preflightDatabaseCheck2, databaseCheckDescriptor2;
|
|
10906
10875
|
var init_database_check2 = __esm({
|
|
10907
10876
|
"src/platforms/container/handlers/database-check.ts"() {
|
|
@@ -10911,7 +10880,7 @@ var init_database_check2 = __esm({
|
|
|
10911
10880
|
const { platform, service, runtime, containerName } = context;
|
|
10912
10881
|
const config = service.config;
|
|
10913
10882
|
try {
|
|
10914
|
-
const containerStatus =
|
|
10883
|
+
const containerStatus = execFileSync18(
|
|
10915
10884
|
runtime,
|
|
10916
10885
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10917
10886
|
{ encoding: "utf-8" }
|
|
@@ -10927,7 +10896,7 @@ var init_database_check2 = __esm({
|
|
|
10927
10896
|
metadata: { containerStatus }
|
|
10928
10897
|
};
|
|
10929
10898
|
}
|
|
10930
|
-
const containerId =
|
|
10899
|
+
const containerId = execFileSync18(
|
|
10931
10900
|
runtime,
|
|
10932
10901
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
10933
10902
|
{ encoding: "utf-8" }
|
|
@@ -10946,13 +10915,13 @@ var init_database_check2 = __esm({
|
|
|
10946
10915
|
const port = config.port;
|
|
10947
10916
|
try {
|
|
10948
10917
|
try {
|
|
10949
|
-
|
|
10918
|
+
execFileSync18(
|
|
10950
10919
|
runtime,
|
|
10951
10920
|
["exec", containerName, "sh", "-c", `netstat -ln | grep :${port}`],
|
|
10952
10921
|
{ encoding: "utf-8" }
|
|
10953
10922
|
);
|
|
10954
10923
|
} catch {
|
|
10955
|
-
|
|
10924
|
+
execFileSync18(
|
|
10956
10925
|
runtime,
|
|
10957
10926
|
["exec", containerName, "sh", "-c", `nc -z localhost ${port}`],
|
|
10958
10927
|
{ encoding: "utf-8" }
|
|
@@ -11023,7 +10992,7 @@ var init_database_check2 = __esm({
|
|
|
11023
10992
|
});
|
|
11024
10993
|
|
|
11025
10994
|
// src/platforms/container/handlers/graph-check.ts
|
|
11026
|
-
import { execFileSync as
|
|
10995
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
11027
10996
|
function getGraphEndpoint2(graphType, port) {
|
|
11028
10997
|
const host = "localhost";
|
|
11029
10998
|
switch (graphType) {
|
|
@@ -11048,7 +11017,7 @@ var init_graph_check2 = __esm({
|
|
|
11048
11017
|
const config = service.config;
|
|
11049
11018
|
const graphType = config.type;
|
|
11050
11019
|
try {
|
|
11051
|
-
const containerStatus =
|
|
11020
|
+
const containerStatus = execFileSync19(
|
|
11052
11021
|
runtime,
|
|
11053
11022
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11054
11023
|
{ encoding: "utf-8" }
|
|
@@ -11068,12 +11037,12 @@ var init_graph_check2 = __esm({
|
|
|
11068
11037
|
}
|
|
11069
11038
|
};
|
|
11070
11039
|
}
|
|
11071
|
-
const containerId =
|
|
11040
|
+
const containerId = execFileSync19(
|
|
11072
11041
|
runtime,
|
|
11073
11042
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
11074
11043
|
{ encoding: "utf-8" }
|
|
11075
11044
|
).trim();
|
|
11076
|
-
const portsOutput =
|
|
11045
|
+
const portsOutput = execFileSync19(
|
|
11077
11046
|
runtime,
|
|
11078
11047
|
["port", containerName],
|
|
11079
11048
|
{ encoding: "utf-8" }
|
|
@@ -11099,7 +11068,7 @@ var init_graph_check2 = __esm({
|
|
|
11099
11068
|
case "janusgraph":
|
|
11100
11069
|
case "neptune":
|
|
11101
11070
|
try {
|
|
11102
|
-
|
|
11071
|
+
execFileSync19(
|
|
11103
11072
|
runtime,
|
|
11104
11073
|
["exec", containerName, "sh", "-c", `echo 'test' | nc -w 1 localhost ${port}`],
|
|
11105
11074
|
{ encoding: "utf-8", timeout: 5e3, stdio: "pipe" }
|
|
@@ -11107,12 +11076,12 @@ var init_graph_check2 = __esm({
|
|
|
11107
11076
|
isHealthy = true;
|
|
11108
11077
|
if (graphType === "janusgraph") {
|
|
11109
11078
|
try {
|
|
11110
|
-
const cassandraRunning =
|
|
11079
|
+
const cassandraRunning = execFileSync19(
|
|
11111
11080
|
runtime,
|
|
11112
11081
|
["ps", "--filter", "name=semiont-cassandra", "--format", "{{.Names}}"],
|
|
11113
11082
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
11114
11083
|
).trim().includes("semiont-cassandra");
|
|
11115
|
-
const elasticsearchRunning =
|
|
11084
|
+
const elasticsearchRunning = execFileSync19(
|
|
11116
11085
|
runtime,
|
|
11117
11086
|
["ps", "--filter", "name=semiont-elasticsearch", "--format", "{{.Names}}"],
|
|
11118
11087
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11135,7 +11104,7 @@ var init_graph_check2 = __esm({
|
|
|
11135
11104
|
}
|
|
11136
11105
|
}
|
|
11137
11106
|
} catch {
|
|
11138
|
-
const processes =
|
|
11107
|
+
const processes = execFileSync19(
|
|
11139
11108
|
runtime,
|
|
11140
11109
|
["exec", containerName, "ps", "aux"],
|
|
11141
11110
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11147,11 +11116,11 @@ var init_graph_check2 = __esm({
|
|
|
11147
11116
|
}
|
|
11148
11117
|
break;
|
|
11149
11118
|
case "neo4j":
|
|
11150
|
-
|
|
11119
|
+
execFileSync19("nc", ["-z", "localhost", String(port)], { timeout: 5e3 });
|
|
11151
11120
|
isHealthy = true;
|
|
11152
11121
|
break;
|
|
11153
11122
|
case "arangodb":
|
|
11154
|
-
const httpCode =
|
|
11123
|
+
const httpCode = execFileSync19(
|
|
11155
11124
|
"curl",
|
|
11156
11125
|
["-s", "-o", "/dev/null", "-w", "%{http_code}", `http://localhost:${port}/_api/version`],
|
|
11157
11126
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11159,7 +11128,7 @@ var init_graph_check2 = __esm({
|
|
|
11159
11128
|
isHealthy = httpCode === "200";
|
|
11160
11129
|
break;
|
|
11161
11130
|
default:
|
|
11162
|
-
|
|
11131
|
+
execFileSync19("nc", ["-z", "localhost", String(port)], { timeout: 5e3 });
|
|
11163
11132
|
isHealthy = true;
|
|
11164
11133
|
}
|
|
11165
11134
|
} catch (healthCheckError) {
|
|
@@ -11168,7 +11137,7 @@ var init_graph_check2 = __esm({
|
|
|
11168
11137
|
}
|
|
11169
11138
|
let logs;
|
|
11170
11139
|
try {
|
|
11171
|
-
const logOutput =
|
|
11140
|
+
const logOutput = execFileSync19(
|
|
11172
11141
|
runtime,
|
|
11173
11142
|
["logs", containerName, "--tail", "20"],
|
|
11174
11143
|
{ encoding: "utf-8", maxBuffer: 1024 * 1024 }
|
|
@@ -11182,7 +11151,7 @@ var init_graph_check2 = __esm({
|
|
|
11182
11151
|
};
|
|
11183
11152
|
} catch (logError) {
|
|
11184
11153
|
}
|
|
11185
|
-
const image =
|
|
11154
|
+
const image = execFileSync19(
|
|
11186
11155
|
runtime,
|
|
11187
11156
|
["inspect", containerName, "--format", "{{.Config.Image}}"],
|
|
11188
11157
|
{ encoding: "utf-8" }
|
|
@@ -11268,13 +11237,13 @@ var init_platform_resources = __esm({
|
|
|
11268
11237
|
});
|
|
11269
11238
|
|
|
11270
11239
|
// src/platforms/container/handlers/web-start.ts
|
|
11271
|
-
import { execFileSync as
|
|
11240
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
11272
11241
|
async function waitForContainer(runtime, containerName) {
|
|
11273
11242
|
const maxAttempts = 30;
|
|
11274
11243
|
let attempts = 0;
|
|
11275
11244
|
while (attempts < maxAttempts) {
|
|
11276
11245
|
try {
|
|
11277
|
-
const status =
|
|
11246
|
+
const status = execFileSync20(
|
|
11278
11247
|
runtime,
|
|
11279
11248
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11280
11249
|
{ encoding: "utf-8" }
|
|
@@ -11301,12 +11270,12 @@ var init_web_start = __esm({
|
|
|
11301
11270
|
const config = service.config;
|
|
11302
11271
|
const image = service.getImage();
|
|
11303
11272
|
try {
|
|
11304
|
-
|
|
11273
|
+
execFileSync20(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
11305
11274
|
} catch {
|
|
11306
11275
|
}
|
|
11307
11276
|
const networkName = `semiont-${service.environment}`;
|
|
11308
11277
|
try {
|
|
11309
|
-
|
|
11278
|
+
execFileSync20(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11310
11279
|
} catch {
|
|
11311
11280
|
}
|
|
11312
11281
|
const runArgs = [
|
|
@@ -11339,7 +11308,7 @@ var init_web_start = __esm({
|
|
|
11339
11308
|
printInfo(`Starting web container: ${containerName}`);
|
|
11340
11309
|
}
|
|
11341
11310
|
try {
|
|
11342
|
-
const containerId =
|
|
11311
|
+
const containerId = execFileSync20(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
11343
11312
|
await waitForContainer(runtime, containerName);
|
|
11344
11313
|
const endpoint = `http://localhost:${port}`;
|
|
11345
11314
|
return {
|
|
@@ -11390,7 +11359,7 @@ var init_web_start = __esm({
|
|
|
11390
11359
|
});
|
|
11391
11360
|
|
|
11392
11361
|
// src/platforms/container/handlers/database-start.ts
|
|
11393
|
-
import { execFileSync as
|
|
11362
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
11394
11363
|
async function waitForDatabase(runtime, containerName, image, quiet, dbUser, verbose) {
|
|
11395
11364
|
const maxAttempts = 15;
|
|
11396
11365
|
let attempts = 0;
|
|
@@ -11398,7 +11367,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11398
11367
|
const skipHealthCheck = process.env.SKIP_DB_HEALTH_CHECK === "true";
|
|
11399
11368
|
if (skipHealthCheck) {
|
|
11400
11369
|
try {
|
|
11401
|
-
const status =
|
|
11370
|
+
const status = execFileSync21(
|
|
11402
11371
|
runtime,
|
|
11403
11372
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11404
11373
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11413,7 +11382,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11413
11382
|
}
|
|
11414
11383
|
while (attempts < maxAttempts) {
|
|
11415
11384
|
try {
|
|
11416
|
-
const status =
|
|
11385
|
+
const status = execFileSync21(
|
|
11417
11386
|
runtime,
|
|
11418
11387
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11419
11388
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11433,7 +11402,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11433
11402
|
if (verbose) {
|
|
11434
11403
|
printInfo(`Checking PostgreSQL readiness with user '${dbUser}'...`);
|
|
11435
11404
|
}
|
|
11436
|
-
|
|
11405
|
+
execFileSync21(runtime, ["exec", containerName, "pg_isready", "-U", dbUser, "-t", "1"], {
|
|
11437
11406
|
stdio: verbose ? "inherit" : "ignore",
|
|
11438
11407
|
timeout: 5e3
|
|
11439
11408
|
});
|
|
@@ -11449,7 +11418,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11449
11418
|
}
|
|
11450
11419
|
} else if (image.includes("mysql")) {
|
|
11451
11420
|
try {
|
|
11452
|
-
|
|
11421
|
+
execFileSync21(runtime, ["exec", containerName, "mysqladmin", "ping", "-h", "localhost"], {
|
|
11453
11422
|
stdio: "ignore",
|
|
11454
11423
|
timeout: 5e3
|
|
11455
11424
|
});
|
|
@@ -11458,7 +11427,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11458
11427
|
}
|
|
11459
11428
|
} else if (image.includes("mongo")) {
|
|
11460
11429
|
try {
|
|
11461
|
-
|
|
11430
|
+
execFileSync21(runtime, ["exec", containerName, "mongosh", "--eval", "db.adminCommand('ping')"], {
|
|
11462
11431
|
stdio: "ignore",
|
|
11463
11432
|
timeout: 5e3
|
|
11464
11433
|
});
|
|
@@ -11492,12 +11461,12 @@ var init_database_start2 = __esm({
|
|
|
11492
11461
|
const config = service.config;
|
|
11493
11462
|
const image = service.getImage();
|
|
11494
11463
|
try {
|
|
11495
|
-
|
|
11464
|
+
execFileSync21(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
11496
11465
|
} catch {
|
|
11497
11466
|
}
|
|
11498
11467
|
const networkName = `semiont-${service.environment}`;
|
|
11499
11468
|
try {
|
|
11500
|
-
|
|
11469
|
+
execFileSync21(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11501
11470
|
} catch {
|
|
11502
11471
|
}
|
|
11503
11472
|
const runArgs = [
|
|
@@ -11519,7 +11488,7 @@ var init_database_start2 = __esm({
|
|
|
11519
11488
|
}
|
|
11520
11489
|
const volumeName = `${containerName}-data`;
|
|
11521
11490
|
try {
|
|
11522
|
-
|
|
11491
|
+
execFileSync21(runtime, ["volume", "create", volumeName], { stdio: "ignore" });
|
|
11523
11492
|
} catch {
|
|
11524
11493
|
}
|
|
11525
11494
|
const mountPath = image.includes("postgres") ? "/var/lib/postgresql/data" : image.includes("mysql") ? "/var/lib/mysql" : image.includes("mongo") ? "/data/db" : "/data";
|
|
@@ -11545,7 +11514,7 @@ var init_database_start2 = __esm({
|
|
|
11545
11514
|
printInfo(`Run command: ${runtime} ${runArgs.join(" ")}`);
|
|
11546
11515
|
}
|
|
11547
11516
|
try {
|
|
11548
|
-
const containerId =
|
|
11517
|
+
const containerId = execFileSync21(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
11549
11518
|
const dbUser = envVars.POSTGRES_USER || envVars.MYSQL_USER || envVars.MONGO_INITDB_ROOT_USERNAME;
|
|
11550
11519
|
await waitForDatabase(runtime, containerName, image, service.quiet, dbUser, context.options.verbose);
|
|
11551
11520
|
const endpoint = `localhost:${port}`;
|
|
@@ -11601,7 +11570,7 @@ var init_database_start2 = __esm({
|
|
|
11601
11570
|
// src/platforms/container/handlers/graph-start.ts
|
|
11602
11571
|
import * as fs32 from "fs/promises";
|
|
11603
11572
|
import * as path26 from "path";
|
|
11604
|
-
import { execFileSync as
|
|
11573
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
11605
11574
|
async function startJanusGraph2(context) {
|
|
11606
11575
|
const { service, runtime, containerName } = context;
|
|
11607
11576
|
const composePath = path26.join(service.projectRoot, "docker-compose.janusgraph.yml");
|
|
@@ -11613,7 +11582,7 @@ async function startJanusGraph2(context) {
|
|
|
11613
11582
|
};
|
|
11614
11583
|
}
|
|
11615
11584
|
try {
|
|
11616
|
-
const output =
|
|
11585
|
+
const output = execFileSync22(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
11617
11586
|
if (output.includes(containerName)) {
|
|
11618
11587
|
if (!service.quiet) {
|
|
11619
11588
|
printWarning("JanusGraph container is already running");
|
|
@@ -11634,7 +11603,7 @@ async function startJanusGraph2(context) {
|
|
|
11634
11603
|
if (!service.quiet) {
|
|
11635
11604
|
printInfo("Starting JanusGraph Docker stack...");
|
|
11636
11605
|
}
|
|
11637
|
-
|
|
11606
|
+
execFileSync22("docker-compose", ["-f", composePath, "up", "-d"], {
|
|
11638
11607
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
11639
11608
|
});
|
|
11640
11609
|
if (!service.quiet) {
|
|
@@ -11644,13 +11613,13 @@ async function startJanusGraph2(context) {
|
|
|
11644
11613
|
const maxAttempts = 20;
|
|
11645
11614
|
for (let i = 0; i < maxAttempts; i++) {
|
|
11646
11615
|
try {
|
|
11647
|
-
const status =
|
|
11616
|
+
const status = execFileSync22(
|
|
11648
11617
|
runtime,
|
|
11649
11618
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11650
11619
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
11651
11620
|
).trim();
|
|
11652
11621
|
if (status === "running") {
|
|
11653
|
-
const logs =
|
|
11622
|
+
const logs = execFileSync22(
|
|
11654
11623
|
runtime,
|
|
11655
11624
|
["logs", "--tail", "20", containerName],
|
|
11656
11625
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11670,7 +11639,7 @@ async function startJanusGraph2(context) {
|
|
|
11670
11639
|
}
|
|
11671
11640
|
if (!ready) {
|
|
11672
11641
|
try {
|
|
11673
|
-
const finalStatus =
|
|
11642
|
+
const finalStatus = execFileSync22(
|
|
11674
11643
|
runtime,
|
|
11675
11644
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11676
11645
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11685,14 +11654,14 @@ async function startJanusGraph2(context) {
|
|
|
11685
11654
|
}
|
|
11686
11655
|
}
|
|
11687
11656
|
if (!ready) {
|
|
11688
|
-
|
|
11657
|
+
execFileSync22("docker-compose", ["-f", composePath, "down"], { stdio: "ignore" });
|
|
11689
11658
|
return {
|
|
11690
11659
|
success: false,
|
|
11691
11660
|
error: "JanusGraph failed to start within timeout",
|
|
11692
11661
|
metadata: { serviceType: "graph", serviceName: "janusgraph" }
|
|
11693
11662
|
};
|
|
11694
11663
|
}
|
|
11695
|
-
const runningContainers =
|
|
11664
|
+
const runningContainers = execFileSync22(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
11696
11665
|
const hasCassandra = runningContainers.includes("semiont-cassandra");
|
|
11697
11666
|
const hasElasticsearch = runningContainers.includes("semiont-elasticsearch");
|
|
11698
11667
|
if (!service.quiet) {
|
|
@@ -11779,7 +11748,7 @@ var init_graph_start2 = __esm({
|
|
|
11779
11748
|
});
|
|
11780
11749
|
|
|
11781
11750
|
// src/platforms/container/handlers/database-provision.ts
|
|
11782
|
-
import { execFileSync as
|
|
11751
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
11783
11752
|
import * as fs33 from "fs";
|
|
11784
11753
|
import * as path27 from "path";
|
|
11785
11754
|
var provisionDatabaseContainer, preflightDatabaseProvision, databaseProvisionDescriptor;
|
|
@@ -11795,12 +11764,12 @@ var init_database_provision = __esm({
|
|
|
11795
11764
|
}
|
|
11796
11765
|
const networkName = `semiont-${service.environment}`;
|
|
11797
11766
|
try {
|
|
11798
|
-
|
|
11767
|
+
execFileSync23(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11799
11768
|
} catch {
|
|
11800
11769
|
}
|
|
11801
11770
|
const volumeName = `${containerName}-data`;
|
|
11802
11771
|
try {
|
|
11803
|
-
|
|
11772
|
+
execFileSync23(runtime, ["volume", "create", volumeName], { stdio: "ignore" });
|
|
11804
11773
|
if (!service.quiet) {
|
|
11805
11774
|
printInfo(`Created volume: ${volumeName}`);
|
|
11806
11775
|
}
|
|
@@ -11811,7 +11780,7 @@ var init_database_provision = __esm({
|
|
|
11811
11780
|
printInfo(`Pulling database image ${image}...`);
|
|
11812
11781
|
}
|
|
11813
11782
|
try {
|
|
11814
|
-
|
|
11783
|
+
execFileSync23(runtime, ["pull", image], {
|
|
11815
11784
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
11816
11785
|
});
|
|
11817
11786
|
} catch (error) {
|
|
@@ -11828,7 +11797,7 @@ var init_database_provision = __esm({
|
|
|
11828
11797
|
const dbUser = envVars.POSTGRES_USER || envVars.MYSQL_USER;
|
|
11829
11798
|
let containerRunning = false;
|
|
11830
11799
|
try {
|
|
11831
|
-
const status =
|
|
11800
|
+
const status = execFileSync23(
|
|
11832
11801
|
runtime,
|
|
11833
11802
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11834
11803
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11859,7 +11828,7 @@ var init_database_provision = __esm({
|
|
|
11859
11828
|
}
|
|
11860
11829
|
runArgs.push(image);
|
|
11861
11830
|
try {
|
|
11862
|
-
|
|
11831
|
+
execFileSync23(runtime, runArgs, { encoding: "utf-8" });
|
|
11863
11832
|
if (!service.quiet) {
|
|
11864
11833
|
printInfo("Waiting for database to be ready...");
|
|
11865
11834
|
}
|
|
@@ -11868,10 +11837,10 @@ var init_database_provision = __esm({
|
|
|
11868
11837
|
while (attempts < maxAttempts) {
|
|
11869
11838
|
try {
|
|
11870
11839
|
if (image.includes("postgres")) {
|
|
11871
|
-
|
|
11840
|
+
execFileSync23(runtime, ["exec", initContainerName, "pg_isready", "-U", dbUser || "postgres"], { stdio: "ignore" });
|
|
11872
11841
|
break;
|
|
11873
11842
|
} else if (image.includes("mysql")) {
|
|
11874
|
-
|
|
11843
|
+
execFileSync23(runtime, ["exec", initContainerName, "mysqladmin", "ping", "-h", "localhost"], { stdio: "ignore" });
|
|
11875
11844
|
break;
|
|
11876
11845
|
}
|
|
11877
11846
|
} catch {
|
|
@@ -11888,15 +11857,15 @@ var init_database_provision = __esm({
|
|
|
11888
11857
|
if (hasSeedData && !service.quiet) {
|
|
11889
11858
|
printInfo("Seed data found in db/seed - this should be loaded by your application");
|
|
11890
11859
|
}
|
|
11891
|
-
|
|
11892
|
-
|
|
11860
|
+
execFileSync23(runtime, ["stop", initContainerName], { stdio: "ignore" });
|
|
11861
|
+
execFileSync23(runtime, ["rm", initContainerName], { stdio: "ignore" });
|
|
11893
11862
|
if (!service.quiet) {
|
|
11894
11863
|
printSuccess("Database initialized successfully");
|
|
11895
11864
|
}
|
|
11896
11865
|
} catch (error) {
|
|
11897
11866
|
try {
|
|
11898
|
-
|
|
11899
|
-
|
|
11867
|
+
execFileSync23(runtime, ["stop", initContainerName], { stdio: "ignore" });
|
|
11868
|
+
execFileSync23(runtime, ["rm", initContainerName], { stdio: "ignore" });
|
|
11900
11869
|
} catch {
|
|
11901
11870
|
}
|
|
11902
11871
|
return {
|
|
@@ -14573,7 +14542,7 @@ var init_js_yaml = __esm({
|
|
|
14573
14542
|
// src/platforms/container/handlers/graph-provision.ts
|
|
14574
14543
|
import * as fs34 from "fs/promises";
|
|
14575
14544
|
import * as path28 from "path";
|
|
14576
|
-
import { execFileSync as
|
|
14545
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
14577
14546
|
var provisionGraphService2, preflightGraphProvision2, graphProvisionDescriptor2;
|
|
14578
14547
|
var init_graph_provision2 = __esm({
|
|
14579
14548
|
"src/platforms/container/handlers/graph-provision.ts"() {
|
|
@@ -14602,7 +14571,7 @@ var init_graph_provision2 = __esm({
|
|
|
14602
14571
|
const withCassandra = storage === "cassandra";
|
|
14603
14572
|
const networkName = "semiont-network";
|
|
14604
14573
|
try {
|
|
14605
|
-
|
|
14574
|
+
execFileSync24(runtime, ["--version"], { stdio: "ignore" });
|
|
14606
14575
|
} catch {
|
|
14607
14576
|
return {
|
|
14608
14577
|
success: false,
|
|
@@ -14611,14 +14580,14 @@ var init_graph_provision2 = __esm({
|
|
|
14611
14580
|
};
|
|
14612
14581
|
}
|
|
14613
14582
|
try {
|
|
14614
|
-
|
|
14583
|
+
execFileSync24(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
14615
14584
|
} catch {
|
|
14616
14585
|
}
|
|
14617
14586
|
if (!service.quiet) {
|
|
14618
14587
|
printInfo("Pulling required Docker images...");
|
|
14619
14588
|
}
|
|
14620
14589
|
try {
|
|
14621
|
-
|
|
14590
|
+
execFileSync24(runtime, ["pull", "janusgraph/janusgraph:1.0.0"], {
|
|
14622
14591
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14623
14592
|
});
|
|
14624
14593
|
} catch (error) {
|
|
@@ -14626,7 +14595,7 @@ var init_graph_provision2 = __esm({
|
|
|
14626
14595
|
}
|
|
14627
14596
|
if (withCassandra) {
|
|
14628
14597
|
try {
|
|
14629
|
-
|
|
14598
|
+
execFileSync24(runtime, ["pull", "cassandra:4"], {
|
|
14630
14599
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14631
14600
|
});
|
|
14632
14601
|
} catch (error) {
|
|
@@ -14635,7 +14604,7 @@ var init_graph_provision2 = __esm({
|
|
|
14635
14604
|
}
|
|
14636
14605
|
if (withElasticsearch) {
|
|
14637
14606
|
try {
|
|
14638
|
-
|
|
14607
|
+
execFileSync24(runtime, ["pull", "docker.elastic.co/elasticsearch/elasticsearch:7.17.10"], {
|
|
14639
14608
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14640
14609
|
});
|
|
14641
14610
|
} catch (error) {
|
|
@@ -14784,7 +14753,7 @@ var init_graph_provision2 = __esm({
|
|
|
14784
14753
|
|
|
14785
14754
|
// src/platforms/container/handlers/graph-stop.ts
|
|
14786
14755
|
import * as path29 from "path";
|
|
14787
|
-
import { execFileSync as
|
|
14756
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
14788
14757
|
import * as fs35 from "fs/promises";
|
|
14789
14758
|
async function stopJanusGraph2(context) {
|
|
14790
14759
|
const { service, runtime, options, containerName } = context;
|
|
@@ -14804,7 +14773,7 @@ async function stopJanusGraph2(context) {
|
|
|
14804
14773
|
}
|
|
14805
14774
|
let runningContainers = [];
|
|
14806
14775
|
try {
|
|
14807
|
-
const output =
|
|
14776
|
+
const output = execFileSync25(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
14808
14777
|
const containerNames = [containerName, "semiont-cassandra", "semiont-elasticsearch"];
|
|
14809
14778
|
runningContainers = containerNames.filter((name) => output.includes(name));
|
|
14810
14779
|
if (runningContainers.length === 0) {
|
|
@@ -14833,10 +14802,10 @@ async function stopJanusGraph2(context) {
|
|
|
14833
14802
|
if (!service.quiet) {
|
|
14834
14803
|
printInfo("Force stopping JanusGraph Docker stack...");
|
|
14835
14804
|
}
|
|
14836
|
-
|
|
14805
|
+
execFileSync25("docker-compose", ["-f", composePath, "kill"], {
|
|
14837
14806
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14838
14807
|
});
|
|
14839
|
-
|
|
14808
|
+
execFileSync25("docker-compose", ["-f", composePath, "down"], {
|
|
14840
14809
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14841
14810
|
});
|
|
14842
14811
|
if (!service.quiet) {
|
|
@@ -14856,10 +14825,10 @@ async function stopJanusGraph2(context) {
|
|
|
14856
14825
|
if (!service.quiet) {
|
|
14857
14826
|
printInfo(`Stopping JanusGraph Docker stack gracefully (timeout: ${options.timeout}s)...`);
|
|
14858
14827
|
}
|
|
14859
|
-
|
|
14828
|
+
execFileSync25("docker-compose", ["-f", composePath, "stop", "-t", options.timeout.toString()], {
|
|
14860
14829
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14861
14830
|
});
|
|
14862
|
-
|
|
14831
|
+
execFileSync25("docker-compose", ["-f", composePath, "down"], {
|
|
14863
14832
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14864
14833
|
});
|
|
14865
14834
|
if (!service.quiet) {
|
|
@@ -14930,7 +14899,7 @@ var init_graph_stop2 = __esm({
|
|
|
14930
14899
|
});
|
|
14931
14900
|
|
|
14932
14901
|
// src/platforms/container/handlers/database-stop.ts
|
|
14933
|
-
import { execFileSync as
|
|
14902
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
14934
14903
|
var stopDatabaseContainer, preflightDatabaseStop, databaseStopDescriptor;
|
|
14935
14904
|
var init_database_stop = __esm({
|
|
14936
14905
|
"src/platforms/container/handlers/database-stop.ts"() {
|
|
@@ -14939,12 +14908,12 @@ var init_database_stop = __esm({
|
|
|
14939
14908
|
init_preflight_utils();
|
|
14940
14909
|
stopDatabaseContainer = async (context) => {
|
|
14941
14910
|
const { service, runtime, containerName } = context;
|
|
14942
|
-
const { force, timeout
|
|
14911
|
+
const { force, timeout } = context.options;
|
|
14943
14912
|
if (!service.quiet) {
|
|
14944
14913
|
printInfo(`Stopping database container: ${containerName}`);
|
|
14945
14914
|
}
|
|
14946
14915
|
try {
|
|
14947
|
-
const status =
|
|
14916
|
+
const status = execFileSync26(
|
|
14948
14917
|
runtime,
|
|
14949
14918
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
14950
14919
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -14966,7 +14935,7 @@ var init_database_stop = __esm({
|
|
|
14966
14935
|
}
|
|
14967
14936
|
};
|
|
14968
14937
|
}
|
|
14969
|
-
const containerId =
|
|
14938
|
+
const containerId = execFileSync26(
|
|
14970
14939
|
runtime,
|
|
14971
14940
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
14972
14941
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -14975,7 +14944,7 @@ var init_database_stop = __esm({
|
|
|
14975
14944
|
if (!service.quiet) {
|
|
14976
14945
|
printWarning("Force stopping database (may cause data corruption)...");
|
|
14977
14946
|
}
|
|
14978
|
-
|
|
14947
|
+
execFileSync26(runtime, ["kill", containerName], { stdio: "pipe" });
|
|
14979
14948
|
} else {
|
|
14980
14949
|
if (!service.quiet) {
|
|
14981
14950
|
printInfo(`Gracefully stopping database (timeout: ${timeout}s)...`);
|
|
@@ -14983,7 +14952,7 @@ var init_database_stop = __esm({
|
|
|
14983
14952
|
const image = service.getImage();
|
|
14984
14953
|
if (image.includes("postgres")) {
|
|
14985
14954
|
try {
|
|
14986
|
-
|
|
14955
|
+
execFileSync26(
|
|
14987
14956
|
runtime,
|
|
14988
14957
|
[
|
|
14989
14958
|
"exec",
|
|
@@ -14996,20 +14965,20 @@ var init_database_stop = __esm({
|
|
|
14996
14965
|
{ stdio: "pipe", timeout: (timeout + 5) * 1e3 }
|
|
14997
14966
|
);
|
|
14998
14967
|
} catch {
|
|
14999
|
-
|
|
14968
|
+
execFileSync26(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
15000
14969
|
}
|
|
15001
14970
|
} else if (image.includes("mysql")) {
|
|
15002
14971
|
try {
|
|
15003
|
-
|
|
14972
|
+
execFileSync26(
|
|
15004
14973
|
runtime,
|
|
15005
14974
|
["exec", containerName, "mysqladmin", "shutdown"],
|
|
15006
14975
|
{ stdio: "pipe", timeout: timeout * 1e3 }
|
|
15007
14976
|
);
|
|
15008
14977
|
} catch {
|
|
15009
|
-
|
|
14978
|
+
execFileSync26(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
15010
14979
|
}
|
|
15011
14980
|
} else {
|
|
15012
|
-
|
|
14981
|
+
execFileSync26(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
15013
14982
|
}
|
|
15014
14983
|
}
|
|
15015
14984
|
let stopped = false;
|
|
@@ -15017,7 +14986,7 @@ var init_database_stop = __esm({
|
|
|
15017
14986
|
const maxAttempts = 10;
|
|
15018
14987
|
while (!stopped && attempts < maxAttempts) {
|
|
15019
14988
|
try {
|
|
15020
|
-
const currentStatus =
|
|
14989
|
+
const currentStatus = execFileSync26(
|
|
15021
14990
|
runtime,
|
|
15022
14991
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15023
14992
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15113,14 +15082,14 @@ var init_proxy_paths2 = __esm({
|
|
|
15113
15082
|
// src/platforms/container/handlers/proxy-provision.ts
|
|
15114
15083
|
import * as fs36 from "fs";
|
|
15115
15084
|
import * as path31 from "path";
|
|
15116
|
-
import { execFileSync as
|
|
15085
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
15117
15086
|
function getHostAddress(runtime) {
|
|
15118
15087
|
const platform = process.platform;
|
|
15119
15088
|
if (platform === "darwin" || platform === "win32") {
|
|
15120
15089
|
return "host.docker.internal";
|
|
15121
15090
|
} else {
|
|
15122
15091
|
try {
|
|
15123
|
-
|
|
15092
|
+
execFileSync27(runtime, ["run", "--rm", "alpine", "getent", "hosts", "host-gateway"], { stdio: "pipe" });
|
|
15124
15093
|
return "host-gateway";
|
|
15125
15094
|
} catch {
|
|
15126
15095
|
return "172.17.0.1";
|
|
@@ -15207,7 +15176,7 @@ var init_proxy_provision2 = __esm({
|
|
|
15207
15176
|
printInfo(`Pulling image: ${imageName}...`);
|
|
15208
15177
|
}
|
|
15209
15178
|
try {
|
|
15210
|
-
|
|
15179
|
+
execFileSync27(runtime, ["pull", imageName], {
|
|
15211
15180
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15212
15181
|
});
|
|
15213
15182
|
if (!service.quiet) {
|
|
@@ -15282,7 +15251,7 @@ var init_proxy_provision2 = __esm({
|
|
|
15282
15251
|
});
|
|
15283
15252
|
|
|
15284
15253
|
// src/platforms/container/handlers/proxy-start.ts
|
|
15285
|
-
import { execFileSync as
|
|
15254
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
15286
15255
|
import * as fs37 from "fs";
|
|
15287
15256
|
function getProxyImage2(type2, customImage) {
|
|
15288
15257
|
if (customImage) {
|
|
@@ -15333,9 +15302,9 @@ var init_proxy_start2 = __esm({
|
|
|
15333
15302
|
};
|
|
15334
15303
|
}
|
|
15335
15304
|
try {
|
|
15336
|
-
const existingContainer =
|
|
15305
|
+
const existingContainer = execFileSync28(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15337
15306
|
if (existingContainer) {
|
|
15338
|
-
const isRunning =
|
|
15307
|
+
const isRunning = execFileSync28(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15339
15308
|
if (isRunning) {
|
|
15340
15309
|
if (!service.quiet) {
|
|
15341
15310
|
printInfo(`Proxy container ${containerName} is already running`);
|
|
@@ -15353,7 +15322,7 @@ var init_proxy_start2 = __esm({
|
|
|
15353
15322
|
if (!service.quiet) {
|
|
15354
15323
|
printInfo(`Removing stopped container ${containerName}`);
|
|
15355
15324
|
}
|
|
15356
|
-
|
|
15325
|
+
execFileSync28(runtime, ["rm", containerName], { stdio: "pipe" });
|
|
15357
15326
|
}
|
|
15358
15327
|
}
|
|
15359
15328
|
} catch (error) {
|
|
@@ -15392,7 +15361,7 @@ var init_proxy_start2 = __esm({
|
|
|
15392
15361
|
}
|
|
15393
15362
|
}
|
|
15394
15363
|
try {
|
|
15395
|
-
const containerId =
|
|
15364
|
+
const containerId = execFileSync28(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
15396
15365
|
if (!service.quiet) {
|
|
15397
15366
|
printSuccess(`Container started with ID: ${containerId.substring(0, 12)}`);
|
|
15398
15367
|
}
|
|
@@ -15400,9 +15369,9 @@ var init_proxy_start2 = __esm({
|
|
|
15400
15369
|
printInfo("Waiting for proxy to become healthy...");
|
|
15401
15370
|
}
|
|
15402
15371
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
15403
|
-
const isRunning =
|
|
15372
|
+
const isRunning = execFileSync28(runtime, ["ps", "-q", "-f", `id=${containerId}`], { encoding: "utf-8" }).trim();
|
|
15404
15373
|
if (!isRunning) {
|
|
15405
|
-
const logs =
|
|
15374
|
+
const logs = execFileSync28(runtime, ["logs", containerId], { encoding: "utf-8" });
|
|
15406
15375
|
return {
|
|
15407
15376
|
success: false,
|
|
15408
15377
|
error: `Container exited unexpectedly. Logs:
|
|
@@ -15412,7 +15381,7 @@ ${logs}`,
|
|
|
15412
15381
|
}
|
|
15413
15382
|
if (config.type === "envoy") {
|
|
15414
15383
|
try {
|
|
15415
|
-
|
|
15384
|
+
execFileSync28("curl", ["-s", "-o", "/dev/null", `http://localhost:${adminPort}/clusters`], { stdio: "pipe" });
|
|
15416
15385
|
if (!service.quiet) {
|
|
15417
15386
|
printSuccess("Proxy admin interface is accessible");
|
|
15418
15387
|
}
|
|
@@ -15490,7 +15459,7 @@ ${logs}`,
|
|
|
15490
15459
|
});
|
|
15491
15460
|
|
|
15492
15461
|
// src/platforms/container/handlers/proxy-stop.ts
|
|
15493
|
-
import { execFileSync as
|
|
15462
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
15494
15463
|
var stopProxyService2, preflightProxyStop, proxyStopDescriptor2;
|
|
15495
15464
|
var init_proxy_stop2 = __esm({
|
|
15496
15465
|
"src/platforms/container/handlers/proxy-stop.ts"() {
|
|
@@ -15504,7 +15473,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15504
15473
|
printInfo(`Stopping proxy service ${service.name} (type: ${config.type})...`);
|
|
15505
15474
|
}
|
|
15506
15475
|
try {
|
|
15507
|
-
const existingContainer =
|
|
15476
|
+
const existingContainer = execFileSync29(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15508
15477
|
if (!existingContainer) {
|
|
15509
15478
|
if (!service.quiet) {
|
|
15510
15479
|
printWarning(`Proxy container ${containerName} not found`);
|
|
@@ -15518,12 +15487,12 @@ var init_proxy_stop2 = __esm({
|
|
|
15518
15487
|
}
|
|
15519
15488
|
};
|
|
15520
15489
|
}
|
|
15521
|
-
const isRunning =
|
|
15490
|
+
const isRunning = execFileSync29(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15522
15491
|
if (isRunning) {
|
|
15523
15492
|
if (!service.quiet) {
|
|
15524
15493
|
printInfo(`Stopping container ${containerName}...`);
|
|
15525
15494
|
}
|
|
15526
|
-
|
|
15495
|
+
execFileSync29(runtime, ["stop", containerName], {
|
|
15527
15496
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15528
15497
|
});
|
|
15529
15498
|
if (!service.quiet) {
|
|
@@ -15537,7 +15506,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15537
15506
|
if (!service.quiet) {
|
|
15538
15507
|
printInfo(`Removing container ${containerName}...`);
|
|
15539
15508
|
}
|
|
15540
|
-
|
|
15509
|
+
execFileSync29(runtime, ["rm", containerName], {
|
|
15541
15510
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15542
15511
|
});
|
|
15543
15512
|
if (!service.quiet) {
|
|
@@ -15582,7 +15551,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15582
15551
|
});
|
|
15583
15552
|
|
|
15584
15553
|
// src/platforms/container/handlers/proxy-check.ts
|
|
15585
|
-
import { execFileSync as
|
|
15554
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
15586
15555
|
import * as fs38 from "fs";
|
|
15587
15556
|
async function checkUrl(url, timeout = 5e3) {
|
|
15588
15557
|
try {
|
|
@@ -15597,7 +15566,7 @@ async function checkUrl(url, timeout = 5e3) {
|
|
|
15597
15566
|
}
|
|
15598
15567
|
function getContainerUptime(runtime, containerName) {
|
|
15599
15568
|
try {
|
|
15600
|
-
const uptime =
|
|
15569
|
+
const uptime = execFileSync30(
|
|
15601
15570
|
runtime,
|
|
15602
15571
|
["ps", "--format", "{{.Status}}", "--filter", `name=${containerName}`],
|
|
15603
15572
|
{ encoding: "utf-8" }
|
|
@@ -15609,7 +15578,7 @@ function getContainerUptime(runtime, containerName) {
|
|
|
15609
15578
|
}
|
|
15610
15579
|
function getRecentLogs(runtime, containerName, lines = 20) {
|
|
15611
15580
|
try {
|
|
15612
|
-
const logs =
|
|
15581
|
+
const logs = execFileSync30(runtime, ["logs", "--tail", lines.toString(), containerName], { encoding: "utf-8" });
|
|
15613
15582
|
return logs;
|
|
15614
15583
|
} catch {
|
|
15615
15584
|
return void 0;
|
|
@@ -15636,7 +15605,7 @@ var init_proxy_check2 = __esm({
|
|
|
15636
15605
|
backendRouting: false
|
|
15637
15606
|
};
|
|
15638
15607
|
try {
|
|
15639
|
-
const containerId =
|
|
15608
|
+
const containerId = execFileSync30(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15640
15609
|
if (containerId) {
|
|
15641
15610
|
healthCheck.containerRunning = true;
|
|
15642
15611
|
healthCheck.containerId = containerId.substring(0, 12);
|
|
@@ -15648,7 +15617,7 @@ var init_proxy_check2 = __esm({
|
|
|
15648
15617
|
}
|
|
15649
15618
|
}
|
|
15650
15619
|
} else {
|
|
15651
|
-
const stoppedContainer =
|
|
15620
|
+
const stoppedContainer = execFileSync30(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15652
15621
|
if (stoppedContainer) {
|
|
15653
15622
|
if (!service.quiet) {
|
|
15654
15623
|
printWarning(`Container ${containerName} exists but is not running`);
|
|
@@ -15818,7 +15787,7 @@ Proxy service ${service.name} is healthy`);
|
|
|
15818
15787
|
});
|
|
15819
15788
|
|
|
15820
15789
|
// src/platforms/container/handlers/inference-check.ts
|
|
15821
|
-
import { execFileSync as
|
|
15790
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
15822
15791
|
var OLLAMA_DEFAULT_PORT3, checkInference2, preflightInferenceCheck2, inferenceCheckDescriptor2;
|
|
15823
15792
|
var init_inference_check2 = __esm({
|
|
15824
15793
|
"src/platforms/container/handlers/inference-check.ts"() {
|
|
@@ -15835,13 +15804,13 @@ var init_inference_check2 = __esm({
|
|
|
15835
15804
|
let containerId;
|
|
15836
15805
|
const modelAvailability = {};
|
|
15837
15806
|
try {
|
|
15838
|
-
const containerStatus =
|
|
15807
|
+
const containerStatus = execFileSync31(
|
|
15839
15808
|
runtime,
|
|
15840
15809
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15841
15810
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
15842
15811
|
).trim();
|
|
15843
15812
|
if (containerStatus === "running") {
|
|
15844
|
-
containerId =
|
|
15813
|
+
containerId = execFileSync31(
|
|
15845
15814
|
runtime,
|
|
15846
15815
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
15847
15816
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15871,7 +15840,7 @@ var init_inference_check2 = __esm({
|
|
|
15871
15840
|
let logs;
|
|
15872
15841
|
if (containerId) {
|
|
15873
15842
|
try {
|
|
15874
|
-
const output =
|
|
15843
|
+
const output = execFileSync31(
|
|
15875
15844
|
runtime,
|
|
15876
15845
|
["logs", "--tail", "10", containerName],
|
|
15877
15846
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -15931,10 +15900,10 @@ var init_inference_check2 = __esm({
|
|
|
15931
15900
|
});
|
|
15932
15901
|
|
|
15933
15902
|
// src/platforms/container/handlers/inference-start.ts
|
|
15934
|
-
import { execFileSync as
|
|
15903
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
15935
15904
|
function detectNvidiaGpu() {
|
|
15936
15905
|
try {
|
|
15937
|
-
|
|
15906
|
+
execFileSync32("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
15938
15907
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15939
15908
|
});
|
|
15940
15909
|
return true;
|
|
@@ -15957,7 +15926,7 @@ var init_inference_start2 = __esm({
|
|
|
15957
15926
|
const port = serviceConfig.port || OLLAMA_DEFAULT_PORT4;
|
|
15958
15927
|
const image = serviceConfig.image || OLLAMA_IMAGE;
|
|
15959
15928
|
try {
|
|
15960
|
-
const output =
|
|
15929
|
+
const output = execFileSync32(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
15961
15930
|
if (output.includes(containerName)) {
|
|
15962
15931
|
if (!service.quiet) {
|
|
15963
15932
|
printWarning("Ollama container is already running");
|
|
@@ -15975,7 +15944,7 @@ var init_inference_start2 = __esm({
|
|
|
15975
15944
|
} catch {
|
|
15976
15945
|
}
|
|
15977
15946
|
try {
|
|
15978
|
-
|
|
15947
|
+
execFileSync32(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
15979
15948
|
} catch {
|
|
15980
15949
|
}
|
|
15981
15950
|
if (!service.quiet) {
|
|
@@ -15983,7 +15952,7 @@ var init_inference_start2 = __esm({
|
|
|
15983
15952
|
}
|
|
15984
15953
|
const gpuArgs = detectNvidiaGpu() ? ["--gpus", "all"] : [];
|
|
15985
15954
|
try {
|
|
15986
|
-
const containerId =
|
|
15955
|
+
const containerId = execFileSync32(runtime, [
|
|
15987
15956
|
"run",
|
|
15988
15957
|
"-d",
|
|
15989
15958
|
"--name",
|
|
@@ -16002,7 +15971,7 @@ var init_inference_start2 = __esm({
|
|
|
16002
15971
|
for (let i = 0; i < maxAttempts; i++) {
|
|
16003
15972
|
await new Promise((resolve10) => setTimeout(resolve10, 1e3));
|
|
16004
15973
|
try {
|
|
16005
|
-
const status =
|
|
15974
|
+
const status = execFileSync32(
|
|
16006
15975
|
runtime,
|
|
16007
15976
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
16008
15977
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -16022,7 +15991,7 @@ var init_inference_start2 = __esm({
|
|
|
16022
15991
|
}
|
|
16023
15992
|
if (!ready) {
|
|
16024
15993
|
try {
|
|
16025
|
-
|
|
15994
|
+
execFileSync32(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
16026
15995
|
} catch {
|
|
16027
15996
|
}
|
|
16028
15997
|
return {
|
|
@@ -16084,7 +16053,7 @@ var init_inference_start2 = __esm({
|
|
|
16084
16053
|
});
|
|
16085
16054
|
|
|
16086
16055
|
// src/platforms/container/handlers/inference-stop.ts
|
|
16087
|
-
import { execFileSync as
|
|
16056
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
16088
16057
|
var stopInference2, preflightInferenceStop, inferenceStopDescriptor2;
|
|
16089
16058
|
var init_inference_stop2 = __esm({
|
|
16090
16059
|
"src/platforms/container/handlers/inference-stop.ts"() {
|
|
@@ -16094,7 +16063,7 @@ var init_inference_stop2 = __esm({
|
|
|
16094
16063
|
stopInference2 = async (context) => {
|
|
16095
16064
|
const { service, runtime, options, containerName } = context;
|
|
16096
16065
|
try {
|
|
16097
|
-
const output =
|
|
16066
|
+
const output = execFileSync33(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
16098
16067
|
if (!output.includes(containerName)) {
|
|
16099
16068
|
if (!service.quiet) {
|
|
16100
16069
|
printWarning("Ollama container is not running");
|
|
@@ -16117,17 +16086,17 @@ var init_inference_stop2 = __esm({
|
|
|
16117
16086
|
if (!service.quiet) {
|
|
16118
16087
|
printInfo("Force stopping Ollama container...");
|
|
16119
16088
|
}
|
|
16120
|
-
|
|
16089
|
+
execFileSync33(runtime, ["rm", "-f", containerName], {
|
|
16121
16090
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16122
16091
|
});
|
|
16123
16092
|
} else {
|
|
16124
16093
|
if (!service.quiet) {
|
|
16125
16094
|
printInfo(`Stopping Ollama container gracefully (timeout: ${options.timeout}s)...`);
|
|
16126
16095
|
}
|
|
16127
|
-
|
|
16096
|
+
execFileSync33(runtime, ["stop", "-t", options.timeout.toString(), containerName], {
|
|
16128
16097
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16129
16098
|
});
|
|
16130
|
-
|
|
16099
|
+
execFileSync33(runtime, ["rm", containerName], {
|
|
16131
16100
|
stdio: "ignore"
|
|
16132
16101
|
});
|
|
16133
16102
|
}
|
|
@@ -16167,10 +16136,10 @@ var init_inference_stop2 = __esm({
|
|
|
16167
16136
|
});
|
|
16168
16137
|
|
|
16169
16138
|
// src/platforms/container/handlers/inference-provision.ts
|
|
16170
|
-
import { execFileSync as
|
|
16139
|
+
import { execFileSync as execFileSync34 } from "child_process";
|
|
16171
16140
|
function detectGpu2(runtime) {
|
|
16172
16141
|
try {
|
|
16173
|
-
const output =
|
|
16142
|
+
const output = execFileSync34(runtime, ["info", "--format", "{{.Runtimes}}"], {
|
|
16174
16143
|
encoding: "utf-8",
|
|
16175
16144
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16176
16145
|
}).trim();
|
|
@@ -16180,7 +16149,7 @@ function detectGpu2(runtime) {
|
|
|
16180
16149
|
} catch {
|
|
16181
16150
|
}
|
|
16182
16151
|
try {
|
|
16183
|
-
const gpuName =
|
|
16152
|
+
const gpuName = execFileSync34("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
16184
16153
|
encoding: "utf-8",
|
|
16185
16154
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16186
16155
|
}).trim();
|
|
@@ -16215,7 +16184,7 @@ var init_inference_provision2 = __esm({
|
|
|
16215
16184
|
printInfo(`Pulling ${image}...`);
|
|
16216
16185
|
}
|
|
16217
16186
|
try {
|
|
16218
|
-
|
|
16187
|
+
execFileSync34(runtime, ["pull", image], {
|
|
16219
16188
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16220
16189
|
});
|
|
16221
16190
|
} catch (error) {
|
|
@@ -16226,7 +16195,7 @@ var init_inference_provision2 = __esm({
|
|
|
16226
16195
|
};
|
|
16227
16196
|
}
|
|
16228
16197
|
try {
|
|
16229
|
-
|
|
16198
|
+
execFileSync34(runtime, ["volume", "create", VOLUME_NAME2], {
|
|
16230
16199
|
stdio: "ignore"
|
|
16231
16200
|
});
|
|
16232
16201
|
} catch {
|
|
@@ -16237,7 +16206,7 @@ var init_inference_provision2 = __esm({
|
|
|
16237
16206
|
printInfo(`Pulling model ${model} (this may take several minutes)...`);
|
|
16238
16207
|
}
|
|
16239
16208
|
try {
|
|
16240
|
-
|
|
16209
|
+
execFileSync34(runtime, [
|
|
16241
16210
|
"run",
|
|
16242
16211
|
"--rm",
|
|
16243
16212
|
"-v",
|
|
@@ -16357,7 +16326,7 @@ var init_handlers2 = __esm({
|
|
|
16357
16326
|
});
|
|
16358
16327
|
|
|
16359
16328
|
// src/platforms/container/platform.ts
|
|
16360
|
-
import { execFileSync as
|
|
16329
|
+
import { execFileSync as execFileSync35 } from "child_process";
|
|
16361
16330
|
var ContainerPlatform;
|
|
16362
16331
|
var init_platform3 = __esm({
|
|
16363
16332
|
"src/platforms/container/platform.ts"() {
|
|
@@ -16385,11 +16354,11 @@ var init_platform3 = __esm({
|
|
|
16385
16354
|
*/
|
|
16386
16355
|
detectContainerRuntime() {
|
|
16387
16356
|
try {
|
|
16388
|
-
|
|
16357
|
+
execFileSync35("docker", ["--version"], { stdio: "ignore" });
|
|
16389
16358
|
return "docker";
|
|
16390
16359
|
} catch {
|
|
16391
16360
|
try {
|
|
16392
|
-
|
|
16361
|
+
execFileSync35("podman", ["--version"], { stdio: "ignore" });
|
|
16393
16362
|
return "podman";
|
|
16394
16363
|
} catch {
|
|
16395
16364
|
throw new Error("No container runtime (Docker or Podman) found");
|
|
@@ -16415,7 +16384,7 @@ var init_platform3 = __esm({
|
|
|
16415
16384
|
return false;
|
|
16416
16385
|
}
|
|
16417
16386
|
try {
|
|
16418
|
-
const status =
|
|
16387
|
+
const status = execFileSync35(
|
|
16419
16388
|
this.runtime,
|
|
16420
16389
|
["inspect", containerId, "--format", "{{.State.Status}}"],
|
|
16421
16390
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -16477,7 +16446,7 @@ var init_platform3 = __esm({
|
|
|
16477
16446
|
if (since) {
|
|
16478
16447
|
args.push("--since", since.toISOString());
|
|
16479
16448
|
}
|
|
16480
|
-
const output =
|
|
16449
|
+
const output = execFileSync35(this.runtime, args, {
|
|
16481
16450
|
encoding: "utf-8",
|
|
16482
16451
|
stdio: ["ignore", "pipe", "pipe"]
|
|
16483
16452
|
// Capture both stdout and stderr
|
|
@@ -16695,7 +16664,7 @@ var init_lambda_check = __esm({
|
|
|
16695
16664
|
});
|
|
16696
16665
|
|
|
16697
16666
|
// src/platforms/aws/handlers/ecs-check.ts
|
|
16698
|
-
import { execFileSync as
|
|
16667
|
+
import { execFileSync as execFileSync36 } from "child_process";
|
|
16699
16668
|
import { DescribeServicesCommand } from "@aws-sdk/client-ecs";
|
|
16700
16669
|
import { DescribeTargetHealthCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
16701
16670
|
import { FilterLogEventsCommand as FilterLogEventsCommand2 } from "@aws-sdk/client-cloudwatch-logs";
|
|
@@ -16747,7 +16716,7 @@ var init_ecs_check = __esm({
|
|
|
16747
16716
|
let imageTag = "unknown";
|
|
16748
16717
|
if (activeDeployment?.taskDefinition) {
|
|
16749
16718
|
try {
|
|
16750
|
-
const taskDefJson =
|
|
16719
|
+
const taskDefJson = execFileSync36("aws", [
|
|
16751
16720
|
"ecs",
|
|
16752
16721
|
"describe-task-definition",
|
|
16753
16722
|
"--task-definition",
|
|
@@ -17006,10 +16975,10 @@ var init_rds_check = __esm({
|
|
|
17006
16975
|
});
|
|
17007
16976
|
|
|
17008
16977
|
// src/platforms/aws/handlers/s3-cloudfront-check.ts
|
|
17009
|
-
import { execFileSync as
|
|
16978
|
+
import { execFileSync as execFileSync37 } from "child_process";
|
|
17010
16979
|
async function getCloudFrontDistribution(bucketName, region) {
|
|
17011
16980
|
try {
|
|
17012
|
-
const distributionId =
|
|
16981
|
+
const distributionId = execFileSync37("aws", [
|
|
17013
16982
|
"cloudfront",
|
|
17014
16983
|
"list-distributions",
|
|
17015
16984
|
"--query",
|
|
@@ -17026,7 +16995,7 @@ async function getCloudFrontDistribution(bucketName, region) {
|
|
|
17026
16995
|
}
|
|
17027
16996
|
async function getCloudFrontStatus(distributionId, region) {
|
|
17028
16997
|
try {
|
|
17029
|
-
const status =
|
|
16998
|
+
const status = execFileSync37("aws", [
|
|
17030
16999
|
"cloudfront",
|
|
17031
17000
|
"get-distribution",
|
|
17032
17001
|
"--id",
|
|
@@ -17053,7 +17022,7 @@ var init_s3_cloudfront_check = __esm({
|
|
|
17053
17022
|
const { service, region, resourceName } = context;
|
|
17054
17023
|
const bucketName = `${resourceName}-static`;
|
|
17055
17024
|
try {
|
|
17056
|
-
|
|
17025
|
+
execFileSync37("aws", ["s3api", "head-bucket", "--bucket", bucketName, "--region", region], {
|
|
17057
17026
|
stdio: ["pipe", "pipe", "ignore"]
|
|
17058
17027
|
});
|
|
17059
17028
|
const status = "running";
|
|
@@ -17288,7 +17257,7 @@ var init_neptune_check = __esm({
|
|
|
17288
17257
|
});
|
|
17289
17258
|
|
|
17290
17259
|
// src/platforms/aws/handlers/ecs-start.ts
|
|
17291
|
-
import { execFileSync as
|
|
17260
|
+
import { execFileSync as execFileSync38 } from "child_process";
|
|
17292
17261
|
var startECSService, preflightEcsStart, ecsFargateStartDescriptor, ecsStartDescriptor;
|
|
17293
17262
|
var init_ecs_start = __esm({
|
|
17294
17263
|
"src/platforms/aws/handlers/ecs-start.ts"() {
|
|
@@ -17303,7 +17272,7 @@ var init_ecs_start = __esm({
|
|
|
17303
17272
|
const serviceName = cfnDiscoveredResources?.serviceName || resourceName;
|
|
17304
17273
|
const desiredCount = requirements.resources?.replicas || 1;
|
|
17305
17274
|
try {
|
|
17306
|
-
|
|
17275
|
+
execFileSync38("aws", [
|
|
17307
17276
|
"ecs",
|
|
17308
17277
|
"update-service",
|
|
17309
17278
|
"--cluster",
|
|
@@ -17318,7 +17287,7 @@ var init_ecs_start = __esm({
|
|
|
17318
17287
|
let endpoint;
|
|
17319
17288
|
if (requirements.network?.needsLoadBalancer) {
|
|
17320
17289
|
try {
|
|
17321
|
-
const albDns =
|
|
17290
|
+
const albDns = execFileSync38("aws", [
|
|
17322
17291
|
"elbv2",
|
|
17323
17292
|
"describe-load-balancers",
|
|
17324
17293
|
"--names",
|
|
@@ -17390,7 +17359,7 @@ var init_ecs_start = __esm({
|
|
|
17390
17359
|
});
|
|
17391
17360
|
|
|
17392
17361
|
// src/platforms/aws/handlers/rds-start.ts
|
|
17393
|
-
import { execFileSync as
|
|
17362
|
+
import { execFileSync as execFileSync39 } from "child_process";
|
|
17394
17363
|
var startRDSInstance, preflightRdsStart, rdsStartDescriptor;
|
|
17395
17364
|
var init_rds_start = __esm({
|
|
17396
17365
|
"src/platforms/aws/handlers/rds-start.ts"() {
|
|
@@ -17403,7 +17372,7 @@ var init_rds_start = __esm({
|
|
|
17403
17372
|
const resourceName = `semiont-${service.name}-${service.environment}`;
|
|
17404
17373
|
const instanceId = `${resourceName}-db`;
|
|
17405
17374
|
try {
|
|
17406
|
-
|
|
17375
|
+
execFileSync39("aws", ["rds", "start-db-instance", "--db-instance-identifier", instanceId, "--region", region], {
|
|
17407
17376
|
encoding: "utf-8"
|
|
17408
17377
|
});
|
|
17409
17378
|
if (!service.quiet) {
|
|
@@ -17411,7 +17380,7 @@ var init_rds_start = __esm({
|
|
|
17411
17380
|
}
|
|
17412
17381
|
let endpoint;
|
|
17413
17382
|
try {
|
|
17414
|
-
endpoint =
|
|
17383
|
+
endpoint = execFileSync39("aws", [
|
|
17415
17384
|
"rds",
|
|
17416
17385
|
"describe-db-instances",
|
|
17417
17386
|
"--db-instance-identifier",
|
|
@@ -17645,7 +17614,7 @@ var init_stack_provision = __esm({
|
|
|
17645
17614
|
});
|
|
17646
17615
|
|
|
17647
17616
|
// src/platforms/aws/handlers/ecs-publish.ts
|
|
17648
|
-
import { execFileSync as
|
|
17617
|
+
import { execFileSync as execFileSync40, spawnSync as spawnSync3 } from "child_process";
|
|
17649
17618
|
import * as path33 from "path";
|
|
17650
17619
|
import * as fs40 from "fs";
|
|
17651
17620
|
async function createNewTaskDefinition(service, imageUri, region, _accountId, cfnDiscoveredResources, resourceName) {
|
|
@@ -17657,7 +17626,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17657
17626
|
console.warn(` \u26A0\uFE0F Could not find ECS service name for ${service.name}`);
|
|
17658
17627
|
return "";
|
|
17659
17628
|
}
|
|
17660
|
-
const serviceJson =
|
|
17629
|
+
const serviceJson = execFileSync40("aws", [
|
|
17661
17630
|
"ecs",
|
|
17662
17631
|
"describe-services",
|
|
17663
17632
|
"--cluster",
|
|
@@ -17675,7 +17644,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17675
17644
|
console.warn(` \u26A0\uFE0F Could not find task definition for ${serviceName}`);
|
|
17676
17645
|
return "";
|
|
17677
17646
|
}
|
|
17678
|
-
const taskDefJson =
|
|
17647
|
+
const taskDefJson = execFileSync40("aws", [
|
|
17679
17648
|
"ecs",
|
|
17680
17649
|
"describe-task-definition",
|
|
17681
17650
|
"--task-definition",
|
|
@@ -17706,7 +17675,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17706
17675
|
memory: taskDef.memory,
|
|
17707
17676
|
runtimePlatform: taskDef.runtimePlatform
|
|
17708
17677
|
};
|
|
17709
|
-
const registerOutput =
|
|
17678
|
+
const registerOutput = execFileSync40("aws", [
|
|
17710
17679
|
"ecs",
|
|
17711
17680
|
"register-task-definition",
|
|
17712
17681
|
"--cli-input-json",
|
|
@@ -17746,7 +17715,7 @@ var init_ecs_publish = __esm({
|
|
|
17746
17715
|
const deploymentStrategy = envConfig.deployment?.imageTagStrategy || "mutable";
|
|
17747
17716
|
if (deploymentStrategy === "immutable" || deploymentStrategy === "git-hash") {
|
|
17748
17717
|
try {
|
|
17749
|
-
const gitHash =
|
|
17718
|
+
const gitHash = execFileSync40("git", ["rev-parse", "--short", "HEAD"], {
|
|
17750
17719
|
encoding: "utf-8",
|
|
17751
17720
|
cwd: service.projectRoot
|
|
17752
17721
|
}).trim();
|
|
@@ -17766,7 +17735,7 @@ var init_ecs_publish = __esm({
|
|
|
17766
17735
|
const ecrRepo = `semiont-${service.name}`;
|
|
17767
17736
|
const imageUri = `${accountId}.dkr.ecr.${region}.amazonaws.com/${ecrRepo}:${version}`;
|
|
17768
17737
|
try {
|
|
17769
|
-
|
|
17738
|
+
execFileSync40("aws", ["ecr", "create-repository", "--repository-name", ecrRepo, "--region", region]);
|
|
17770
17739
|
} catch {
|
|
17771
17740
|
}
|
|
17772
17741
|
if (service.verbose) {
|
|
@@ -17805,7 +17774,7 @@ var init_ecs_publish = __esm({
|
|
|
17805
17774
|
try {
|
|
17806
17775
|
const apiTypesPath = path33.join(buildContext, "packages", "api-types");
|
|
17807
17776
|
if (fs40.existsSync(apiTypesPath)) {
|
|
17808
|
-
|
|
17777
|
+
execFileSync40("npm", ["run", "build"], {
|
|
17809
17778
|
cwd: apiTypesPath,
|
|
17810
17779
|
env: buildEnv,
|
|
17811
17780
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -17813,7 +17782,7 @@ var init_ecs_publish = __esm({
|
|
|
17813
17782
|
}
|
|
17814
17783
|
const appPath = path33.join(buildContext, "apps", service.name);
|
|
17815
17784
|
if (fs40.existsSync(appPath)) {
|
|
17816
|
-
|
|
17785
|
+
execFileSync40("npm", ["run", "build"], {
|
|
17817
17786
|
cwd: appPath,
|
|
17818
17787
|
env: buildEnv,
|
|
17819
17788
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -17829,7 +17798,7 @@ var init_ecs_publish = __esm({
|
|
|
17829
17798
|
};
|
|
17830
17799
|
}
|
|
17831
17800
|
try {
|
|
17832
|
-
const ecrPassword =
|
|
17801
|
+
const ecrPassword = execFileSync40("aws", [
|
|
17833
17802
|
"ecr",
|
|
17834
17803
|
"get-login-password",
|
|
17835
17804
|
"--region",
|
|
@@ -17857,8 +17826,8 @@ var init_ecs_publish = __esm({
|
|
|
17857
17826
|
if (service.verbose) {
|
|
17858
17827
|
console.log(`[DEBUG] Docker build args: ${dockerBuildArgs.join(" ")}`);
|
|
17859
17828
|
}
|
|
17860
|
-
|
|
17861
|
-
|
|
17829
|
+
execFileSync40("docker", dockerBuildArgs, { stdio: service.verbose ? "inherit" : "pipe" });
|
|
17830
|
+
execFileSync40("docker", ["push", imageUri], { stdio: service.verbose ? "inherit" : "pipe" });
|
|
17862
17831
|
artifacts.imageTag = version;
|
|
17863
17832
|
artifacts.imageUrl = imageUri;
|
|
17864
17833
|
const newTaskDefRevision = await createNewTaskDefinition(service, imageUri, region, accountId, cfnDiscoveredResources, resourceName);
|
|
@@ -17925,10 +17894,10 @@ var init_ecs_publish = __esm({
|
|
|
17925
17894
|
});
|
|
17926
17895
|
|
|
17927
17896
|
// src/platforms/aws/handlers/ecs-update.ts
|
|
17928
|
-
import { execFileSync as
|
|
17897
|
+
import { execFileSync as execFileSync41 } from "child_process";
|
|
17929
17898
|
async function getCurrentTaskDefinition(cluster, service, region) {
|
|
17930
17899
|
try {
|
|
17931
|
-
const taskDef =
|
|
17900
|
+
const taskDef = execFileSync41("aws", ["ecs", "describe-services", "--cluster", cluster, "--services", service, "--query", "services[0].taskDefinition", "--output", "text", "--region", region], { encoding: "utf-8" }).trim();
|
|
17932
17901
|
return taskDef.split(":").pop() || "";
|
|
17933
17902
|
} catch {
|
|
17934
17903
|
return "";
|
|
@@ -17936,7 +17905,7 @@ async function getCurrentTaskDefinition(cluster, service, region) {
|
|
|
17936
17905
|
}
|
|
17937
17906
|
async function getTaskDefinitionFamily(cluster, service, region) {
|
|
17938
17907
|
try {
|
|
17939
|
-
const taskDefArn =
|
|
17908
|
+
const taskDefArn = execFileSync41("aws", ["ecs", "describe-services", "--cluster", cluster, "--services", service, "--query", "services[0].taskDefinition", "--output", "text", "--region", region], { encoding: "utf-8" }).trim();
|
|
17940
17909
|
const parts = taskDefArn.split("/");
|
|
17941
17910
|
if (parts.length > 1) {
|
|
17942
17911
|
return parts[1].split(":")[0];
|
|
@@ -17950,7 +17919,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
17950
17919
|
try {
|
|
17951
17920
|
const family = await getTaskDefinitionFamily(cluster, service, region);
|
|
17952
17921
|
if (!family) return "";
|
|
17953
|
-
const taskDefArn =
|
|
17922
|
+
const taskDefArn = execFileSync41("aws", [
|
|
17954
17923
|
"ecs",
|
|
17955
17924
|
"list-task-definitions",
|
|
17956
17925
|
"--family-prefix",
|
|
@@ -17976,7 +17945,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
17976
17945
|
async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
17977
17946
|
try {
|
|
17978
17947
|
const taskId = taskArn.split("/").pop();
|
|
17979
|
-
const taskDetails =
|
|
17948
|
+
const taskDetails = execFileSync41("aws", [
|
|
17980
17949
|
"ecs",
|
|
17981
17950
|
"describe-tasks",
|
|
17982
17951
|
"--cluster",
|
|
@@ -17992,7 +17961,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
17992
17961
|
if (!task) {
|
|
17993
17962
|
return [];
|
|
17994
17963
|
}
|
|
17995
|
-
const taskDefDetails =
|
|
17964
|
+
const taskDefDetails = execFileSync41("aws", [
|
|
17996
17965
|
"ecs",
|
|
17997
17966
|
"describe-task-definition",
|
|
17998
17967
|
"--task-definition",
|
|
@@ -18015,7 +17984,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
18015
17984
|
}
|
|
18016
17985
|
const containerName = mainContainer.name;
|
|
18017
17986
|
const logStream = `${streamPrefix}/${containerName}/${taskId}`;
|
|
18018
|
-
const logsJson =
|
|
17987
|
+
const logsJson = execFileSync41("aws", [
|
|
18019
17988
|
"logs",
|
|
18020
17989
|
"filter-log-events",
|
|
18021
17990
|
"--log-group-name",
|
|
@@ -18050,7 +18019,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18050
18019
|
let failedTaskInfo = [];
|
|
18051
18020
|
while (Date.now() - startTime < effectiveTimeout * 1e3) {
|
|
18052
18021
|
try {
|
|
18053
|
-
const serviceData =
|
|
18022
|
+
const serviceData = execFileSync41("aws", [
|
|
18054
18023
|
"ecs",
|
|
18055
18024
|
"describe-services",
|
|
18056
18025
|
"--cluster",
|
|
@@ -18099,7 +18068,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18099
18068
|
const ourRevision = ourDeployment.taskDefinition?.split(":").pop() || "unknown";
|
|
18100
18069
|
const oldRevisions = /* @__PURE__ */ new Set();
|
|
18101
18070
|
try {
|
|
18102
|
-
const stoppedTasksData =
|
|
18071
|
+
const stoppedTasksData = execFileSync41("aws", [
|
|
18103
18072
|
"ecs",
|
|
18104
18073
|
"list-tasks",
|
|
18105
18074
|
"--cluster",
|
|
@@ -18115,7 +18084,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18115
18084
|
], { encoding: "utf-8" });
|
|
18116
18085
|
const stoppedTaskArns = JSON.parse(stoppedTasksData).taskArns || [];
|
|
18117
18086
|
if (stoppedTaskArns.length > 0) {
|
|
18118
|
-
const stoppedTasksJson =
|
|
18087
|
+
const stoppedTasksJson = execFileSync41("aws", [
|
|
18119
18088
|
"ecs",
|
|
18120
18089
|
"describe-tasks",
|
|
18121
18090
|
"--cluster",
|
|
@@ -18204,7 +18173,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18204
18173
|
}
|
|
18205
18174
|
}
|
|
18206
18175
|
try {
|
|
18207
|
-
const tasksData =
|
|
18176
|
+
const tasksData = execFileSync41("aws", [
|
|
18208
18177
|
"ecs",
|
|
18209
18178
|
"list-tasks",
|
|
18210
18179
|
"--cluster",
|
|
@@ -18220,7 +18189,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18220
18189
|
], { encoding: "utf-8" });
|
|
18221
18190
|
const taskArns = JSON.parse(tasksData).taskArns || [];
|
|
18222
18191
|
if (taskArns.length > 0) {
|
|
18223
|
-
const taskDetailsJson =
|
|
18192
|
+
const taskDetailsJson = execFileSync41("aws", [
|
|
18224
18193
|
"ecs",
|
|
18225
18194
|
"describe-tasks",
|
|
18226
18195
|
"--cluster",
|
|
@@ -18439,13 +18408,13 @@ var init_ecs_update = __esm({
|
|
|
18439
18408
|
printInfo(`No newer task definition found. Forcing redeployment of current revision ${currentRevision}`);
|
|
18440
18409
|
}
|
|
18441
18410
|
}
|
|
18442
|
-
const updateResult =
|
|
18411
|
+
const updateResult = execFileSync41("aws", updateArgs, { encoding: "utf-8" });
|
|
18443
18412
|
if (service.verbose) {
|
|
18444
18413
|
try {
|
|
18445
|
-
const serviceData =
|
|
18414
|
+
const serviceData = execFileSync41("aws", ["ecs", "describe-services", "--cluster", clusterName, "--services", serviceName, "--region", region, "--output", "json"], { encoding: "utf-8" });
|
|
18446
18415
|
const ecsService = JSON.parse(serviceData).services?.[0];
|
|
18447
18416
|
if (ecsService?.taskDefinition) {
|
|
18448
|
-
const currentTaskDef =
|
|
18417
|
+
const currentTaskDef = execFileSync41("aws", ["ecs", "describe-task-definition", "--task-definition", ecsService.taskDefinition, "--region", region, "--output", "json"], { encoding: "utf-8" });
|
|
18449
18418
|
const taskDef = JSON.parse(currentTaskDef).taskDefinition;
|
|
18450
18419
|
const images = taskDef.containerDefinitions?.map((c) => c.image).filter(Boolean);
|
|
18451
18420
|
if (images?.length > 0) {
|
|
@@ -18573,10 +18542,10 @@ __export(credential_validator_exports, {
|
|
|
18573
18542
|
isAWSCliInstalled: () => isAWSCliInstalled,
|
|
18574
18543
|
validateAWSCredentials: () => validateAWSCredentials
|
|
18575
18544
|
});
|
|
18576
|
-
import { execFileSync as
|
|
18545
|
+
import { execFileSync as execFileSync42 } from "child_process";
|
|
18577
18546
|
async function validateAWSCredentials(_environment) {
|
|
18578
18547
|
try {
|
|
18579
|
-
const output =
|
|
18548
|
+
const output = execFileSync42("aws", ["sts", "get-caller-identity", "--output", "json"], {
|
|
18580
18549
|
stdio: ["pipe", "pipe", "pipe"],
|
|
18581
18550
|
encoding: "utf8",
|
|
18582
18551
|
env: {
|
|
@@ -18619,7 +18588,7 @@ async function validateAWSCredentials(_environment) {
|
|
|
18619
18588
|
}
|
|
18620
18589
|
function isAWSCliInstalled() {
|
|
18621
18590
|
try {
|
|
18622
|
-
|
|
18591
|
+
execFileSync42("aws", ["--version"], { stdio: "ignore" });
|
|
18623
18592
|
return true;
|
|
18624
18593
|
} catch {
|
|
18625
18594
|
return false;
|
|
@@ -18627,7 +18596,7 @@ function isAWSCliInstalled() {
|
|
|
18627
18596
|
}
|
|
18628
18597
|
function getAWSProfiles() {
|
|
18629
18598
|
try {
|
|
18630
|
-
const output =
|
|
18599
|
+
const output = execFileSync42("aws", ["configure", "list-profiles"], {
|
|
18631
18600
|
stdio: "pipe",
|
|
18632
18601
|
encoding: "utf8"
|
|
18633
18602
|
});
|
|
@@ -19490,13 +19459,13 @@ var uuid4;
|
|
|
19490
19459
|
var init_uuid = __esm({
|
|
19491
19460
|
"node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs"() {
|
|
19492
19461
|
uuid4 = function() {
|
|
19493
|
-
const { crypto:
|
|
19494
|
-
if (
|
|
19495
|
-
uuid4 =
|
|
19496
|
-
return
|
|
19462
|
+
const { crypto: crypto3 } = globalThis;
|
|
19463
|
+
if (crypto3?.randomUUID) {
|
|
19464
|
+
uuid4 = crypto3.randomUUID.bind(crypto3);
|
|
19465
|
+
return crypto3.randomUUID();
|
|
19497
19466
|
}
|
|
19498
19467
|
const u8 = new Uint8Array(1);
|
|
19499
|
-
const randomByte =
|
|
19468
|
+
const randomByte = crypto3 ? () => crypto3.getRandomValues(u8)[0] : () => Math.random() * 255 & 255;
|
|
19500
19469
|
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (+c ^ randomByte() & 15 >> +c / 4).toString(16));
|
|
19501
19470
|
};
|
|
19502
19471
|
}
|
|
@@ -25496,7 +25465,7 @@ var init_multi_service_executor = __esm({
|
|
|
25496
25465
|
try {
|
|
25497
25466
|
const result = await this.executeService(serviceInfo, finalOptions, envConfig);
|
|
25498
25467
|
results.push(result);
|
|
25499
|
-
if (!isStructuredOutput && !finalOptions.quiet && !result.success) {
|
|
25468
|
+
if (!isStructuredOutput && !finalOptions.quiet && !result.success && result.error) {
|
|
25500
25469
|
printError(`Failed to ${this.descriptor.name} ${serviceInfo.name}: ${result.error}`);
|
|
25501
25470
|
}
|
|
25502
25471
|
} catch (error) {
|
|
@@ -25904,10 +25873,11 @@ var init_check = __esm({
|
|
|
25904
25873
|
}),
|
|
25905
25874
|
buildResult: (handlerResult, service, platform, serviceType) => {
|
|
25906
25875
|
const checkResult = handlerResult;
|
|
25876
|
+
const isHealthy = handlerResult.success && checkResult.health?.healthy === true;
|
|
25907
25877
|
return createCommandResult({
|
|
25908
25878
|
entity: service.name,
|
|
25909
25879
|
platform: platform.getPlatformName(),
|
|
25910
|
-
success:
|
|
25880
|
+
success: isHealthy,
|
|
25911
25881
|
error: handlerResult.error,
|
|
25912
25882
|
metadata: {
|
|
25913
25883
|
...handlerResult.metadata,
|
|
@@ -27043,7 +27013,7 @@ var require_package = __commonJS({
|
|
|
27043
27013
|
"package.json"(exports, module) {
|
|
27044
27014
|
module.exports = {
|
|
27045
27015
|
name: "@semiont/cli",
|
|
27046
|
-
version: "0.4.
|
|
27016
|
+
version: "0.4.6",
|
|
27047
27017
|
description: "Semiont CLI - Unified environment management tool",
|
|
27048
27018
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
27049
27019
|
type: "module",
|
|
@@ -27107,12 +27077,12 @@ var require_package = __commonJS({
|
|
|
27107
27077
|
"@aws-sdk/client-secrets-manager": "^3.600.0",
|
|
27108
27078
|
"@aws-sdk/client-sts": "^3.859.0",
|
|
27109
27079
|
"@aws-sdk/client-wafv2": "^3.859.0",
|
|
27110
|
-
"@semiont/api-client": "^0.4.
|
|
27111
|
-
"@semiont/content": "^0.4.
|
|
27112
|
-
"@semiont/core": "^0.4.
|
|
27113
|
-
"@semiont/event-sourcing": "^0.4.
|
|
27114
|
-
"@semiont/graph": "^0.4.
|
|
27115
|
-
"@semiont/make-meaning": "^0.4.
|
|
27080
|
+
"@semiont/api-client": "^0.4.6",
|
|
27081
|
+
"@semiont/content": "^0.4.6",
|
|
27082
|
+
"@semiont/core": "^0.4.6",
|
|
27083
|
+
"@semiont/event-sourcing": "^0.4.6",
|
|
27084
|
+
"@semiont/graph": "^0.4.6",
|
|
27085
|
+
"@semiont/make-meaning": "^0.4.6",
|
|
27116
27086
|
arg: "^5.0.2",
|
|
27117
27087
|
argon2: "^0.44.0",
|
|
27118
27088
|
express: "^5.2.1",
|
|
@@ -27530,7 +27500,7 @@ init_base_options_schema();
|
|
|
27530
27500
|
var StopOptionsSchema = OpsOptionsSchema.extend({
|
|
27531
27501
|
service: external_exports.string().optional(),
|
|
27532
27502
|
force: external_exports.boolean().default(false).describe("Force stop without graceful shutdown"),
|
|
27533
|
-
timeout: external_exports.number().default(
|
|
27503
|
+
timeout: external_exports.number().default(3).describe("Timeout for graceful shutdown in seconds")
|
|
27534
27504
|
});
|
|
27535
27505
|
var stopDescriptor = createCommandDescriptor({
|
|
27536
27506
|
name: "stop",
|
|
@@ -27681,6 +27651,7 @@ var provisionDescriptor = createCommandDescriptor({
|
|
|
27681
27651
|
serviceType
|
|
27682
27652
|
}
|
|
27683
27653
|
}, {
|
|
27654
|
+
status: handlerResult.success ? "provisioned" : "unknown",
|
|
27684
27655
|
provisionedResources: provisionResult.provisionedResources,
|
|
27685
27656
|
stackOutputs: provisionResult.stackOutputs,
|
|
27686
27657
|
resources: provisionResult.resources
|
|
@@ -27744,7 +27715,7 @@ var provisionCommand = new CommandBuilder().name("provision").description("Provi
|
|
|
27744
27715
|
},
|
|
27745
27716
|
"--rotate-secret": {
|
|
27746
27717
|
type: "boolean",
|
|
27747
|
-
description: "Force generation of a new
|
|
27718
|
+
description: "Force generation of a new JWT_SECRET. Has no effect on other services. Warns if the peer service will be left out of sync.",
|
|
27748
27719
|
default: false
|
|
27749
27720
|
}
|
|
27750
27721
|
},
|
|
@@ -28158,7 +28129,7 @@ init_command_definition();
|
|
|
28158
28129
|
init_base_options_schema();
|
|
28159
28130
|
init_cli_logger();
|
|
28160
28131
|
init_config_loader();
|
|
28161
|
-
import * as
|
|
28132
|
+
import * as crypto2 from "crypto";
|
|
28162
28133
|
import * as argon2 from "argon2";
|
|
28163
28134
|
import * as path36 from "path";
|
|
28164
28135
|
import { createRequire as createRequire3 } from "module";
|
|
@@ -28217,7 +28188,7 @@ function extractDomain(email) {
|
|
|
28217
28188
|
return parts[1];
|
|
28218
28189
|
}
|
|
28219
28190
|
function generatePassword() {
|
|
28220
|
-
return
|
|
28191
|
+
return crypto2.randomBytes(12).toString("base64");
|
|
28221
28192
|
}
|
|
28222
28193
|
async function useradd(options) {
|
|
28223
28194
|
const startTime = Date.now();
|
|
@@ -29064,7 +29035,7 @@ init_base_options_schema();
|
|
|
29064
29035
|
import * as fs49 from "fs";
|
|
29065
29036
|
import * as path42 from "path";
|
|
29066
29037
|
import * as readline2 from "readline";
|
|
29067
|
-
import { execFileSync as
|
|
29038
|
+
import { execFileSync as execFileSync43 } from "child_process";
|
|
29068
29039
|
var LocalOptionsSchema = OpsOptionsSchema.extend({
|
|
29069
29040
|
directory: external_exports.string().optional(),
|
|
29070
29041
|
yes: external_exports.boolean().default(false)
|
|
@@ -29082,7 +29053,7 @@ function prompt2(question) {
|
|
|
29082
29053
|
});
|
|
29083
29054
|
}
|
|
29084
29055
|
function runSemiont(args, env, captureOutput = false) {
|
|
29085
|
-
return
|
|
29056
|
+
return execFileSync43("semiont", args, {
|
|
29086
29057
|
env,
|
|
29087
29058
|
stdio: captureOutput ? "pipe" : "inherit",
|
|
29088
29059
|
encoding: "utf8"
|
|
@@ -29090,7 +29061,7 @@ function runSemiont(args, env, captureOutput = false) {
|
|
|
29090
29061
|
}
|
|
29091
29062
|
function runSemiontSafe(args, env) {
|
|
29092
29063
|
try {
|
|
29093
|
-
const output =
|
|
29064
|
+
const output = execFileSync43("semiont", args, {
|
|
29094
29065
|
env,
|
|
29095
29066
|
stdio: "pipe",
|
|
29096
29067
|
encoding: "utf8"
|
|
@@ -29361,7 +29332,7 @@ init_command_definition();
|
|
|
29361
29332
|
init_base_options_schema();
|
|
29362
29333
|
import * as fs50 from "fs";
|
|
29363
29334
|
import * as readline3 from "readline";
|
|
29364
|
-
import { execFileSync as
|
|
29335
|
+
import { execFileSync as execFileSync44 } from "child_process";
|
|
29365
29336
|
import { SemiontProject as SemiontProject20 } from "@semiont/core/node";
|
|
29366
29337
|
var CleanOptionsSchema = OpsOptionsSchema.extend({
|
|
29367
29338
|
force: external_exports.boolean().default(false),
|
|
@@ -29414,7 +29385,7 @@ function listDir(dir) {
|
|
|
29414
29385
|
function containerRuntime() {
|
|
29415
29386
|
for (const rt of ["docker", "podman"]) {
|
|
29416
29387
|
try {
|
|
29417
|
-
|
|
29388
|
+
execFileSync44(rt, ["info"], { stdio: "ignore" });
|
|
29418
29389
|
return rt;
|
|
29419
29390
|
} catch {
|
|
29420
29391
|
}
|
|
@@ -29507,9 +29478,9 @@ async function clean(options) {
|
|
|
29507
29478
|
for (const svc of ["database", "graph", "inference"]) {
|
|
29508
29479
|
const volName = `semiont-${svc}-${env}-data`;
|
|
29509
29480
|
try {
|
|
29510
|
-
|
|
29481
|
+
execFileSync44(runtime, ["volume", "inspect", volName], { stdio: "ignore" });
|
|
29511
29482
|
if (!options.dryRun) {
|
|
29512
|
-
|
|
29483
|
+
execFileSync44(runtime, ["volume", "rm", volName], { stdio: "pipe" });
|
|
29513
29484
|
}
|
|
29514
29485
|
removed.push(volName);
|
|
29515
29486
|
} catch {
|
|
@@ -29517,9 +29488,9 @@ async function clean(options) {
|
|
|
29517
29488
|
}
|
|
29518
29489
|
const netName = `semiont-${env}`;
|
|
29519
29490
|
try {
|
|
29520
|
-
|
|
29491
|
+
execFileSync44(runtime, ["network", "inspect", netName], { stdio: "ignore" });
|
|
29521
29492
|
if (!options.dryRun) {
|
|
29522
|
-
|
|
29493
|
+
execFileSync44(runtime, ["network", "rm", netName], { stdio: "pipe" });
|
|
29523
29494
|
}
|
|
29524
29495
|
removed.push(`network: ${netName}`);
|
|
29525
29496
|
} catch {
|
|
@@ -31787,7 +31758,7 @@ var OutputFormatter = class {
|
|
|
31787
31758
|
if (!result.success) {
|
|
31788
31759
|
statusIndicator = "[FAIL]";
|
|
31789
31760
|
statusColor = c.red;
|
|
31790
|
-
} else if (status === "running" || status === "healthy") {
|
|
31761
|
+
} else if (status === "running" || status === "healthy" || status === "provisioned") {
|
|
31791
31762
|
statusIndicator = "[OK]";
|
|
31792
31763
|
statusColor = c.green;
|
|
31793
31764
|
} else if (status === "stopped") {
|
|
@@ -31929,7 +31900,7 @@ var OutputFormatter = class {
|
|
|
31929
31900
|
const status = result.extensions?.status || result.status || "unknown";
|
|
31930
31901
|
if (!result.success) {
|
|
31931
31902
|
statusText = `${c.red}[FAIL]${c.reset} ${status}`;
|
|
31932
|
-
} else if (status === "running" || status === "healthy") {
|
|
31903
|
+
} else if (status === "running" || status === "healthy" || status === "provisioned") {
|
|
31933
31904
|
statusText = `${c.green}[OK]${c.reset} ${status}`;
|
|
31934
31905
|
} else if (status === "stopped") {
|
|
31935
31906
|
statusText = `${c.yellow}[--]${c.reset} ${status}`;
|
|
@@ -32322,7 +32293,7 @@ async function generateGlobalHelp() {
|
|
|
32322
32293
|
}
|
|
32323
32294
|
|
|
32324
32295
|
// src/cli.ts
|
|
32325
|
-
var VERSION2 = "0.4.
|
|
32296
|
+
var VERSION2 = "0.4.6";
|
|
32326
32297
|
function printVersion() {
|
|
32327
32298
|
console.log(`Semiont CLI v${VERSION2}`);
|
|
32328
32299
|
}
|