@semiont/cli 0.4.5 → 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 +286 -301
- 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);
|
|
@@ -8195,18 +8184,12 @@ var init_frontend_start = __esm({
|
|
|
8195
8184
|
...Object.fromEntries(Object.entries(process.env).filter(([, v]) => v !== void 0)),
|
|
8196
8185
|
NODE_ENV: envConfig.env?.NODE_ENV ?? "development",
|
|
8197
8186
|
PORT: port.toString(),
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
NEXT_PUBLIC_ALLOWED_ORIGINS: allowedOrigins.join(","),
|
|
8187
|
+
SEMIONT_BACKEND_URL: backendUrl,
|
|
8188
|
+
SEMIONT_SITE_NAME: config.siteName,
|
|
8189
|
+
SEMIONT_BASE_URL: frontendUrl,
|
|
8190
|
+
SEMIONT_OAUTH_ALLOWED_DOMAINS: oauthAllowedDomains.join(","),
|
|
8203
8191
|
LOG_DIR: logsDir
|
|
8204
8192
|
};
|
|
8205
|
-
const nextPublicVars = Object.keys(env).filter((k) => k.startsWith("NEXT_PUBLIC_"));
|
|
8206
|
-
if (!service.quiet) {
|
|
8207
|
-
printInfo(`Environment variables: ${nextPublicVars.length} NEXT_PUBLIC_* vars found`);
|
|
8208
|
-
nextPublicVars.forEach((k) => printInfo(` ${k}=${env[k]}`));
|
|
8209
|
-
}
|
|
8210
8193
|
fs17.mkdirSync(logsDir, { recursive: true });
|
|
8211
8194
|
fs17.mkdirSync(path17.dirname(pidFile), { recursive: true });
|
|
8212
8195
|
const appLogPath = path17.join(logsDir, "app.log");
|
|
@@ -8327,10 +8310,8 @@ var init_frontend_start = __esm({
|
|
|
8327
8310
|
checks.push(await checkPortFree(config.port));
|
|
8328
8311
|
}
|
|
8329
8312
|
if (npmDir) {
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
"frontend server.js"
|
|
8333
|
-
));
|
|
8313
|
+
const serverScript = resolveFrontendServerScript(projectRoot) ?? path17.join(npmDir, "server.js");
|
|
8314
|
+
checks.push(checkFileExists(serverScript, "frontend server.js"));
|
|
8334
8315
|
} else {
|
|
8335
8316
|
checks.push({ name: "frontend-npm-package", pass: false, message: "@semiont/frontend not installed \u2014 run: semiont provision" });
|
|
8336
8317
|
}
|
|
@@ -8375,10 +8356,12 @@ var init_proxy_start = __esm({
|
|
|
8375
8356
|
const pid = parseInt(fs18.readFileSync(paths.pidFile, "utf-8"));
|
|
8376
8357
|
try {
|
|
8377
8358
|
process.kill(pid, 0);
|
|
8359
|
+
if (!service.quiet) {
|
|
8360
|
+
printInfo(`Proxy is already running with PID ${pid}`);
|
|
8361
|
+
}
|
|
8378
8362
|
return {
|
|
8379
|
-
success:
|
|
8380
|
-
|
|
8381
|
-
metadata: { serviceType: "proxy", pid }
|
|
8363
|
+
success: true,
|
|
8364
|
+
metadata: { serviceType: "proxy", pid, alreadyRunning: true }
|
|
8382
8365
|
};
|
|
8383
8366
|
} catch {
|
|
8384
8367
|
fs18.unlinkSync(paths.pidFile);
|
|
@@ -8659,7 +8642,7 @@ var init_mcp_provision = __esm({
|
|
|
8659
8642
|
|
|
8660
8643
|
// src/platforms/posix/handlers/graph-provision.ts
|
|
8661
8644
|
import * as fs20 from "fs/promises";
|
|
8662
|
-
import { execFileSync as
|
|
8645
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
8663
8646
|
async function fileExists2(path46) {
|
|
8664
8647
|
try {
|
|
8665
8648
|
await fs20.access(path46);
|
|
@@ -8703,7 +8686,7 @@ var init_graph_provision = __esm({
|
|
|
8703
8686
|
dataStorageDir
|
|
8704
8687
|
} = paths;
|
|
8705
8688
|
try {
|
|
8706
|
-
|
|
8689
|
+
execFileSync11("java", ["-version"], { stdio: "ignore" });
|
|
8707
8690
|
} catch {
|
|
8708
8691
|
return {
|
|
8709
8692
|
success: false,
|
|
@@ -8716,9 +8699,9 @@ var init_graph_provision = __esm({
|
|
|
8716
8699
|
const downloadUrl = `https://github.com/JanusGraph/janusgraph/releases/download/v${janusgraphVersion}/janusgraph-${janusgraphVersion}.zip`;
|
|
8717
8700
|
if (!await fileExists2(janusgraphDir)) {
|
|
8718
8701
|
console.log(`Downloading JanusGraph ${janusgraphVersion}...`);
|
|
8719
|
-
|
|
8702
|
+
execFileSync11("curl", ["-L", "-o", zipPath, downloadUrl], { stdio: "inherit" });
|
|
8720
8703
|
console.log("Extracting JanusGraph...");
|
|
8721
|
-
|
|
8704
|
+
execFileSync11("unzip", ["-q", zipPath, "-d", dataDir], { stdio: "inherit" });
|
|
8722
8705
|
await fs20.unlink(zipPath);
|
|
8723
8706
|
}
|
|
8724
8707
|
let graphProperties = `
|
|
@@ -8847,7 +8830,7 @@ ssl: {
|
|
|
8847
8830
|
import * as fs21 from "fs";
|
|
8848
8831
|
import * as path18 from "path";
|
|
8849
8832
|
import * as crypto from "crypto";
|
|
8850
|
-
import { execFileSync as
|
|
8833
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
8851
8834
|
import { SemiontProject as SemiontProject9 } from "@semiont/core/node";
|
|
8852
8835
|
var SEMIONT_VERSION, provisionBackendService, preflightBackendProvision, backendProvisionDescriptor;
|
|
8853
8836
|
var init_backend_provision = __esm({
|
|
@@ -8856,7 +8839,7 @@ var init_backend_provision = __esm({
|
|
|
8856
8839
|
init_cli_logger();
|
|
8857
8840
|
init_backend_paths();
|
|
8858
8841
|
init_preflight_utils();
|
|
8859
|
-
SEMIONT_VERSION = "0.4.
|
|
8842
|
+
SEMIONT_VERSION = "0.4.6";
|
|
8860
8843
|
provisionBackendService = async (context) => {
|
|
8861
8844
|
const { service, options } = context;
|
|
8862
8845
|
const projectRoot = service.projectRoot;
|
|
@@ -8865,7 +8848,7 @@ var init_backend_provision = __esm({
|
|
|
8865
8848
|
printInfo(`Installing ${packageSpec}...`);
|
|
8866
8849
|
}
|
|
8867
8850
|
try {
|
|
8868
|
-
|
|
8851
|
+
execFileSync12("npm", ["install", packageSpec, "--prefix", projectRoot], {
|
|
8869
8852
|
cwd: projectRoot,
|
|
8870
8853
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8871
8854
|
});
|
|
@@ -8887,7 +8870,7 @@ var init_backend_provision = __esm({
|
|
|
8887
8870
|
metadata: { serviceType: "backend" }
|
|
8888
8871
|
};
|
|
8889
8872
|
}
|
|
8890
|
-
const entryPoint = path18.join(npmDir, "dist", "index.js");
|
|
8873
|
+
const entryPoint = resolveBackendEntryPoint(projectRoot) ?? path18.join(npmDir, "dist", "index.js");
|
|
8891
8874
|
const project = new SemiontProject9(projectRoot);
|
|
8892
8875
|
if (!service.quiet) {
|
|
8893
8876
|
printInfo(`Provisioning backend service ${service.name}...`);
|
|
@@ -8926,7 +8909,7 @@ var init_backend_provision = __esm({
|
|
|
8926
8909
|
printInfo("Generating Prisma client...");
|
|
8927
8910
|
}
|
|
8928
8911
|
try {
|
|
8929
|
-
|
|
8912
|
+
execFileSync12("npx", ["prisma", "generate", `--schema=${prismaSchemaPath}`], {
|
|
8930
8913
|
cwd: packageDir,
|
|
8931
8914
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8932
8915
|
});
|
|
@@ -8998,7 +8981,7 @@ var init_backend_provision = __esm({
|
|
|
8998
8981
|
// src/platforms/posix/handlers/frontend-provision.ts
|
|
8999
8982
|
import * as fs22 from "fs";
|
|
9000
8983
|
import * as path19 from "path";
|
|
9001
|
-
import { execFileSync as
|
|
8984
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
9002
8985
|
import { SemiontProject as SemiontProject10 } from "@semiont/core/node";
|
|
9003
8986
|
var SEMIONT_VERSION2, provisionFrontendService, preflightFrontendProvision, frontendProvisionDescriptor;
|
|
9004
8987
|
var init_frontend_provision = __esm({
|
|
@@ -9007,7 +8990,7 @@ var init_frontend_provision = __esm({
|
|
|
9007
8990
|
init_cli_logger();
|
|
9008
8991
|
init_frontend_paths();
|
|
9009
8992
|
init_preflight_utils();
|
|
9010
|
-
SEMIONT_VERSION2 = "0.4.
|
|
8993
|
+
SEMIONT_VERSION2 = "0.4.6";
|
|
9011
8994
|
provisionFrontendService = async (context) => {
|
|
9012
8995
|
const { service } = context;
|
|
9013
8996
|
const projectRoot = service.projectRoot;
|
|
@@ -9016,7 +8999,7 @@ var init_frontend_provision = __esm({
|
|
|
9016
8999
|
printInfo(`Installing ${packageSpec}...`);
|
|
9017
9000
|
}
|
|
9018
9001
|
try {
|
|
9019
|
-
|
|
9002
|
+
execFileSync13("npm", ["install", packageSpec, "--prefix", projectRoot], {
|
|
9020
9003
|
cwd: projectRoot,
|
|
9021
9004
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
9022
9005
|
});
|
|
@@ -9038,7 +9021,7 @@ var init_frontend_provision = __esm({
|
|
|
9038
9021
|
metadata: { serviceType: "frontend" }
|
|
9039
9022
|
};
|
|
9040
9023
|
}
|
|
9041
|
-
const serverScript = path19.join(npmDir, "
|
|
9024
|
+
const serverScript = path19.join(npmDir, "server.js");
|
|
9042
9025
|
const project = new SemiontProject10(projectRoot);
|
|
9043
9026
|
if (!service.quiet) {
|
|
9044
9027
|
printInfo(`Provisioning frontend service ${service.name}...`);
|
|
@@ -9395,7 +9378,7 @@ var init_graph_stop = __esm({
|
|
|
9395
9378
|
});
|
|
9396
9379
|
|
|
9397
9380
|
// src/platforms/posix/utils/process-manager.ts
|
|
9398
|
-
import { execFileSync as
|
|
9381
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
9399
9382
|
async function killProcessGroupAndRelated(pid, serviceType, verbose = false) {
|
|
9400
9383
|
let killed = false;
|
|
9401
9384
|
try {
|
|
@@ -9435,7 +9418,7 @@ async function killProcessGroupAndRelated(pid, serviceType, verbose = false) {
|
|
|
9435
9418
|
try {
|
|
9436
9419
|
for (const pattern of cleanupPatterns.patterns) {
|
|
9437
9420
|
try {
|
|
9438
|
-
|
|
9421
|
+
execFileSync14("pkill", ["-f", pattern], { stdio: "ignore" });
|
|
9439
9422
|
} catch {
|
|
9440
9423
|
}
|
|
9441
9424
|
}
|
|
@@ -9512,7 +9495,7 @@ var init_backend_stop = __esm({
|
|
|
9512
9495
|
const { service } = context;
|
|
9513
9496
|
const projectRoot = service.projectRoot;
|
|
9514
9497
|
const npmDir = resolveBackendNpmPackage(projectRoot);
|
|
9515
|
-
const entryPoint = npmDir ? path22.join(npmDir, "dist", "index.js") : null;
|
|
9498
|
+
const entryPoint = npmDir ? resolveBackendEntryPoint(projectRoot) ?? path22.join(npmDir, "dist", "index.js") : null;
|
|
9516
9499
|
const project = new SemiontProject11(projectRoot);
|
|
9517
9500
|
const pidFile = project.backendPidFile;
|
|
9518
9501
|
const appLogPath = project.backendAppLogFile;
|
|
@@ -10243,12 +10226,12 @@ var init_inference_stop = __esm({
|
|
|
10243
10226
|
|
|
10244
10227
|
// src/platforms/posix/handlers/inference-provision.ts
|
|
10245
10228
|
import * as fs30 from "fs";
|
|
10246
|
-
import { execFileSync as
|
|
10229
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
10247
10230
|
function detectGpu() {
|
|
10248
10231
|
const platform = process.platform;
|
|
10249
10232
|
if (platform === "darwin") {
|
|
10250
10233
|
try {
|
|
10251
|
-
const brand =
|
|
10234
|
+
const brand = execFileSync15("sysctl", ["-n", "machdep.cpu.brand_string"], {
|
|
10252
10235
|
encoding: "utf-8"
|
|
10253
10236
|
}).trim();
|
|
10254
10237
|
if (brand.includes("Apple")) {
|
|
@@ -10260,7 +10243,7 @@ function detectGpu() {
|
|
|
10260
10243
|
}
|
|
10261
10244
|
}
|
|
10262
10245
|
try {
|
|
10263
|
-
const gpuName =
|
|
10246
|
+
const gpuName = execFileSync15("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
10264
10247
|
encoding: "utf-8",
|
|
10265
10248
|
stdio: ["ignore", "pipe", "ignore"]
|
|
10266
10249
|
}).trim();
|
|
@@ -10270,7 +10253,7 @@ function detectGpu() {
|
|
|
10270
10253
|
} catch {
|
|
10271
10254
|
}
|
|
10272
10255
|
try {
|
|
10273
|
-
const output =
|
|
10256
|
+
const output = execFileSync15("rocm-smi", ["--showproductname"], {
|
|
10274
10257
|
encoding: "utf-8",
|
|
10275
10258
|
stdio: ["ignore", "pipe", "ignore"]
|
|
10276
10259
|
}).trim();
|
|
@@ -10306,7 +10289,7 @@ var init_inference_provision = __esm({
|
|
|
10306
10289
|
printInfo(`Pulling model ${model}...`);
|
|
10307
10290
|
}
|
|
10308
10291
|
try {
|
|
10309
|
-
|
|
10292
|
+
execFileSync15("ollama", ["pull", model], {
|
|
10310
10293
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
10311
10294
|
});
|
|
10312
10295
|
pulledModels.push(model);
|
|
@@ -10423,7 +10406,7 @@ var init_handlers = __esm({
|
|
|
10423
10406
|
});
|
|
10424
10407
|
|
|
10425
10408
|
// src/platforms/posix/platform.ts
|
|
10426
|
-
import { execFileSync as
|
|
10409
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
10427
10410
|
import * as fs31 from "fs";
|
|
10428
10411
|
import * as path25 from "path";
|
|
10429
10412
|
var PosixPlatform;
|
|
@@ -10513,7 +10496,7 @@ var init_platform2 = __esm({
|
|
|
10513
10496
|
try {
|
|
10514
10497
|
if (process.platform === "darwin") {
|
|
10515
10498
|
try {
|
|
10516
|
-
const output =
|
|
10499
|
+
const output = execFileSync16(
|
|
10517
10500
|
"log",
|
|
10518
10501
|
["show", "--process", String(pid), "--last", `${tail}m`, "--style", "json"],
|
|
10519
10502
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -10535,7 +10518,7 @@ var init_platform2 = __esm({
|
|
|
10535
10518
|
}
|
|
10536
10519
|
} else {
|
|
10537
10520
|
try {
|
|
10538
|
-
const output =
|
|
10521
|
+
const output = execFileSync16(
|
|
10539
10522
|
"journalctl",
|
|
10540
10523
|
[`_PID=${pid}`, "-n", String(tail), "--no-pager", "--output=json"],
|
|
10541
10524
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -10642,13 +10625,13 @@ var init_platform2 = __esm({
|
|
|
10642
10625
|
tailFile(filePath, lines) {
|
|
10643
10626
|
try {
|
|
10644
10627
|
if (process.platform === "win32") {
|
|
10645
|
-
return
|
|
10628
|
+
return execFileSync16(
|
|
10646
10629
|
"powershell",
|
|
10647
10630
|
["-Command", `Get-Content '${filePath}' -Tail ${lines}`],
|
|
10648
10631
|
{ encoding: "utf-8" }
|
|
10649
10632
|
);
|
|
10650
10633
|
} else {
|
|
10651
|
-
return
|
|
10634
|
+
return execFileSync16(
|
|
10652
10635
|
"tail",
|
|
10653
10636
|
["-n", String(lines), filePath],
|
|
10654
10637
|
{ encoding: "utf-8" }
|
|
@@ -10711,7 +10694,7 @@ var init_platform2 = __esm({
|
|
|
10711
10694
|
});
|
|
10712
10695
|
|
|
10713
10696
|
// src/platforms/container/handlers/web-check.ts
|
|
10714
|
-
import { execFileSync as
|
|
10697
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
10715
10698
|
import { baseUrl as baseUrl2 } from "@semiont/core";
|
|
10716
10699
|
import { SemiontApiClient as SemiontApiClient2 } from "@semiont/api-client";
|
|
10717
10700
|
var checkWebContainer, preflightWebCheck, webCheckDescriptor;
|
|
@@ -10723,7 +10706,7 @@ var init_web_check = __esm({
|
|
|
10723
10706
|
const { platform, service, runtime, containerName } = context;
|
|
10724
10707
|
const config = service.config;
|
|
10725
10708
|
try {
|
|
10726
|
-
const containerStatus =
|
|
10709
|
+
const containerStatus = execFileSync17(
|
|
10727
10710
|
runtime,
|
|
10728
10711
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10729
10712
|
{ encoding: "utf-8" }
|
|
@@ -10739,14 +10722,14 @@ var init_web_check = __esm({
|
|
|
10739
10722
|
metadata: { containerStatus }
|
|
10740
10723
|
};
|
|
10741
10724
|
}
|
|
10742
|
-
const containerId =
|
|
10725
|
+
const containerId = execFileSync17(
|
|
10743
10726
|
runtime,
|
|
10744
10727
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
10745
10728
|
{ encoding: "utf-8" }
|
|
10746
10729
|
).trim().substring(0, 12);
|
|
10747
10730
|
let dockerHealthStatus;
|
|
10748
10731
|
try {
|
|
10749
|
-
dockerHealthStatus =
|
|
10732
|
+
dockerHealthStatus = execFileSync17(
|
|
10750
10733
|
runtime,
|
|
10751
10734
|
["inspect", containerName, "--format", "{{.State.Health.Status}}"],
|
|
10752
10735
|
{ encoding: "utf-8" }
|
|
@@ -10887,7 +10870,7 @@ var init_web_check = __esm({
|
|
|
10887
10870
|
});
|
|
10888
10871
|
|
|
10889
10872
|
// src/platforms/container/handlers/database-check.ts
|
|
10890
|
-
import { execFileSync as
|
|
10873
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
10891
10874
|
var checkDatabaseContainer, preflightDatabaseCheck2, databaseCheckDescriptor2;
|
|
10892
10875
|
var init_database_check2 = __esm({
|
|
10893
10876
|
"src/platforms/container/handlers/database-check.ts"() {
|
|
@@ -10897,7 +10880,7 @@ var init_database_check2 = __esm({
|
|
|
10897
10880
|
const { platform, service, runtime, containerName } = context;
|
|
10898
10881
|
const config = service.config;
|
|
10899
10882
|
try {
|
|
10900
|
-
const containerStatus =
|
|
10883
|
+
const containerStatus = execFileSync18(
|
|
10901
10884
|
runtime,
|
|
10902
10885
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10903
10886
|
{ encoding: "utf-8" }
|
|
@@ -10913,7 +10896,7 @@ var init_database_check2 = __esm({
|
|
|
10913
10896
|
metadata: { containerStatus }
|
|
10914
10897
|
};
|
|
10915
10898
|
}
|
|
10916
|
-
const containerId =
|
|
10899
|
+
const containerId = execFileSync18(
|
|
10917
10900
|
runtime,
|
|
10918
10901
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
10919
10902
|
{ encoding: "utf-8" }
|
|
@@ -10932,13 +10915,13 @@ var init_database_check2 = __esm({
|
|
|
10932
10915
|
const port = config.port;
|
|
10933
10916
|
try {
|
|
10934
10917
|
try {
|
|
10935
|
-
|
|
10918
|
+
execFileSync18(
|
|
10936
10919
|
runtime,
|
|
10937
10920
|
["exec", containerName, "sh", "-c", `netstat -ln | grep :${port}`],
|
|
10938
10921
|
{ encoding: "utf-8" }
|
|
10939
10922
|
);
|
|
10940
10923
|
} catch {
|
|
10941
|
-
|
|
10924
|
+
execFileSync18(
|
|
10942
10925
|
runtime,
|
|
10943
10926
|
["exec", containerName, "sh", "-c", `nc -z localhost ${port}`],
|
|
10944
10927
|
{ encoding: "utf-8" }
|
|
@@ -11009,7 +10992,7 @@ var init_database_check2 = __esm({
|
|
|
11009
10992
|
});
|
|
11010
10993
|
|
|
11011
10994
|
// src/platforms/container/handlers/graph-check.ts
|
|
11012
|
-
import { execFileSync as
|
|
10995
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
11013
10996
|
function getGraphEndpoint2(graphType, port) {
|
|
11014
10997
|
const host = "localhost";
|
|
11015
10998
|
switch (graphType) {
|
|
@@ -11034,7 +11017,7 @@ var init_graph_check2 = __esm({
|
|
|
11034
11017
|
const config = service.config;
|
|
11035
11018
|
const graphType = config.type;
|
|
11036
11019
|
try {
|
|
11037
|
-
const containerStatus =
|
|
11020
|
+
const containerStatus = execFileSync19(
|
|
11038
11021
|
runtime,
|
|
11039
11022
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11040
11023
|
{ encoding: "utf-8" }
|
|
@@ -11054,12 +11037,12 @@ var init_graph_check2 = __esm({
|
|
|
11054
11037
|
}
|
|
11055
11038
|
};
|
|
11056
11039
|
}
|
|
11057
|
-
const containerId =
|
|
11040
|
+
const containerId = execFileSync19(
|
|
11058
11041
|
runtime,
|
|
11059
11042
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
11060
11043
|
{ encoding: "utf-8" }
|
|
11061
11044
|
).trim();
|
|
11062
|
-
const portsOutput =
|
|
11045
|
+
const portsOutput = execFileSync19(
|
|
11063
11046
|
runtime,
|
|
11064
11047
|
["port", containerName],
|
|
11065
11048
|
{ encoding: "utf-8" }
|
|
@@ -11085,7 +11068,7 @@ var init_graph_check2 = __esm({
|
|
|
11085
11068
|
case "janusgraph":
|
|
11086
11069
|
case "neptune":
|
|
11087
11070
|
try {
|
|
11088
|
-
|
|
11071
|
+
execFileSync19(
|
|
11089
11072
|
runtime,
|
|
11090
11073
|
["exec", containerName, "sh", "-c", `echo 'test' | nc -w 1 localhost ${port}`],
|
|
11091
11074
|
{ encoding: "utf-8", timeout: 5e3, stdio: "pipe" }
|
|
@@ -11093,12 +11076,12 @@ var init_graph_check2 = __esm({
|
|
|
11093
11076
|
isHealthy = true;
|
|
11094
11077
|
if (graphType === "janusgraph") {
|
|
11095
11078
|
try {
|
|
11096
|
-
const cassandraRunning =
|
|
11079
|
+
const cassandraRunning = execFileSync19(
|
|
11097
11080
|
runtime,
|
|
11098
11081
|
["ps", "--filter", "name=semiont-cassandra", "--format", "{{.Names}}"],
|
|
11099
11082
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
11100
11083
|
).trim().includes("semiont-cassandra");
|
|
11101
|
-
const elasticsearchRunning =
|
|
11084
|
+
const elasticsearchRunning = execFileSync19(
|
|
11102
11085
|
runtime,
|
|
11103
11086
|
["ps", "--filter", "name=semiont-elasticsearch", "--format", "{{.Names}}"],
|
|
11104
11087
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11121,7 +11104,7 @@ var init_graph_check2 = __esm({
|
|
|
11121
11104
|
}
|
|
11122
11105
|
}
|
|
11123
11106
|
} catch {
|
|
11124
|
-
const processes =
|
|
11107
|
+
const processes = execFileSync19(
|
|
11125
11108
|
runtime,
|
|
11126
11109
|
["exec", containerName, "ps", "aux"],
|
|
11127
11110
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11133,11 +11116,11 @@ var init_graph_check2 = __esm({
|
|
|
11133
11116
|
}
|
|
11134
11117
|
break;
|
|
11135
11118
|
case "neo4j":
|
|
11136
|
-
|
|
11119
|
+
execFileSync19("nc", ["-z", "localhost", String(port)], { timeout: 5e3 });
|
|
11137
11120
|
isHealthy = true;
|
|
11138
11121
|
break;
|
|
11139
11122
|
case "arangodb":
|
|
11140
|
-
const httpCode =
|
|
11123
|
+
const httpCode = execFileSync19(
|
|
11141
11124
|
"curl",
|
|
11142
11125
|
["-s", "-o", "/dev/null", "-w", "%{http_code}", `http://localhost:${port}/_api/version`],
|
|
11143
11126
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11145,7 +11128,7 @@ var init_graph_check2 = __esm({
|
|
|
11145
11128
|
isHealthy = httpCode === "200";
|
|
11146
11129
|
break;
|
|
11147
11130
|
default:
|
|
11148
|
-
|
|
11131
|
+
execFileSync19("nc", ["-z", "localhost", String(port)], { timeout: 5e3 });
|
|
11149
11132
|
isHealthy = true;
|
|
11150
11133
|
}
|
|
11151
11134
|
} catch (healthCheckError) {
|
|
@@ -11154,7 +11137,7 @@ var init_graph_check2 = __esm({
|
|
|
11154
11137
|
}
|
|
11155
11138
|
let logs;
|
|
11156
11139
|
try {
|
|
11157
|
-
const logOutput =
|
|
11140
|
+
const logOutput = execFileSync19(
|
|
11158
11141
|
runtime,
|
|
11159
11142
|
["logs", containerName, "--tail", "20"],
|
|
11160
11143
|
{ encoding: "utf-8", maxBuffer: 1024 * 1024 }
|
|
@@ -11168,7 +11151,7 @@ var init_graph_check2 = __esm({
|
|
|
11168
11151
|
};
|
|
11169
11152
|
} catch (logError) {
|
|
11170
11153
|
}
|
|
11171
|
-
const image =
|
|
11154
|
+
const image = execFileSync19(
|
|
11172
11155
|
runtime,
|
|
11173
11156
|
["inspect", containerName, "--format", "{{.Config.Image}}"],
|
|
11174
11157
|
{ encoding: "utf-8" }
|
|
@@ -11254,13 +11237,13 @@ var init_platform_resources = __esm({
|
|
|
11254
11237
|
});
|
|
11255
11238
|
|
|
11256
11239
|
// src/platforms/container/handlers/web-start.ts
|
|
11257
|
-
import { execFileSync as
|
|
11240
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
11258
11241
|
async function waitForContainer(runtime, containerName) {
|
|
11259
11242
|
const maxAttempts = 30;
|
|
11260
11243
|
let attempts = 0;
|
|
11261
11244
|
while (attempts < maxAttempts) {
|
|
11262
11245
|
try {
|
|
11263
|
-
const status =
|
|
11246
|
+
const status = execFileSync20(
|
|
11264
11247
|
runtime,
|
|
11265
11248
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11266
11249
|
{ encoding: "utf-8" }
|
|
@@ -11287,12 +11270,12 @@ var init_web_start = __esm({
|
|
|
11287
11270
|
const config = service.config;
|
|
11288
11271
|
const image = service.getImage();
|
|
11289
11272
|
try {
|
|
11290
|
-
|
|
11273
|
+
execFileSync20(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
11291
11274
|
} catch {
|
|
11292
11275
|
}
|
|
11293
11276
|
const networkName = `semiont-${service.environment}`;
|
|
11294
11277
|
try {
|
|
11295
|
-
|
|
11278
|
+
execFileSync20(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11296
11279
|
} catch {
|
|
11297
11280
|
}
|
|
11298
11281
|
const runArgs = [
|
|
@@ -11325,7 +11308,7 @@ var init_web_start = __esm({
|
|
|
11325
11308
|
printInfo(`Starting web container: ${containerName}`);
|
|
11326
11309
|
}
|
|
11327
11310
|
try {
|
|
11328
|
-
const containerId =
|
|
11311
|
+
const containerId = execFileSync20(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
11329
11312
|
await waitForContainer(runtime, containerName);
|
|
11330
11313
|
const endpoint = `http://localhost:${port}`;
|
|
11331
11314
|
return {
|
|
@@ -11376,7 +11359,7 @@ var init_web_start = __esm({
|
|
|
11376
11359
|
});
|
|
11377
11360
|
|
|
11378
11361
|
// src/platforms/container/handlers/database-start.ts
|
|
11379
|
-
import { execFileSync as
|
|
11362
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
11380
11363
|
async function waitForDatabase(runtime, containerName, image, quiet, dbUser, verbose) {
|
|
11381
11364
|
const maxAttempts = 15;
|
|
11382
11365
|
let attempts = 0;
|
|
@@ -11384,7 +11367,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11384
11367
|
const skipHealthCheck = process.env.SKIP_DB_HEALTH_CHECK === "true";
|
|
11385
11368
|
if (skipHealthCheck) {
|
|
11386
11369
|
try {
|
|
11387
|
-
const status =
|
|
11370
|
+
const status = execFileSync21(
|
|
11388
11371
|
runtime,
|
|
11389
11372
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11390
11373
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11399,7 +11382,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11399
11382
|
}
|
|
11400
11383
|
while (attempts < maxAttempts) {
|
|
11401
11384
|
try {
|
|
11402
|
-
const status =
|
|
11385
|
+
const status = execFileSync21(
|
|
11403
11386
|
runtime,
|
|
11404
11387
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11405
11388
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11419,7 +11402,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11419
11402
|
if (verbose) {
|
|
11420
11403
|
printInfo(`Checking PostgreSQL readiness with user '${dbUser}'...`);
|
|
11421
11404
|
}
|
|
11422
|
-
|
|
11405
|
+
execFileSync21(runtime, ["exec", containerName, "pg_isready", "-U", dbUser, "-t", "1"], {
|
|
11423
11406
|
stdio: verbose ? "inherit" : "ignore",
|
|
11424
11407
|
timeout: 5e3
|
|
11425
11408
|
});
|
|
@@ -11435,7 +11418,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11435
11418
|
}
|
|
11436
11419
|
} else if (image.includes("mysql")) {
|
|
11437
11420
|
try {
|
|
11438
|
-
|
|
11421
|
+
execFileSync21(runtime, ["exec", containerName, "mysqladmin", "ping", "-h", "localhost"], {
|
|
11439
11422
|
stdio: "ignore",
|
|
11440
11423
|
timeout: 5e3
|
|
11441
11424
|
});
|
|
@@ -11444,7 +11427,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11444
11427
|
}
|
|
11445
11428
|
} else if (image.includes("mongo")) {
|
|
11446
11429
|
try {
|
|
11447
|
-
|
|
11430
|
+
execFileSync21(runtime, ["exec", containerName, "mongosh", "--eval", "db.adminCommand('ping')"], {
|
|
11448
11431
|
stdio: "ignore",
|
|
11449
11432
|
timeout: 5e3
|
|
11450
11433
|
});
|
|
@@ -11478,12 +11461,12 @@ var init_database_start2 = __esm({
|
|
|
11478
11461
|
const config = service.config;
|
|
11479
11462
|
const image = service.getImage();
|
|
11480
11463
|
try {
|
|
11481
|
-
|
|
11464
|
+
execFileSync21(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
11482
11465
|
} catch {
|
|
11483
11466
|
}
|
|
11484
11467
|
const networkName = `semiont-${service.environment}`;
|
|
11485
11468
|
try {
|
|
11486
|
-
|
|
11469
|
+
execFileSync21(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11487
11470
|
} catch {
|
|
11488
11471
|
}
|
|
11489
11472
|
const runArgs = [
|
|
@@ -11505,7 +11488,7 @@ var init_database_start2 = __esm({
|
|
|
11505
11488
|
}
|
|
11506
11489
|
const volumeName = `${containerName}-data`;
|
|
11507
11490
|
try {
|
|
11508
|
-
|
|
11491
|
+
execFileSync21(runtime, ["volume", "create", volumeName], { stdio: "ignore" });
|
|
11509
11492
|
} catch {
|
|
11510
11493
|
}
|
|
11511
11494
|
const mountPath = image.includes("postgres") ? "/var/lib/postgresql/data" : image.includes("mysql") ? "/var/lib/mysql" : image.includes("mongo") ? "/data/db" : "/data";
|
|
@@ -11531,7 +11514,7 @@ var init_database_start2 = __esm({
|
|
|
11531
11514
|
printInfo(`Run command: ${runtime} ${runArgs.join(" ")}`);
|
|
11532
11515
|
}
|
|
11533
11516
|
try {
|
|
11534
|
-
const containerId =
|
|
11517
|
+
const containerId = execFileSync21(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
11535
11518
|
const dbUser = envVars.POSTGRES_USER || envVars.MYSQL_USER || envVars.MONGO_INITDB_ROOT_USERNAME;
|
|
11536
11519
|
await waitForDatabase(runtime, containerName, image, service.quiet, dbUser, context.options.verbose);
|
|
11537
11520
|
const endpoint = `localhost:${port}`;
|
|
@@ -11587,7 +11570,7 @@ var init_database_start2 = __esm({
|
|
|
11587
11570
|
// src/platforms/container/handlers/graph-start.ts
|
|
11588
11571
|
import * as fs32 from "fs/promises";
|
|
11589
11572
|
import * as path26 from "path";
|
|
11590
|
-
import { execFileSync as
|
|
11573
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
11591
11574
|
async function startJanusGraph2(context) {
|
|
11592
11575
|
const { service, runtime, containerName } = context;
|
|
11593
11576
|
const composePath = path26.join(service.projectRoot, "docker-compose.janusgraph.yml");
|
|
@@ -11599,7 +11582,7 @@ async function startJanusGraph2(context) {
|
|
|
11599
11582
|
};
|
|
11600
11583
|
}
|
|
11601
11584
|
try {
|
|
11602
|
-
const output =
|
|
11585
|
+
const output = execFileSync22(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
11603
11586
|
if (output.includes(containerName)) {
|
|
11604
11587
|
if (!service.quiet) {
|
|
11605
11588
|
printWarning("JanusGraph container is already running");
|
|
@@ -11620,7 +11603,7 @@ async function startJanusGraph2(context) {
|
|
|
11620
11603
|
if (!service.quiet) {
|
|
11621
11604
|
printInfo("Starting JanusGraph Docker stack...");
|
|
11622
11605
|
}
|
|
11623
|
-
|
|
11606
|
+
execFileSync22("docker-compose", ["-f", composePath, "up", "-d"], {
|
|
11624
11607
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
11625
11608
|
});
|
|
11626
11609
|
if (!service.quiet) {
|
|
@@ -11630,13 +11613,13 @@ async function startJanusGraph2(context) {
|
|
|
11630
11613
|
const maxAttempts = 20;
|
|
11631
11614
|
for (let i = 0; i < maxAttempts; i++) {
|
|
11632
11615
|
try {
|
|
11633
|
-
const status =
|
|
11616
|
+
const status = execFileSync22(
|
|
11634
11617
|
runtime,
|
|
11635
11618
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11636
11619
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
11637
11620
|
).trim();
|
|
11638
11621
|
if (status === "running") {
|
|
11639
|
-
const logs =
|
|
11622
|
+
const logs = execFileSync22(
|
|
11640
11623
|
runtime,
|
|
11641
11624
|
["logs", "--tail", "20", containerName],
|
|
11642
11625
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11656,7 +11639,7 @@ async function startJanusGraph2(context) {
|
|
|
11656
11639
|
}
|
|
11657
11640
|
if (!ready) {
|
|
11658
11641
|
try {
|
|
11659
|
-
const finalStatus =
|
|
11642
|
+
const finalStatus = execFileSync22(
|
|
11660
11643
|
runtime,
|
|
11661
11644
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11662
11645
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11671,14 +11654,14 @@ async function startJanusGraph2(context) {
|
|
|
11671
11654
|
}
|
|
11672
11655
|
}
|
|
11673
11656
|
if (!ready) {
|
|
11674
|
-
|
|
11657
|
+
execFileSync22("docker-compose", ["-f", composePath, "down"], { stdio: "ignore" });
|
|
11675
11658
|
return {
|
|
11676
11659
|
success: false,
|
|
11677
11660
|
error: "JanusGraph failed to start within timeout",
|
|
11678
11661
|
metadata: { serviceType: "graph", serviceName: "janusgraph" }
|
|
11679
11662
|
};
|
|
11680
11663
|
}
|
|
11681
|
-
const runningContainers =
|
|
11664
|
+
const runningContainers = execFileSync22(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
11682
11665
|
const hasCassandra = runningContainers.includes("semiont-cassandra");
|
|
11683
11666
|
const hasElasticsearch = runningContainers.includes("semiont-elasticsearch");
|
|
11684
11667
|
if (!service.quiet) {
|
|
@@ -11765,7 +11748,7 @@ var init_graph_start2 = __esm({
|
|
|
11765
11748
|
});
|
|
11766
11749
|
|
|
11767
11750
|
// src/platforms/container/handlers/database-provision.ts
|
|
11768
|
-
import { execFileSync as
|
|
11751
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
11769
11752
|
import * as fs33 from "fs";
|
|
11770
11753
|
import * as path27 from "path";
|
|
11771
11754
|
var provisionDatabaseContainer, preflightDatabaseProvision, databaseProvisionDescriptor;
|
|
@@ -11781,12 +11764,12 @@ var init_database_provision = __esm({
|
|
|
11781
11764
|
}
|
|
11782
11765
|
const networkName = `semiont-${service.environment}`;
|
|
11783
11766
|
try {
|
|
11784
|
-
|
|
11767
|
+
execFileSync23(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11785
11768
|
} catch {
|
|
11786
11769
|
}
|
|
11787
11770
|
const volumeName = `${containerName}-data`;
|
|
11788
11771
|
try {
|
|
11789
|
-
|
|
11772
|
+
execFileSync23(runtime, ["volume", "create", volumeName], { stdio: "ignore" });
|
|
11790
11773
|
if (!service.quiet) {
|
|
11791
11774
|
printInfo(`Created volume: ${volumeName}`);
|
|
11792
11775
|
}
|
|
@@ -11797,7 +11780,7 @@ var init_database_provision = __esm({
|
|
|
11797
11780
|
printInfo(`Pulling database image ${image}...`);
|
|
11798
11781
|
}
|
|
11799
11782
|
try {
|
|
11800
|
-
|
|
11783
|
+
execFileSync23(runtime, ["pull", image], {
|
|
11801
11784
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
11802
11785
|
});
|
|
11803
11786
|
} catch (error) {
|
|
@@ -11814,7 +11797,7 @@ var init_database_provision = __esm({
|
|
|
11814
11797
|
const dbUser = envVars.POSTGRES_USER || envVars.MYSQL_USER;
|
|
11815
11798
|
let containerRunning = false;
|
|
11816
11799
|
try {
|
|
11817
|
-
const status =
|
|
11800
|
+
const status = execFileSync23(
|
|
11818
11801
|
runtime,
|
|
11819
11802
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11820
11803
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11845,7 +11828,7 @@ var init_database_provision = __esm({
|
|
|
11845
11828
|
}
|
|
11846
11829
|
runArgs.push(image);
|
|
11847
11830
|
try {
|
|
11848
|
-
|
|
11831
|
+
execFileSync23(runtime, runArgs, { encoding: "utf-8" });
|
|
11849
11832
|
if (!service.quiet) {
|
|
11850
11833
|
printInfo("Waiting for database to be ready...");
|
|
11851
11834
|
}
|
|
@@ -11854,10 +11837,10 @@ var init_database_provision = __esm({
|
|
|
11854
11837
|
while (attempts < maxAttempts) {
|
|
11855
11838
|
try {
|
|
11856
11839
|
if (image.includes("postgres")) {
|
|
11857
|
-
|
|
11840
|
+
execFileSync23(runtime, ["exec", initContainerName, "pg_isready", "-U", dbUser || "postgres"], { stdio: "ignore" });
|
|
11858
11841
|
break;
|
|
11859
11842
|
} else if (image.includes("mysql")) {
|
|
11860
|
-
|
|
11843
|
+
execFileSync23(runtime, ["exec", initContainerName, "mysqladmin", "ping", "-h", "localhost"], { stdio: "ignore" });
|
|
11861
11844
|
break;
|
|
11862
11845
|
}
|
|
11863
11846
|
} catch {
|
|
@@ -11874,15 +11857,15 @@ var init_database_provision = __esm({
|
|
|
11874
11857
|
if (hasSeedData && !service.quiet) {
|
|
11875
11858
|
printInfo("Seed data found in db/seed - this should be loaded by your application");
|
|
11876
11859
|
}
|
|
11877
|
-
|
|
11878
|
-
|
|
11860
|
+
execFileSync23(runtime, ["stop", initContainerName], { stdio: "ignore" });
|
|
11861
|
+
execFileSync23(runtime, ["rm", initContainerName], { stdio: "ignore" });
|
|
11879
11862
|
if (!service.quiet) {
|
|
11880
11863
|
printSuccess("Database initialized successfully");
|
|
11881
11864
|
}
|
|
11882
11865
|
} catch (error) {
|
|
11883
11866
|
try {
|
|
11884
|
-
|
|
11885
|
-
|
|
11867
|
+
execFileSync23(runtime, ["stop", initContainerName], { stdio: "ignore" });
|
|
11868
|
+
execFileSync23(runtime, ["rm", initContainerName], { stdio: "ignore" });
|
|
11886
11869
|
} catch {
|
|
11887
11870
|
}
|
|
11888
11871
|
return {
|
|
@@ -14559,7 +14542,7 @@ var init_js_yaml = __esm({
|
|
|
14559
14542
|
// src/platforms/container/handlers/graph-provision.ts
|
|
14560
14543
|
import * as fs34 from "fs/promises";
|
|
14561
14544
|
import * as path28 from "path";
|
|
14562
|
-
import { execFileSync as
|
|
14545
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
14563
14546
|
var provisionGraphService2, preflightGraphProvision2, graphProvisionDescriptor2;
|
|
14564
14547
|
var init_graph_provision2 = __esm({
|
|
14565
14548
|
"src/platforms/container/handlers/graph-provision.ts"() {
|
|
@@ -14588,7 +14571,7 @@ var init_graph_provision2 = __esm({
|
|
|
14588
14571
|
const withCassandra = storage === "cassandra";
|
|
14589
14572
|
const networkName = "semiont-network";
|
|
14590
14573
|
try {
|
|
14591
|
-
|
|
14574
|
+
execFileSync24(runtime, ["--version"], { stdio: "ignore" });
|
|
14592
14575
|
} catch {
|
|
14593
14576
|
return {
|
|
14594
14577
|
success: false,
|
|
@@ -14597,14 +14580,14 @@ var init_graph_provision2 = __esm({
|
|
|
14597
14580
|
};
|
|
14598
14581
|
}
|
|
14599
14582
|
try {
|
|
14600
|
-
|
|
14583
|
+
execFileSync24(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
14601
14584
|
} catch {
|
|
14602
14585
|
}
|
|
14603
14586
|
if (!service.quiet) {
|
|
14604
14587
|
printInfo("Pulling required Docker images...");
|
|
14605
14588
|
}
|
|
14606
14589
|
try {
|
|
14607
|
-
|
|
14590
|
+
execFileSync24(runtime, ["pull", "janusgraph/janusgraph:1.0.0"], {
|
|
14608
14591
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14609
14592
|
});
|
|
14610
14593
|
} catch (error) {
|
|
@@ -14612,7 +14595,7 @@ var init_graph_provision2 = __esm({
|
|
|
14612
14595
|
}
|
|
14613
14596
|
if (withCassandra) {
|
|
14614
14597
|
try {
|
|
14615
|
-
|
|
14598
|
+
execFileSync24(runtime, ["pull", "cassandra:4"], {
|
|
14616
14599
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14617
14600
|
});
|
|
14618
14601
|
} catch (error) {
|
|
@@ -14621,7 +14604,7 @@ var init_graph_provision2 = __esm({
|
|
|
14621
14604
|
}
|
|
14622
14605
|
if (withElasticsearch) {
|
|
14623
14606
|
try {
|
|
14624
|
-
|
|
14607
|
+
execFileSync24(runtime, ["pull", "docker.elastic.co/elasticsearch/elasticsearch:7.17.10"], {
|
|
14625
14608
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14626
14609
|
});
|
|
14627
14610
|
} catch (error) {
|
|
@@ -14770,7 +14753,7 @@ var init_graph_provision2 = __esm({
|
|
|
14770
14753
|
|
|
14771
14754
|
// src/platforms/container/handlers/graph-stop.ts
|
|
14772
14755
|
import * as path29 from "path";
|
|
14773
|
-
import { execFileSync as
|
|
14756
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
14774
14757
|
import * as fs35 from "fs/promises";
|
|
14775
14758
|
async function stopJanusGraph2(context) {
|
|
14776
14759
|
const { service, runtime, options, containerName } = context;
|
|
@@ -14790,7 +14773,7 @@ async function stopJanusGraph2(context) {
|
|
|
14790
14773
|
}
|
|
14791
14774
|
let runningContainers = [];
|
|
14792
14775
|
try {
|
|
14793
|
-
const output =
|
|
14776
|
+
const output = execFileSync25(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
14794
14777
|
const containerNames = [containerName, "semiont-cassandra", "semiont-elasticsearch"];
|
|
14795
14778
|
runningContainers = containerNames.filter((name) => output.includes(name));
|
|
14796
14779
|
if (runningContainers.length === 0) {
|
|
@@ -14819,10 +14802,10 @@ async function stopJanusGraph2(context) {
|
|
|
14819
14802
|
if (!service.quiet) {
|
|
14820
14803
|
printInfo("Force stopping JanusGraph Docker stack...");
|
|
14821
14804
|
}
|
|
14822
|
-
|
|
14805
|
+
execFileSync25("docker-compose", ["-f", composePath, "kill"], {
|
|
14823
14806
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14824
14807
|
});
|
|
14825
|
-
|
|
14808
|
+
execFileSync25("docker-compose", ["-f", composePath, "down"], {
|
|
14826
14809
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14827
14810
|
});
|
|
14828
14811
|
if (!service.quiet) {
|
|
@@ -14842,10 +14825,10 @@ async function stopJanusGraph2(context) {
|
|
|
14842
14825
|
if (!service.quiet) {
|
|
14843
14826
|
printInfo(`Stopping JanusGraph Docker stack gracefully (timeout: ${options.timeout}s)...`);
|
|
14844
14827
|
}
|
|
14845
|
-
|
|
14828
|
+
execFileSync25("docker-compose", ["-f", composePath, "stop", "-t", options.timeout.toString()], {
|
|
14846
14829
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14847
14830
|
});
|
|
14848
|
-
|
|
14831
|
+
execFileSync25("docker-compose", ["-f", composePath, "down"], {
|
|
14849
14832
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14850
14833
|
});
|
|
14851
14834
|
if (!service.quiet) {
|
|
@@ -14916,7 +14899,7 @@ var init_graph_stop2 = __esm({
|
|
|
14916
14899
|
});
|
|
14917
14900
|
|
|
14918
14901
|
// src/platforms/container/handlers/database-stop.ts
|
|
14919
|
-
import { execFileSync as
|
|
14902
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
14920
14903
|
var stopDatabaseContainer, preflightDatabaseStop, databaseStopDescriptor;
|
|
14921
14904
|
var init_database_stop = __esm({
|
|
14922
14905
|
"src/platforms/container/handlers/database-stop.ts"() {
|
|
@@ -14925,12 +14908,12 @@ var init_database_stop = __esm({
|
|
|
14925
14908
|
init_preflight_utils();
|
|
14926
14909
|
stopDatabaseContainer = async (context) => {
|
|
14927
14910
|
const { service, runtime, containerName } = context;
|
|
14928
|
-
const { force, timeout
|
|
14911
|
+
const { force, timeout } = context.options;
|
|
14929
14912
|
if (!service.quiet) {
|
|
14930
14913
|
printInfo(`Stopping database container: ${containerName}`);
|
|
14931
14914
|
}
|
|
14932
14915
|
try {
|
|
14933
|
-
const status =
|
|
14916
|
+
const status = execFileSync26(
|
|
14934
14917
|
runtime,
|
|
14935
14918
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
14936
14919
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -14952,7 +14935,7 @@ var init_database_stop = __esm({
|
|
|
14952
14935
|
}
|
|
14953
14936
|
};
|
|
14954
14937
|
}
|
|
14955
|
-
const containerId =
|
|
14938
|
+
const containerId = execFileSync26(
|
|
14956
14939
|
runtime,
|
|
14957
14940
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
14958
14941
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -14961,7 +14944,7 @@ var init_database_stop = __esm({
|
|
|
14961
14944
|
if (!service.quiet) {
|
|
14962
14945
|
printWarning("Force stopping database (may cause data corruption)...");
|
|
14963
14946
|
}
|
|
14964
|
-
|
|
14947
|
+
execFileSync26(runtime, ["kill", containerName], { stdio: "pipe" });
|
|
14965
14948
|
} else {
|
|
14966
14949
|
if (!service.quiet) {
|
|
14967
14950
|
printInfo(`Gracefully stopping database (timeout: ${timeout}s)...`);
|
|
@@ -14969,7 +14952,7 @@ var init_database_stop = __esm({
|
|
|
14969
14952
|
const image = service.getImage();
|
|
14970
14953
|
if (image.includes("postgres")) {
|
|
14971
14954
|
try {
|
|
14972
|
-
|
|
14955
|
+
execFileSync26(
|
|
14973
14956
|
runtime,
|
|
14974
14957
|
[
|
|
14975
14958
|
"exec",
|
|
@@ -14982,20 +14965,20 @@ var init_database_stop = __esm({
|
|
|
14982
14965
|
{ stdio: "pipe", timeout: (timeout + 5) * 1e3 }
|
|
14983
14966
|
);
|
|
14984
14967
|
} catch {
|
|
14985
|
-
|
|
14968
|
+
execFileSync26(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
14986
14969
|
}
|
|
14987
14970
|
} else if (image.includes("mysql")) {
|
|
14988
14971
|
try {
|
|
14989
|
-
|
|
14972
|
+
execFileSync26(
|
|
14990
14973
|
runtime,
|
|
14991
14974
|
["exec", containerName, "mysqladmin", "shutdown"],
|
|
14992
14975
|
{ stdio: "pipe", timeout: timeout * 1e3 }
|
|
14993
14976
|
);
|
|
14994
14977
|
} catch {
|
|
14995
|
-
|
|
14978
|
+
execFileSync26(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
14996
14979
|
}
|
|
14997
14980
|
} else {
|
|
14998
|
-
|
|
14981
|
+
execFileSync26(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
14999
14982
|
}
|
|
15000
14983
|
}
|
|
15001
14984
|
let stopped = false;
|
|
@@ -15003,7 +14986,7 @@ var init_database_stop = __esm({
|
|
|
15003
14986
|
const maxAttempts = 10;
|
|
15004
14987
|
while (!stopped && attempts < maxAttempts) {
|
|
15005
14988
|
try {
|
|
15006
|
-
const currentStatus =
|
|
14989
|
+
const currentStatus = execFileSync26(
|
|
15007
14990
|
runtime,
|
|
15008
14991
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15009
14992
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15099,14 +15082,14 @@ var init_proxy_paths2 = __esm({
|
|
|
15099
15082
|
// src/platforms/container/handlers/proxy-provision.ts
|
|
15100
15083
|
import * as fs36 from "fs";
|
|
15101
15084
|
import * as path31 from "path";
|
|
15102
|
-
import { execFileSync as
|
|
15085
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
15103
15086
|
function getHostAddress(runtime) {
|
|
15104
15087
|
const platform = process.platform;
|
|
15105
15088
|
if (platform === "darwin" || platform === "win32") {
|
|
15106
15089
|
return "host.docker.internal";
|
|
15107
15090
|
} else {
|
|
15108
15091
|
try {
|
|
15109
|
-
|
|
15092
|
+
execFileSync27(runtime, ["run", "--rm", "alpine", "getent", "hosts", "host-gateway"], { stdio: "pipe" });
|
|
15110
15093
|
return "host-gateway";
|
|
15111
15094
|
} catch {
|
|
15112
15095
|
return "172.17.0.1";
|
|
@@ -15193,7 +15176,7 @@ var init_proxy_provision2 = __esm({
|
|
|
15193
15176
|
printInfo(`Pulling image: ${imageName}...`);
|
|
15194
15177
|
}
|
|
15195
15178
|
try {
|
|
15196
|
-
|
|
15179
|
+
execFileSync27(runtime, ["pull", imageName], {
|
|
15197
15180
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15198
15181
|
});
|
|
15199
15182
|
if (!service.quiet) {
|
|
@@ -15268,7 +15251,7 @@ var init_proxy_provision2 = __esm({
|
|
|
15268
15251
|
});
|
|
15269
15252
|
|
|
15270
15253
|
// src/platforms/container/handlers/proxy-start.ts
|
|
15271
|
-
import { execFileSync as
|
|
15254
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
15272
15255
|
import * as fs37 from "fs";
|
|
15273
15256
|
function getProxyImage2(type2, customImage) {
|
|
15274
15257
|
if (customImage) {
|
|
@@ -15319,9 +15302,9 @@ var init_proxy_start2 = __esm({
|
|
|
15319
15302
|
};
|
|
15320
15303
|
}
|
|
15321
15304
|
try {
|
|
15322
|
-
const existingContainer =
|
|
15305
|
+
const existingContainer = execFileSync28(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15323
15306
|
if (existingContainer) {
|
|
15324
|
-
const isRunning =
|
|
15307
|
+
const isRunning = execFileSync28(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15325
15308
|
if (isRunning) {
|
|
15326
15309
|
if (!service.quiet) {
|
|
15327
15310
|
printInfo(`Proxy container ${containerName} is already running`);
|
|
@@ -15339,7 +15322,7 @@ var init_proxy_start2 = __esm({
|
|
|
15339
15322
|
if (!service.quiet) {
|
|
15340
15323
|
printInfo(`Removing stopped container ${containerName}`);
|
|
15341
15324
|
}
|
|
15342
|
-
|
|
15325
|
+
execFileSync28(runtime, ["rm", containerName], { stdio: "pipe" });
|
|
15343
15326
|
}
|
|
15344
15327
|
}
|
|
15345
15328
|
} catch (error) {
|
|
@@ -15378,7 +15361,7 @@ var init_proxy_start2 = __esm({
|
|
|
15378
15361
|
}
|
|
15379
15362
|
}
|
|
15380
15363
|
try {
|
|
15381
|
-
const containerId =
|
|
15364
|
+
const containerId = execFileSync28(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
15382
15365
|
if (!service.quiet) {
|
|
15383
15366
|
printSuccess(`Container started with ID: ${containerId.substring(0, 12)}`);
|
|
15384
15367
|
}
|
|
@@ -15386,9 +15369,9 @@ var init_proxy_start2 = __esm({
|
|
|
15386
15369
|
printInfo("Waiting for proxy to become healthy...");
|
|
15387
15370
|
}
|
|
15388
15371
|
await new Promise((resolve10) => setTimeout(resolve10, 2e3));
|
|
15389
|
-
const isRunning =
|
|
15372
|
+
const isRunning = execFileSync28(runtime, ["ps", "-q", "-f", `id=${containerId}`], { encoding: "utf-8" }).trim();
|
|
15390
15373
|
if (!isRunning) {
|
|
15391
|
-
const logs =
|
|
15374
|
+
const logs = execFileSync28(runtime, ["logs", containerId], { encoding: "utf-8" });
|
|
15392
15375
|
return {
|
|
15393
15376
|
success: false,
|
|
15394
15377
|
error: `Container exited unexpectedly. Logs:
|
|
@@ -15398,7 +15381,7 @@ ${logs}`,
|
|
|
15398
15381
|
}
|
|
15399
15382
|
if (config.type === "envoy") {
|
|
15400
15383
|
try {
|
|
15401
|
-
|
|
15384
|
+
execFileSync28("curl", ["-s", "-o", "/dev/null", `http://localhost:${adminPort}/clusters`], { stdio: "pipe" });
|
|
15402
15385
|
if (!service.quiet) {
|
|
15403
15386
|
printSuccess("Proxy admin interface is accessible");
|
|
15404
15387
|
}
|
|
@@ -15476,7 +15459,7 @@ ${logs}`,
|
|
|
15476
15459
|
});
|
|
15477
15460
|
|
|
15478
15461
|
// src/platforms/container/handlers/proxy-stop.ts
|
|
15479
|
-
import { execFileSync as
|
|
15462
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
15480
15463
|
var stopProxyService2, preflightProxyStop, proxyStopDescriptor2;
|
|
15481
15464
|
var init_proxy_stop2 = __esm({
|
|
15482
15465
|
"src/platforms/container/handlers/proxy-stop.ts"() {
|
|
@@ -15490,7 +15473,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15490
15473
|
printInfo(`Stopping proxy service ${service.name} (type: ${config.type})...`);
|
|
15491
15474
|
}
|
|
15492
15475
|
try {
|
|
15493
|
-
const existingContainer =
|
|
15476
|
+
const existingContainer = execFileSync29(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15494
15477
|
if (!existingContainer) {
|
|
15495
15478
|
if (!service.quiet) {
|
|
15496
15479
|
printWarning(`Proxy container ${containerName} not found`);
|
|
@@ -15504,12 +15487,12 @@ var init_proxy_stop2 = __esm({
|
|
|
15504
15487
|
}
|
|
15505
15488
|
};
|
|
15506
15489
|
}
|
|
15507
|
-
const isRunning =
|
|
15490
|
+
const isRunning = execFileSync29(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15508
15491
|
if (isRunning) {
|
|
15509
15492
|
if (!service.quiet) {
|
|
15510
15493
|
printInfo(`Stopping container ${containerName}...`);
|
|
15511
15494
|
}
|
|
15512
|
-
|
|
15495
|
+
execFileSync29(runtime, ["stop", containerName], {
|
|
15513
15496
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15514
15497
|
});
|
|
15515
15498
|
if (!service.quiet) {
|
|
@@ -15523,7 +15506,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15523
15506
|
if (!service.quiet) {
|
|
15524
15507
|
printInfo(`Removing container ${containerName}...`);
|
|
15525
15508
|
}
|
|
15526
|
-
|
|
15509
|
+
execFileSync29(runtime, ["rm", containerName], {
|
|
15527
15510
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15528
15511
|
});
|
|
15529
15512
|
if (!service.quiet) {
|
|
@@ -15568,7 +15551,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15568
15551
|
});
|
|
15569
15552
|
|
|
15570
15553
|
// src/platforms/container/handlers/proxy-check.ts
|
|
15571
|
-
import { execFileSync as
|
|
15554
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
15572
15555
|
import * as fs38 from "fs";
|
|
15573
15556
|
async function checkUrl(url, timeout = 5e3) {
|
|
15574
15557
|
try {
|
|
@@ -15583,7 +15566,7 @@ async function checkUrl(url, timeout = 5e3) {
|
|
|
15583
15566
|
}
|
|
15584
15567
|
function getContainerUptime(runtime, containerName) {
|
|
15585
15568
|
try {
|
|
15586
|
-
const uptime =
|
|
15569
|
+
const uptime = execFileSync30(
|
|
15587
15570
|
runtime,
|
|
15588
15571
|
["ps", "--format", "{{.Status}}", "--filter", `name=${containerName}`],
|
|
15589
15572
|
{ encoding: "utf-8" }
|
|
@@ -15595,7 +15578,7 @@ function getContainerUptime(runtime, containerName) {
|
|
|
15595
15578
|
}
|
|
15596
15579
|
function getRecentLogs(runtime, containerName, lines = 20) {
|
|
15597
15580
|
try {
|
|
15598
|
-
const logs =
|
|
15581
|
+
const logs = execFileSync30(runtime, ["logs", "--tail", lines.toString(), containerName], { encoding: "utf-8" });
|
|
15599
15582
|
return logs;
|
|
15600
15583
|
} catch {
|
|
15601
15584
|
return void 0;
|
|
@@ -15622,7 +15605,7 @@ var init_proxy_check2 = __esm({
|
|
|
15622
15605
|
backendRouting: false
|
|
15623
15606
|
};
|
|
15624
15607
|
try {
|
|
15625
|
-
const containerId =
|
|
15608
|
+
const containerId = execFileSync30(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15626
15609
|
if (containerId) {
|
|
15627
15610
|
healthCheck.containerRunning = true;
|
|
15628
15611
|
healthCheck.containerId = containerId.substring(0, 12);
|
|
@@ -15634,7 +15617,7 @@ var init_proxy_check2 = __esm({
|
|
|
15634
15617
|
}
|
|
15635
15618
|
}
|
|
15636
15619
|
} else {
|
|
15637
|
-
const stoppedContainer =
|
|
15620
|
+
const stoppedContainer = execFileSync30(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15638
15621
|
if (stoppedContainer) {
|
|
15639
15622
|
if (!service.quiet) {
|
|
15640
15623
|
printWarning(`Container ${containerName} exists but is not running`);
|
|
@@ -15804,7 +15787,7 @@ Proxy service ${service.name} is healthy`);
|
|
|
15804
15787
|
});
|
|
15805
15788
|
|
|
15806
15789
|
// src/platforms/container/handlers/inference-check.ts
|
|
15807
|
-
import { execFileSync as
|
|
15790
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
15808
15791
|
var OLLAMA_DEFAULT_PORT3, checkInference2, preflightInferenceCheck2, inferenceCheckDescriptor2;
|
|
15809
15792
|
var init_inference_check2 = __esm({
|
|
15810
15793
|
"src/platforms/container/handlers/inference-check.ts"() {
|
|
@@ -15821,13 +15804,13 @@ var init_inference_check2 = __esm({
|
|
|
15821
15804
|
let containerId;
|
|
15822
15805
|
const modelAvailability = {};
|
|
15823
15806
|
try {
|
|
15824
|
-
const containerStatus =
|
|
15807
|
+
const containerStatus = execFileSync31(
|
|
15825
15808
|
runtime,
|
|
15826
15809
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15827
15810
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
15828
15811
|
).trim();
|
|
15829
15812
|
if (containerStatus === "running") {
|
|
15830
|
-
containerId =
|
|
15813
|
+
containerId = execFileSync31(
|
|
15831
15814
|
runtime,
|
|
15832
15815
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
15833
15816
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15857,7 +15840,7 @@ var init_inference_check2 = __esm({
|
|
|
15857
15840
|
let logs;
|
|
15858
15841
|
if (containerId) {
|
|
15859
15842
|
try {
|
|
15860
|
-
const output =
|
|
15843
|
+
const output = execFileSync31(
|
|
15861
15844
|
runtime,
|
|
15862
15845
|
["logs", "--tail", "10", containerName],
|
|
15863
15846
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -15917,10 +15900,10 @@ var init_inference_check2 = __esm({
|
|
|
15917
15900
|
});
|
|
15918
15901
|
|
|
15919
15902
|
// src/platforms/container/handlers/inference-start.ts
|
|
15920
|
-
import { execFileSync as
|
|
15903
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
15921
15904
|
function detectNvidiaGpu() {
|
|
15922
15905
|
try {
|
|
15923
|
-
|
|
15906
|
+
execFileSync32("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
15924
15907
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15925
15908
|
});
|
|
15926
15909
|
return true;
|
|
@@ -15943,7 +15926,7 @@ var init_inference_start2 = __esm({
|
|
|
15943
15926
|
const port = serviceConfig.port || OLLAMA_DEFAULT_PORT4;
|
|
15944
15927
|
const image = serviceConfig.image || OLLAMA_IMAGE;
|
|
15945
15928
|
try {
|
|
15946
|
-
const output =
|
|
15929
|
+
const output = execFileSync32(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
15947
15930
|
if (output.includes(containerName)) {
|
|
15948
15931
|
if (!service.quiet) {
|
|
15949
15932
|
printWarning("Ollama container is already running");
|
|
@@ -15961,7 +15944,7 @@ var init_inference_start2 = __esm({
|
|
|
15961
15944
|
} catch {
|
|
15962
15945
|
}
|
|
15963
15946
|
try {
|
|
15964
|
-
|
|
15947
|
+
execFileSync32(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
15965
15948
|
} catch {
|
|
15966
15949
|
}
|
|
15967
15950
|
if (!service.quiet) {
|
|
@@ -15969,7 +15952,7 @@ var init_inference_start2 = __esm({
|
|
|
15969
15952
|
}
|
|
15970
15953
|
const gpuArgs = detectNvidiaGpu() ? ["--gpus", "all"] : [];
|
|
15971
15954
|
try {
|
|
15972
|
-
const containerId =
|
|
15955
|
+
const containerId = execFileSync32(runtime, [
|
|
15973
15956
|
"run",
|
|
15974
15957
|
"-d",
|
|
15975
15958
|
"--name",
|
|
@@ -15988,7 +15971,7 @@ var init_inference_start2 = __esm({
|
|
|
15988
15971
|
for (let i = 0; i < maxAttempts; i++) {
|
|
15989
15972
|
await new Promise((resolve10) => setTimeout(resolve10, 1e3));
|
|
15990
15973
|
try {
|
|
15991
|
-
const status =
|
|
15974
|
+
const status = execFileSync32(
|
|
15992
15975
|
runtime,
|
|
15993
15976
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15994
15977
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -16008,7 +15991,7 @@ var init_inference_start2 = __esm({
|
|
|
16008
15991
|
}
|
|
16009
15992
|
if (!ready) {
|
|
16010
15993
|
try {
|
|
16011
|
-
|
|
15994
|
+
execFileSync32(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
16012
15995
|
} catch {
|
|
16013
15996
|
}
|
|
16014
15997
|
return {
|
|
@@ -16070,7 +16053,7 @@ var init_inference_start2 = __esm({
|
|
|
16070
16053
|
});
|
|
16071
16054
|
|
|
16072
16055
|
// src/platforms/container/handlers/inference-stop.ts
|
|
16073
|
-
import { execFileSync as
|
|
16056
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
16074
16057
|
var stopInference2, preflightInferenceStop, inferenceStopDescriptor2;
|
|
16075
16058
|
var init_inference_stop2 = __esm({
|
|
16076
16059
|
"src/platforms/container/handlers/inference-stop.ts"() {
|
|
@@ -16080,7 +16063,7 @@ var init_inference_stop2 = __esm({
|
|
|
16080
16063
|
stopInference2 = async (context) => {
|
|
16081
16064
|
const { service, runtime, options, containerName } = context;
|
|
16082
16065
|
try {
|
|
16083
|
-
const output =
|
|
16066
|
+
const output = execFileSync33(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
16084
16067
|
if (!output.includes(containerName)) {
|
|
16085
16068
|
if (!service.quiet) {
|
|
16086
16069
|
printWarning("Ollama container is not running");
|
|
@@ -16103,17 +16086,17 @@ var init_inference_stop2 = __esm({
|
|
|
16103
16086
|
if (!service.quiet) {
|
|
16104
16087
|
printInfo("Force stopping Ollama container...");
|
|
16105
16088
|
}
|
|
16106
|
-
|
|
16089
|
+
execFileSync33(runtime, ["rm", "-f", containerName], {
|
|
16107
16090
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16108
16091
|
});
|
|
16109
16092
|
} else {
|
|
16110
16093
|
if (!service.quiet) {
|
|
16111
16094
|
printInfo(`Stopping Ollama container gracefully (timeout: ${options.timeout}s)...`);
|
|
16112
16095
|
}
|
|
16113
|
-
|
|
16096
|
+
execFileSync33(runtime, ["stop", "-t", options.timeout.toString(), containerName], {
|
|
16114
16097
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16115
16098
|
});
|
|
16116
|
-
|
|
16099
|
+
execFileSync33(runtime, ["rm", containerName], {
|
|
16117
16100
|
stdio: "ignore"
|
|
16118
16101
|
});
|
|
16119
16102
|
}
|
|
@@ -16153,10 +16136,10 @@ var init_inference_stop2 = __esm({
|
|
|
16153
16136
|
});
|
|
16154
16137
|
|
|
16155
16138
|
// src/platforms/container/handlers/inference-provision.ts
|
|
16156
|
-
import { execFileSync as
|
|
16139
|
+
import { execFileSync as execFileSync34 } from "child_process";
|
|
16157
16140
|
function detectGpu2(runtime) {
|
|
16158
16141
|
try {
|
|
16159
|
-
const output =
|
|
16142
|
+
const output = execFileSync34(runtime, ["info", "--format", "{{.Runtimes}}"], {
|
|
16160
16143
|
encoding: "utf-8",
|
|
16161
16144
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16162
16145
|
}).trim();
|
|
@@ -16166,7 +16149,7 @@ function detectGpu2(runtime) {
|
|
|
16166
16149
|
} catch {
|
|
16167
16150
|
}
|
|
16168
16151
|
try {
|
|
16169
|
-
const gpuName =
|
|
16152
|
+
const gpuName = execFileSync34("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
16170
16153
|
encoding: "utf-8",
|
|
16171
16154
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16172
16155
|
}).trim();
|
|
@@ -16201,7 +16184,7 @@ var init_inference_provision2 = __esm({
|
|
|
16201
16184
|
printInfo(`Pulling ${image}...`);
|
|
16202
16185
|
}
|
|
16203
16186
|
try {
|
|
16204
|
-
|
|
16187
|
+
execFileSync34(runtime, ["pull", image], {
|
|
16205
16188
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16206
16189
|
});
|
|
16207
16190
|
} catch (error) {
|
|
@@ -16212,7 +16195,7 @@ var init_inference_provision2 = __esm({
|
|
|
16212
16195
|
};
|
|
16213
16196
|
}
|
|
16214
16197
|
try {
|
|
16215
|
-
|
|
16198
|
+
execFileSync34(runtime, ["volume", "create", VOLUME_NAME2], {
|
|
16216
16199
|
stdio: "ignore"
|
|
16217
16200
|
});
|
|
16218
16201
|
} catch {
|
|
@@ -16223,7 +16206,7 @@ var init_inference_provision2 = __esm({
|
|
|
16223
16206
|
printInfo(`Pulling model ${model} (this may take several minutes)...`);
|
|
16224
16207
|
}
|
|
16225
16208
|
try {
|
|
16226
|
-
|
|
16209
|
+
execFileSync34(runtime, [
|
|
16227
16210
|
"run",
|
|
16228
16211
|
"--rm",
|
|
16229
16212
|
"-v",
|
|
@@ -16343,7 +16326,7 @@ var init_handlers2 = __esm({
|
|
|
16343
16326
|
});
|
|
16344
16327
|
|
|
16345
16328
|
// src/platforms/container/platform.ts
|
|
16346
|
-
import { execFileSync as
|
|
16329
|
+
import { execFileSync as execFileSync35 } from "child_process";
|
|
16347
16330
|
var ContainerPlatform;
|
|
16348
16331
|
var init_platform3 = __esm({
|
|
16349
16332
|
"src/platforms/container/platform.ts"() {
|
|
@@ -16371,11 +16354,11 @@ var init_platform3 = __esm({
|
|
|
16371
16354
|
*/
|
|
16372
16355
|
detectContainerRuntime() {
|
|
16373
16356
|
try {
|
|
16374
|
-
|
|
16357
|
+
execFileSync35("docker", ["--version"], { stdio: "ignore" });
|
|
16375
16358
|
return "docker";
|
|
16376
16359
|
} catch {
|
|
16377
16360
|
try {
|
|
16378
|
-
|
|
16361
|
+
execFileSync35("podman", ["--version"], { stdio: "ignore" });
|
|
16379
16362
|
return "podman";
|
|
16380
16363
|
} catch {
|
|
16381
16364
|
throw new Error("No container runtime (Docker or Podman) found");
|
|
@@ -16401,7 +16384,7 @@ var init_platform3 = __esm({
|
|
|
16401
16384
|
return false;
|
|
16402
16385
|
}
|
|
16403
16386
|
try {
|
|
16404
|
-
const status =
|
|
16387
|
+
const status = execFileSync35(
|
|
16405
16388
|
this.runtime,
|
|
16406
16389
|
["inspect", containerId, "--format", "{{.State.Status}}"],
|
|
16407
16390
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -16463,7 +16446,7 @@ var init_platform3 = __esm({
|
|
|
16463
16446
|
if (since) {
|
|
16464
16447
|
args.push("--since", since.toISOString());
|
|
16465
16448
|
}
|
|
16466
|
-
const output =
|
|
16449
|
+
const output = execFileSync35(this.runtime, args, {
|
|
16467
16450
|
encoding: "utf-8",
|
|
16468
16451
|
stdio: ["ignore", "pipe", "pipe"]
|
|
16469
16452
|
// Capture both stdout and stderr
|
|
@@ -16681,7 +16664,7 @@ var init_lambda_check = __esm({
|
|
|
16681
16664
|
});
|
|
16682
16665
|
|
|
16683
16666
|
// src/platforms/aws/handlers/ecs-check.ts
|
|
16684
|
-
import { execFileSync as
|
|
16667
|
+
import { execFileSync as execFileSync36 } from "child_process";
|
|
16685
16668
|
import { DescribeServicesCommand } from "@aws-sdk/client-ecs";
|
|
16686
16669
|
import { DescribeTargetHealthCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
16687
16670
|
import { FilterLogEventsCommand as FilterLogEventsCommand2 } from "@aws-sdk/client-cloudwatch-logs";
|
|
@@ -16733,7 +16716,7 @@ var init_ecs_check = __esm({
|
|
|
16733
16716
|
let imageTag = "unknown";
|
|
16734
16717
|
if (activeDeployment?.taskDefinition) {
|
|
16735
16718
|
try {
|
|
16736
|
-
const taskDefJson =
|
|
16719
|
+
const taskDefJson = execFileSync36("aws", [
|
|
16737
16720
|
"ecs",
|
|
16738
16721
|
"describe-task-definition",
|
|
16739
16722
|
"--task-definition",
|
|
@@ -16992,10 +16975,10 @@ var init_rds_check = __esm({
|
|
|
16992
16975
|
});
|
|
16993
16976
|
|
|
16994
16977
|
// src/platforms/aws/handlers/s3-cloudfront-check.ts
|
|
16995
|
-
import { execFileSync as
|
|
16978
|
+
import { execFileSync as execFileSync37 } from "child_process";
|
|
16996
16979
|
async function getCloudFrontDistribution(bucketName, region) {
|
|
16997
16980
|
try {
|
|
16998
|
-
const distributionId =
|
|
16981
|
+
const distributionId = execFileSync37("aws", [
|
|
16999
16982
|
"cloudfront",
|
|
17000
16983
|
"list-distributions",
|
|
17001
16984
|
"--query",
|
|
@@ -17012,7 +16995,7 @@ async function getCloudFrontDistribution(bucketName, region) {
|
|
|
17012
16995
|
}
|
|
17013
16996
|
async function getCloudFrontStatus(distributionId, region) {
|
|
17014
16997
|
try {
|
|
17015
|
-
const status =
|
|
16998
|
+
const status = execFileSync37("aws", [
|
|
17016
16999
|
"cloudfront",
|
|
17017
17000
|
"get-distribution",
|
|
17018
17001
|
"--id",
|
|
@@ -17039,7 +17022,7 @@ var init_s3_cloudfront_check = __esm({
|
|
|
17039
17022
|
const { service, region, resourceName } = context;
|
|
17040
17023
|
const bucketName = `${resourceName}-static`;
|
|
17041
17024
|
try {
|
|
17042
|
-
|
|
17025
|
+
execFileSync37("aws", ["s3api", "head-bucket", "--bucket", bucketName, "--region", region], {
|
|
17043
17026
|
stdio: ["pipe", "pipe", "ignore"]
|
|
17044
17027
|
});
|
|
17045
17028
|
const status = "running";
|
|
@@ -17274,7 +17257,7 @@ var init_neptune_check = __esm({
|
|
|
17274
17257
|
});
|
|
17275
17258
|
|
|
17276
17259
|
// src/platforms/aws/handlers/ecs-start.ts
|
|
17277
|
-
import { execFileSync as
|
|
17260
|
+
import { execFileSync as execFileSync38 } from "child_process";
|
|
17278
17261
|
var startECSService, preflightEcsStart, ecsFargateStartDescriptor, ecsStartDescriptor;
|
|
17279
17262
|
var init_ecs_start = __esm({
|
|
17280
17263
|
"src/platforms/aws/handlers/ecs-start.ts"() {
|
|
@@ -17289,7 +17272,7 @@ var init_ecs_start = __esm({
|
|
|
17289
17272
|
const serviceName = cfnDiscoveredResources?.serviceName || resourceName;
|
|
17290
17273
|
const desiredCount = requirements.resources?.replicas || 1;
|
|
17291
17274
|
try {
|
|
17292
|
-
|
|
17275
|
+
execFileSync38("aws", [
|
|
17293
17276
|
"ecs",
|
|
17294
17277
|
"update-service",
|
|
17295
17278
|
"--cluster",
|
|
@@ -17304,7 +17287,7 @@ var init_ecs_start = __esm({
|
|
|
17304
17287
|
let endpoint;
|
|
17305
17288
|
if (requirements.network?.needsLoadBalancer) {
|
|
17306
17289
|
try {
|
|
17307
|
-
const albDns =
|
|
17290
|
+
const albDns = execFileSync38("aws", [
|
|
17308
17291
|
"elbv2",
|
|
17309
17292
|
"describe-load-balancers",
|
|
17310
17293
|
"--names",
|
|
@@ -17376,7 +17359,7 @@ var init_ecs_start = __esm({
|
|
|
17376
17359
|
});
|
|
17377
17360
|
|
|
17378
17361
|
// src/platforms/aws/handlers/rds-start.ts
|
|
17379
|
-
import { execFileSync as
|
|
17362
|
+
import { execFileSync as execFileSync39 } from "child_process";
|
|
17380
17363
|
var startRDSInstance, preflightRdsStart, rdsStartDescriptor;
|
|
17381
17364
|
var init_rds_start = __esm({
|
|
17382
17365
|
"src/platforms/aws/handlers/rds-start.ts"() {
|
|
@@ -17389,7 +17372,7 @@ var init_rds_start = __esm({
|
|
|
17389
17372
|
const resourceName = `semiont-${service.name}-${service.environment}`;
|
|
17390
17373
|
const instanceId = `${resourceName}-db`;
|
|
17391
17374
|
try {
|
|
17392
|
-
|
|
17375
|
+
execFileSync39("aws", ["rds", "start-db-instance", "--db-instance-identifier", instanceId, "--region", region], {
|
|
17393
17376
|
encoding: "utf-8"
|
|
17394
17377
|
});
|
|
17395
17378
|
if (!service.quiet) {
|
|
@@ -17397,7 +17380,7 @@ var init_rds_start = __esm({
|
|
|
17397
17380
|
}
|
|
17398
17381
|
let endpoint;
|
|
17399
17382
|
try {
|
|
17400
|
-
endpoint =
|
|
17383
|
+
endpoint = execFileSync39("aws", [
|
|
17401
17384
|
"rds",
|
|
17402
17385
|
"describe-db-instances",
|
|
17403
17386
|
"--db-instance-identifier",
|
|
@@ -17631,7 +17614,7 @@ var init_stack_provision = __esm({
|
|
|
17631
17614
|
});
|
|
17632
17615
|
|
|
17633
17616
|
// src/platforms/aws/handlers/ecs-publish.ts
|
|
17634
|
-
import { execFileSync as
|
|
17617
|
+
import { execFileSync as execFileSync40, spawnSync as spawnSync3 } from "child_process";
|
|
17635
17618
|
import * as path33 from "path";
|
|
17636
17619
|
import * as fs40 from "fs";
|
|
17637
17620
|
async function createNewTaskDefinition(service, imageUri, region, _accountId, cfnDiscoveredResources, resourceName) {
|
|
@@ -17643,7 +17626,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17643
17626
|
console.warn(` \u26A0\uFE0F Could not find ECS service name for ${service.name}`);
|
|
17644
17627
|
return "";
|
|
17645
17628
|
}
|
|
17646
|
-
const serviceJson =
|
|
17629
|
+
const serviceJson = execFileSync40("aws", [
|
|
17647
17630
|
"ecs",
|
|
17648
17631
|
"describe-services",
|
|
17649
17632
|
"--cluster",
|
|
@@ -17661,7 +17644,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17661
17644
|
console.warn(` \u26A0\uFE0F Could not find task definition for ${serviceName}`);
|
|
17662
17645
|
return "";
|
|
17663
17646
|
}
|
|
17664
|
-
const taskDefJson =
|
|
17647
|
+
const taskDefJson = execFileSync40("aws", [
|
|
17665
17648
|
"ecs",
|
|
17666
17649
|
"describe-task-definition",
|
|
17667
17650
|
"--task-definition",
|
|
@@ -17692,7 +17675,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17692
17675
|
memory: taskDef.memory,
|
|
17693
17676
|
runtimePlatform: taskDef.runtimePlatform
|
|
17694
17677
|
};
|
|
17695
|
-
const registerOutput =
|
|
17678
|
+
const registerOutput = execFileSync40("aws", [
|
|
17696
17679
|
"ecs",
|
|
17697
17680
|
"register-task-definition",
|
|
17698
17681
|
"--cli-input-json",
|
|
@@ -17732,7 +17715,7 @@ var init_ecs_publish = __esm({
|
|
|
17732
17715
|
const deploymentStrategy = envConfig.deployment?.imageTagStrategy || "mutable";
|
|
17733
17716
|
if (deploymentStrategy === "immutable" || deploymentStrategy === "git-hash") {
|
|
17734
17717
|
try {
|
|
17735
|
-
const gitHash =
|
|
17718
|
+
const gitHash = execFileSync40("git", ["rev-parse", "--short", "HEAD"], {
|
|
17736
17719
|
encoding: "utf-8",
|
|
17737
17720
|
cwd: service.projectRoot
|
|
17738
17721
|
}).trim();
|
|
@@ -17752,7 +17735,7 @@ var init_ecs_publish = __esm({
|
|
|
17752
17735
|
const ecrRepo = `semiont-${service.name}`;
|
|
17753
17736
|
const imageUri = `${accountId}.dkr.ecr.${region}.amazonaws.com/${ecrRepo}:${version}`;
|
|
17754
17737
|
try {
|
|
17755
|
-
|
|
17738
|
+
execFileSync40("aws", ["ecr", "create-repository", "--repository-name", ecrRepo, "--region", region]);
|
|
17756
17739
|
} catch {
|
|
17757
17740
|
}
|
|
17758
17741
|
if (service.verbose) {
|
|
@@ -17791,7 +17774,7 @@ var init_ecs_publish = __esm({
|
|
|
17791
17774
|
try {
|
|
17792
17775
|
const apiTypesPath = path33.join(buildContext, "packages", "api-types");
|
|
17793
17776
|
if (fs40.existsSync(apiTypesPath)) {
|
|
17794
|
-
|
|
17777
|
+
execFileSync40("npm", ["run", "build"], {
|
|
17795
17778
|
cwd: apiTypesPath,
|
|
17796
17779
|
env: buildEnv,
|
|
17797
17780
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -17799,7 +17782,7 @@ var init_ecs_publish = __esm({
|
|
|
17799
17782
|
}
|
|
17800
17783
|
const appPath = path33.join(buildContext, "apps", service.name);
|
|
17801
17784
|
if (fs40.existsSync(appPath)) {
|
|
17802
|
-
|
|
17785
|
+
execFileSync40("npm", ["run", "build"], {
|
|
17803
17786
|
cwd: appPath,
|
|
17804
17787
|
env: buildEnv,
|
|
17805
17788
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -17815,7 +17798,7 @@ var init_ecs_publish = __esm({
|
|
|
17815
17798
|
};
|
|
17816
17799
|
}
|
|
17817
17800
|
try {
|
|
17818
|
-
const ecrPassword =
|
|
17801
|
+
const ecrPassword = execFileSync40("aws", [
|
|
17819
17802
|
"ecr",
|
|
17820
17803
|
"get-login-password",
|
|
17821
17804
|
"--region",
|
|
@@ -17843,8 +17826,8 @@ var init_ecs_publish = __esm({
|
|
|
17843
17826
|
if (service.verbose) {
|
|
17844
17827
|
console.log(`[DEBUG] Docker build args: ${dockerBuildArgs.join(" ")}`);
|
|
17845
17828
|
}
|
|
17846
|
-
|
|
17847
|
-
|
|
17829
|
+
execFileSync40("docker", dockerBuildArgs, { stdio: service.verbose ? "inherit" : "pipe" });
|
|
17830
|
+
execFileSync40("docker", ["push", imageUri], { stdio: service.verbose ? "inherit" : "pipe" });
|
|
17848
17831
|
artifacts.imageTag = version;
|
|
17849
17832
|
artifacts.imageUrl = imageUri;
|
|
17850
17833
|
const newTaskDefRevision = await createNewTaskDefinition(service, imageUri, region, accountId, cfnDiscoveredResources, resourceName);
|
|
@@ -17911,10 +17894,10 @@ var init_ecs_publish = __esm({
|
|
|
17911
17894
|
});
|
|
17912
17895
|
|
|
17913
17896
|
// src/platforms/aws/handlers/ecs-update.ts
|
|
17914
|
-
import { execFileSync as
|
|
17897
|
+
import { execFileSync as execFileSync41 } from "child_process";
|
|
17915
17898
|
async function getCurrentTaskDefinition(cluster, service, region) {
|
|
17916
17899
|
try {
|
|
17917
|
-
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();
|
|
17918
17901
|
return taskDef.split(":").pop() || "";
|
|
17919
17902
|
} catch {
|
|
17920
17903
|
return "";
|
|
@@ -17922,7 +17905,7 @@ async function getCurrentTaskDefinition(cluster, service, region) {
|
|
|
17922
17905
|
}
|
|
17923
17906
|
async function getTaskDefinitionFamily(cluster, service, region) {
|
|
17924
17907
|
try {
|
|
17925
|
-
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();
|
|
17926
17909
|
const parts = taskDefArn.split("/");
|
|
17927
17910
|
if (parts.length > 1) {
|
|
17928
17911
|
return parts[1].split(":")[0];
|
|
@@ -17936,7 +17919,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
17936
17919
|
try {
|
|
17937
17920
|
const family = await getTaskDefinitionFamily(cluster, service, region);
|
|
17938
17921
|
if (!family) return "";
|
|
17939
|
-
const taskDefArn =
|
|
17922
|
+
const taskDefArn = execFileSync41("aws", [
|
|
17940
17923
|
"ecs",
|
|
17941
17924
|
"list-task-definitions",
|
|
17942
17925
|
"--family-prefix",
|
|
@@ -17962,7 +17945,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
17962
17945
|
async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
17963
17946
|
try {
|
|
17964
17947
|
const taskId = taskArn.split("/").pop();
|
|
17965
|
-
const taskDetails =
|
|
17948
|
+
const taskDetails = execFileSync41("aws", [
|
|
17966
17949
|
"ecs",
|
|
17967
17950
|
"describe-tasks",
|
|
17968
17951
|
"--cluster",
|
|
@@ -17978,7 +17961,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
17978
17961
|
if (!task) {
|
|
17979
17962
|
return [];
|
|
17980
17963
|
}
|
|
17981
|
-
const taskDefDetails =
|
|
17964
|
+
const taskDefDetails = execFileSync41("aws", [
|
|
17982
17965
|
"ecs",
|
|
17983
17966
|
"describe-task-definition",
|
|
17984
17967
|
"--task-definition",
|
|
@@ -18001,7 +17984,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
18001
17984
|
}
|
|
18002
17985
|
const containerName = mainContainer.name;
|
|
18003
17986
|
const logStream = `${streamPrefix}/${containerName}/${taskId}`;
|
|
18004
|
-
const logsJson =
|
|
17987
|
+
const logsJson = execFileSync41("aws", [
|
|
18005
17988
|
"logs",
|
|
18006
17989
|
"filter-log-events",
|
|
18007
17990
|
"--log-group-name",
|
|
@@ -18036,7 +18019,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18036
18019
|
let failedTaskInfo = [];
|
|
18037
18020
|
while (Date.now() - startTime < effectiveTimeout * 1e3) {
|
|
18038
18021
|
try {
|
|
18039
|
-
const serviceData =
|
|
18022
|
+
const serviceData = execFileSync41("aws", [
|
|
18040
18023
|
"ecs",
|
|
18041
18024
|
"describe-services",
|
|
18042
18025
|
"--cluster",
|
|
@@ -18085,7 +18068,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18085
18068
|
const ourRevision = ourDeployment.taskDefinition?.split(":").pop() || "unknown";
|
|
18086
18069
|
const oldRevisions = /* @__PURE__ */ new Set();
|
|
18087
18070
|
try {
|
|
18088
|
-
const stoppedTasksData =
|
|
18071
|
+
const stoppedTasksData = execFileSync41("aws", [
|
|
18089
18072
|
"ecs",
|
|
18090
18073
|
"list-tasks",
|
|
18091
18074
|
"--cluster",
|
|
@@ -18101,7 +18084,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18101
18084
|
], { encoding: "utf-8" });
|
|
18102
18085
|
const stoppedTaskArns = JSON.parse(stoppedTasksData).taskArns || [];
|
|
18103
18086
|
if (stoppedTaskArns.length > 0) {
|
|
18104
|
-
const stoppedTasksJson =
|
|
18087
|
+
const stoppedTasksJson = execFileSync41("aws", [
|
|
18105
18088
|
"ecs",
|
|
18106
18089
|
"describe-tasks",
|
|
18107
18090
|
"--cluster",
|
|
@@ -18190,7 +18173,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18190
18173
|
}
|
|
18191
18174
|
}
|
|
18192
18175
|
try {
|
|
18193
|
-
const tasksData =
|
|
18176
|
+
const tasksData = execFileSync41("aws", [
|
|
18194
18177
|
"ecs",
|
|
18195
18178
|
"list-tasks",
|
|
18196
18179
|
"--cluster",
|
|
@@ -18206,7 +18189,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18206
18189
|
], { encoding: "utf-8" });
|
|
18207
18190
|
const taskArns = JSON.parse(tasksData).taskArns || [];
|
|
18208
18191
|
if (taskArns.length > 0) {
|
|
18209
|
-
const taskDetailsJson =
|
|
18192
|
+
const taskDetailsJson = execFileSync41("aws", [
|
|
18210
18193
|
"ecs",
|
|
18211
18194
|
"describe-tasks",
|
|
18212
18195
|
"--cluster",
|
|
@@ -18425,13 +18408,13 @@ var init_ecs_update = __esm({
|
|
|
18425
18408
|
printInfo(`No newer task definition found. Forcing redeployment of current revision ${currentRevision}`);
|
|
18426
18409
|
}
|
|
18427
18410
|
}
|
|
18428
|
-
const updateResult =
|
|
18411
|
+
const updateResult = execFileSync41("aws", updateArgs, { encoding: "utf-8" });
|
|
18429
18412
|
if (service.verbose) {
|
|
18430
18413
|
try {
|
|
18431
|
-
const serviceData =
|
|
18414
|
+
const serviceData = execFileSync41("aws", ["ecs", "describe-services", "--cluster", clusterName, "--services", serviceName, "--region", region, "--output", "json"], { encoding: "utf-8" });
|
|
18432
18415
|
const ecsService = JSON.parse(serviceData).services?.[0];
|
|
18433
18416
|
if (ecsService?.taskDefinition) {
|
|
18434
|
-
const currentTaskDef =
|
|
18417
|
+
const currentTaskDef = execFileSync41("aws", ["ecs", "describe-task-definition", "--task-definition", ecsService.taskDefinition, "--region", region, "--output", "json"], { encoding: "utf-8" });
|
|
18435
18418
|
const taskDef = JSON.parse(currentTaskDef).taskDefinition;
|
|
18436
18419
|
const images = taskDef.containerDefinitions?.map((c) => c.image).filter(Boolean);
|
|
18437
18420
|
if (images?.length > 0) {
|
|
@@ -18559,10 +18542,10 @@ __export(credential_validator_exports, {
|
|
|
18559
18542
|
isAWSCliInstalled: () => isAWSCliInstalled,
|
|
18560
18543
|
validateAWSCredentials: () => validateAWSCredentials
|
|
18561
18544
|
});
|
|
18562
|
-
import { execFileSync as
|
|
18545
|
+
import { execFileSync as execFileSync42 } from "child_process";
|
|
18563
18546
|
async function validateAWSCredentials(_environment) {
|
|
18564
18547
|
try {
|
|
18565
|
-
const output =
|
|
18548
|
+
const output = execFileSync42("aws", ["sts", "get-caller-identity", "--output", "json"], {
|
|
18566
18549
|
stdio: ["pipe", "pipe", "pipe"],
|
|
18567
18550
|
encoding: "utf8",
|
|
18568
18551
|
env: {
|
|
@@ -18605,7 +18588,7 @@ async function validateAWSCredentials(_environment) {
|
|
|
18605
18588
|
}
|
|
18606
18589
|
function isAWSCliInstalled() {
|
|
18607
18590
|
try {
|
|
18608
|
-
|
|
18591
|
+
execFileSync42("aws", ["--version"], { stdio: "ignore" });
|
|
18609
18592
|
return true;
|
|
18610
18593
|
} catch {
|
|
18611
18594
|
return false;
|
|
@@ -18613,7 +18596,7 @@ function isAWSCliInstalled() {
|
|
|
18613
18596
|
}
|
|
18614
18597
|
function getAWSProfiles() {
|
|
18615
18598
|
try {
|
|
18616
|
-
const output =
|
|
18599
|
+
const output = execFileSync42("aws", ["configure", "list-profiles"], {
|
|
18617
18600
|
stdio: "pipe",
|
|
18618
18601
|
encoding: "utf8"
|
|
18619
18602
|
});
|
|
@@ -25482,7 +25465,7 @@ var init_multi_service_executor = __esm({
|
|
|
25482
25465
|
try {
|
|
25483
25466
|
const result = await this.executeService(serviceInfo, finalOptions, envConfig);
|
|
25484
25467
|
results.push(result);
|
|
25485
|
-
if (!isStructuredOutput && !finalOptions.quiet && !result.success) {
|
|
25468
|
+
if (!isStructuredOutput && !finalOptions.quiet && !result.success && result.error) {
|
|
25486
25469
|
printError(`Failed to ${this.descriptor.name} ${serviceInfo.name}: ${result.error}`);
|
|
25487
25470
|
}
|
|
25488
25471
|
} catch (error) {
|
|
@@ -25890,10 +25873,11 @@ var init_check = __esm({
|
|
|
25890
25873
|
}),
|
|
25891
25874
|
buildResult: (handlerResult, service, platform, serviceType) => {
|
|
25892
25875
|
const checkResult = handlerResult;
|
|
25876
|
+
const isHealthy = handlerResult.success && checkResult.health?.healthy === true;
|
|
25893
25877
|
return createCommandResult({
|
|
25894
25878
|
entity: service.name,
|
|
25895
25879
|
platform: platform.getPlatformName(),
|
|
25896
|
-
success:
|
|
25880
|
+
success: isHealthy,
|
|
25897
25881
|
error: handlerResult.error,
|
|
25898
25882
|
metadata: {
|
|
25899
25883
|
...handlerResult.metadata,
|
|
@@ -27029,7 +27013,7 @@ var require_package = __commonJS({
|
|
|
27029
27013
|
"package.json"(exports, module) {
|
|
27030
27014
|
module.exports = {
|
|
27031
27015
|
name: "@semiont/cli",
|
|
27032
|
-
version: "0.4.
|
|
27016
|
+
version: "0.4.6",
|
|
27033
27017
|
description: "Semiont CLI - Unified environment management tool",
|
|
27034
27018
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
27035
27019
|
type: "module",
|
|
@@ -27093,12 +27077,12 @@ var require_package = __commonJS({
|
|
|
27093
27077
|
"@aws-sdk/client-secrets-manager": "^3.600.0",
|
|
27094
27078
|
"@aws-sdk/client-sts": "^3.859.0",
|
|
27095
27079
|
"@aws-sdk/client-wafv2": "^3.859.0",
|
|
27096
|
-
"@semiont/api-client": "^0.4.
|
|
27097
|
-
"@semiont/content": "^0.4.
|
|
27098
|
-
"@semiont/core": "^0.4.
|
|
27099
|
-
"@semiont/event-sourcing": "^0.4.
|
|
27100
|
-
"@semiont/graph": "^0.4.
|
|
27101
|
-
"@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",
|
|
27102
27086
|
arg: "^5.0.2",
|
|
27103
27087
|
argon2: "^0.44.0",
|
|
27104
27088
|
express: "^5.2.1",
|
|
@@ -27516,7 +27500,7 @@ init_base_options_schema();
|
|
|
27516
27500
|
var StopOptionsSchema = OpsOptionsSchema.extend({
|
|
27517
27501
|
service: external_exports.string().optional(),
|
|
27518
27502
|
force: external_exports.boolean().default(false).describe("Force stop without graceful shutdown"),
|
|
27519
|
-
timeout: external_exports.number().default(
|
|
27503
|
+
timeout: external_exports.number().default(3).describe("Timeout for graceful shutdown in seconds")
|
|
27520
27504
|
});
|
|
27521
27505
|
var stopDescriptor = createCommandDescriptor({
|
|
27522
27506
|
name: "stop",
|
|
@@ -27667,6 +27651,7 @@ var provisionDescriptor = createCommandDescriptor({
|
|
|
27667
27651
|
serviceType
|
|
27668
27652
|
}
|
|
27669
27653
|
}, {
|
|
27654
|
+
status: handlerResult.success ? "provisioned" : "unknown",
|
|
27670
27655
|
provisionedResources: provisionResult.provisionedResources,
|
|
27671
27656
|
stackOutputs: provisionResult.stackOutputs,
|
|
27672
27657
|
resources: provisionResult.resources
|
|
@@ -29050,7 +29035,7 @@ init_base_options_schema();
|
|
|
29050
29035
|
import * as fs49 from "fs";
|
|
29051
29036
|
import * as path42 from "path";
|
|
29052
29037
|
import * as readline2 from "readline";
|
|
29053
|
-
import { execFileSync as
|
|
29038
|
+
import { execFileSync as execFileSync43 } from "child_process";
|
|
29054
29039
|
var LocalOptionsSchema = OpsOptionsSchema.extend({
|
|
29055
29040
|
directory: external_exports.string().optional(),
|
|
29056
29041
|
yes: external_exports.boolean().default(false)
|
|
@@ -29068,7 +29053,7 @@ function prompt2(question) {
|
|
|
29068
29053
|
});
|
|
29069
29054
|
}
|
|
29070
29055
|
function runSemiont(args, env, captureOutput = false) {
|
|
29071
|
-
return
|
|
29056
|
+
return execFileSync43("semiont", args, {
|
|
29072
29057
|
env,
|
|
29073
29058
|
stdio: captureOutput ? "pipe" : "inherit",
|
|
29074
29059
|
encoding: "utf8"
|
|
@@ -29076,7 +29061,7 @@ function runSemiont(args, env, captureOutput = false) {
|
|
|
29076
29061
|
}
|
|
29077
29062
|
function runSemiontSafe(args, env) {
|
|
29078
29063
|
try {
|
|
29079
|
-
const output =
|
|
29064
|
+
const output = execFileSync43("semiont", args, {
|
|
29080
29065
|
env,
|
|
29081
29066
|
stdio: "pipe",
|
|
29082
29067
|
encoding: "utf8"
|
|
@@ -29347,7 +29332,7 @@ init_command_definition();
|
|
|
29347
29332
|
init_base_options_schema();
|
|
29348
29333
|
import * as fs50 from "fs";
|
|
29349
29334
|
import * as readline3 from "readline";
|
|
29350
|
-
import { execFileSync as
|
|
29335
|
+
import { execFileSync as execFileSync44 } from "child_process";
|
|
29351
29336
|
import { SemiontProject as SemiontProject20 } from "@semiont/core/node";
|
|
29352
29337
|
var CleanOptionsSchema = OpsOptionsSchema.extend({
|
|
29353
29338
|
force: external_exports.boolean().default(false),
|
|
@@ -29400,7 +29385,7 @@ function listDir(dir) {
|
|
|
29400
29385
|
function containerRuntime() {
|
|
29401
29386
|
for (const rt of ["docker", "podman"]) {
|
|
29402
29387
|
try {
|
|
29403
|
-
|
|
29388
|
+
execFileSync44(rt, ["info"], { stdio: "ignore" });
|
|
29404
29389
|
return rt;
|
|
29405
29390
|
} catch {
|
|
29406
29391
|
}
|
|
@@ -29493,9 +29478,9 @@ async function clean(options) {
|
|
|
29493
29478
|
for (const svc of ["database", "graph", "inference"]) {
|
|
29494
29479
|
const volName = `semiont-${svc}-${env}-data`;
|
|
29495
29480
|
try {
|
|
29496
|
-
|
|
29481
|
+
execFileSync44(runtime, ["volume", "inspect", volName], { stdio: "ignore" });
|
|
29497
29482
|
if (!options.dryRun) {
|
|
29498
|
-
|
|
29483
|
+
execFileSync44(runtime, ["volume", "rm", volName], { stdio: "pipe" });
|
|
29499
29484
|
}
|
|
29500
29485
|
removed.push(volName);
|
|
29501
29486
|
} catch {
|
|
@@ -29503,9 +29488,9 @@ async function clean(options) {
|
|
|
29503
29488
|
}
|
|
29504
29489
|
const netName = `semiont-${env}`;
|
|
29505
29490
|
try {
|
|
29506
|
-
|
|
29491
|
+
execFileSync44(runtime, ["network", "inspect", netName], { stdio: "ignore" });
|
|
29507
29492
|
if (!options.dryRun) {
|
|
29508
|
-
|
|
29493
|
+
execFileSync44(runtime, ["network", "rm", netName], { stdio: "pipe" });
|
|
29509
29494
|
}
|
|
29510
29495
|
removed.push(`network: ${netName}`);
|
|
29511
29496
|
} catch {
|
|
@@ -31773,7 +31758,7 @@ var OutputFormatter = class {
|
|
|
31773
31758
|
if (!result.success) {
|
|
31774
31759
|
statusIndicator = "[FAIL]";
|
|
31775
31760
|
statusColor = c.red;
|
|
31776
|
-
} else if (status === "running" || status === "healthy") {
|
|
31761
|
+
} else if (status === "running" || status === "healthy" || status === "provisioned") {
|
|
31777
31762
|
statusIndicator = "[OK]";
|
|
31778
31763
|
statusColor = c.green;
|
|
31779
31764
|
} else if (status === "stopped") {
|
|
@@ -31915,7 +31900,7 @@ var OutputFormatter = class {
|
|
|
31915
31900
|
const status = result.extensions?.status || result.status || "unknown";
|
|
31916
31901
|
if (!result.success) {
|
|
31917
31902
|
statusText = `${c.red}[FAIL]${c.reset} ${status}`;
|
|
31918
|
-
} else if (status === "running" || status === "healthy") {
|
|
31903
|
+
} else if (status === "running" || status === "healthy" || status === "provisioned") {
|
|
31919
31904
|
statusText = `${c.green}[OK]${c.reset} ${status}`;
|
|
31920
31905
|
} else if (status === "stopped") {
|
|
31921
31906
|
statusText = `${c.yellow}[--]${c.reset} ${status}`;
|
|
@@ -32308,7 +32293,7 @@ async function generateGlobalHelp() {
|
|
|
32308
32293
|
}
|
|
32309
32294
|
|
|
32310
32295
|
// src/cli.ts
|
|
32311
|
-
var VERSION2 = "0.4.
|
|
32296
|
+
var VERSION2 = "0.4.6";
|
|
32312
32297
|
function printVersion() {
|
|
32313
32298
|
console.log(`Semiont CLI v${VERSION2}`);
|
|
32314
32299
|
}
|