@semiont/cli 0.4.0 → 0.4.1
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 +273 -340
- package/package.json +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -6969,11 +6969,11 @@ var init_backend_check = __esm({
|
|
|
6969
6969
|
let logs;
|
|
6970
6970
|
if (fs10.existsSync(appLogPath)) {
|
|
6971
6971
|
try {
|
|
6972
|
-
const { execFileSync:
|
|
6973
|
-
const recentLogs =
|
|
6972
|
+
const { execFileSync: execFileSync43 } = __require("child_process");
|
|
6973
|
+
const recentLogs = execFileSync43("tail", ["-10", appLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
6974
6974
|
let errorLogs = [];
|
|
6975
6975
|
if (fs10.existsSync(errorLogPath)) {
|
|
6976
|
-
errorLogs =
|
|
6976
|
+
errorLogs = execFileSync43("tail", ["-5", errorLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
6977
6977
|
}
|
|
6978
6978
|
logs = {
|
|
6979
6979
|
recent: recentLogs,
|
|
@@ -7064,7 +7064,7 @@ var init_frontend_check = __esm({
|
|
|
7064
7064
|
const config = service.config;
|
|
7065
7065
|
const projectRoot = service.projectRoot;
|
|
7066
7066
|
const npmDir = resolveFrontendNpmPackage(projectRoot);
|
|
7067
|
-
const serverScript = npmDir ? path12.join(npmDir, "
|
|
7067
|
+
const serverScript = npmDir ? path12.join(npmDir, "standalone", "apps", "frontend", "server.js") : null;
|
|
7068
7068
|
const project = new SemiontProject5(projectRoot);
|
|
7069
7069
|
const pidFile = project.frontendPidFile;
|
|
7070
7070
|
const appLogPath = project.frontendAppLogFile;
|
|
@@ -7169,11 +7169,11 @@ var init_frontend_check = __esm({
|
|
|
7169
7169
|
let logs;
|
|
7170
7170
|
if (fs11.existsSync(appLogPath)) {
|
|
7171
7171
|
try {
|
|
7172
|
-
const { execFileSync:
|
|
7173
|
-
const recentLogs =
|
|
7172
|
+
const { execFileSync: execFileSync43 } = __require("child_process");
|
|
7173
|
+
const recentLogs = execFileSync43("tail", ["-10", appLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7174
7174
|
let errorLogs = [];
|
|
7175
7175
|
if (fs11.existsSync(errorLogPath)) {
|
|
7176
|
-
errorLogs =
|
|
7176
|
+
errorLogs = execFileSync43("tail", ["-5", errorLogPath], { encoding: "utf-8" }).split("\n").filter((line) => line.trim());
|
|
7177
7177
|
}
|
|
7178
7178
|
logs = {
|
|
7179
7179
|
recent: recentLogs,
|
|
@@ -7692,8 +7692,8 @@ async function startJanusGraph(context) {
|
|
|
7692
7692
|
for (let i = 0; i < maxAttempts; i++) {
|
|
7693
7693
|
await new Promise((resolve12) => setTimeout(resolve12, 2e3));
|
|
7694
7694
|
try {
|
|
7695
|
-
const { execFileSync:
|
|
7696
|
-
|
|
7695
|
+
const { execFileSync: execFileSync43 } = await import("child_process");
|
|
7696
|
+
execFileSync43(gremlinShellScript, ["-e", "g.V().count()"], {
|
|
7697
7697
|
stdio: "ignore",
|
|
7698
7698
|
timeout: 5e3
|
|
7699
7699
|
});
|
|
@@ -7791,7 +7791,7 @@ var init_graph_start = __esm({
|
|
|
7791
7791
|
});
|
|
7792
7792
|
|
|
7793
7793
|
// src/platforms/posix/handlers/backend-start.ts
|
|
7794
|
-
import { spawn as spawn4 } from "child_process";
|
|
7794
|
+
import { spawn as spawn4, execFileSync as execFileSync8 } from "child_process";
|
|
7795
7795
|
import * as fs16 from "fs";
|
|
7796
7796
|
import * as path16 from "path";
|
|
7797
7797
|
import { SemiontProject as SemiontProject7 } from "@semiont/core/node";
|
|
@@ -7906,6 +7906,29 @@ var init_backend_start = __esm({
|
|
|
7906
7906
|
`;
|
|
7907
7907
|
appLogStream.write(startupMessage);
|
|
7908
7908
|
errorLogStream.write(startupMessage);
|
|
7909
|
+
const packageDir = path16.dirname(path16.dirname(entryPoint));
|
|
7910
|
+
const prismaSchemaPath = path16.join(packageDir, "prisma", "schema.prisma");
|
|
7911
|
+
if (fs16.existsSync(prismaSchemaPath)) {
|
|
7912
|
+
if (!service.quiet) {
|
|
7913
|
+
printInfo("Running database migrations...");
|
|
7914
|
+
}
|
|
7915
|
+
try {
|
|
7916
|
+
execFileSync8("npx", ["prisma", "migrate", "deploy", `--schema=${prismaSchemaPath}`], {
|
|
7917
|
+
cwd: packageDir,
|
|
7918
|
+
env: { ...process.env, DATABASE_URL: databaseUrl },
|
|
7919
|
+
stdio: service.verbose ? "inherit" : "pipe"
|
|
7920
|
+
});
|
|
7921
|
+
if (!service.quiet) {
|
|
7922
|
+
printInfo("Database migrations completed");
|
|
7923
|
+
}
|
|
7924
|
+
} catch (error) {
|
|
7925
|
+
return {
|
|
7926
|
+
success: false,
|
|
7927
|
+
error: `Failed to run database migrations: ${error}`,
|
|
7928
|
+
metadata: { serviceType: "backend" }
|
|
7929
|
+
};
|
|
7930
|
+
}
|
|
7931
|
+
}
|
|
7909
7932
|
if (!service.quiet) {
|
|
7910
7933
|
printInfo(`Starting backend service ${service.name}...`);
|
|
7911
7934
|
printInfo(`Entry point: ${entryPoint}`);
|
|
@@ -8060,7 +8083,7 @@ var init_frontend_start = __esm({
|
|
|
8060
8083
|
metadata: { serviceType: "frontend" }
|
|
8061
8084
|
};
|
|
8062
8085
|
}
|
|
8063
|
-
const serverScript = path17.join(npmDir, "
|
|
8086
|
+
const serverScript = path17.join(npmDir, "standalone", "apps", "frontend", "server.js");
|
|
8064
8087
|
const project = new SemiontProject8(projectRoot);
|
|
8065
8088
|
const pidFile = project.frontendPidFile;
|
|
8066
8089
|
const logsDir = project.frontendLogsDir;
|
|
@@ -8251,7 +8274,7 @@ var init_frontend_start = __esm({
|
|
|
8251
8274
|
}
|
|
8252
8275
|
if (npmDir) {
|
|
8253
8276
|
checks.push(checkFileExists(
|
|
8254
|
-
path17.join(npmDir, "
|
|
8277
|
+
path17.join(npmDir, "standalone", "apps", "frontend", "server.js"),
|
|
8255
8278
|
"frontend server.js"
|
|
8256
8279
|
));
|
|
8257
8280
|
} else {
|
|
@@ -8583,7 +8606,7 @@ var init_mcp_provision = __esm({
|
|
|
8583
8606
|
|
|
8584
8607
|
// src/platforms/posix/handlers/graph-provision.ts
|
|
8585
8608
|
import * as fs20 from "fs/promises";
|
|
8586
|
-
import { execFileSync as
|
|
8609
|
+
import { execFileSync as execFileSync9 } from "child_process";
|
|
8587
8610
|
async function fileExists2(path46) {
|
|
8588
8611
|
try {
|
|
8589
8612
|
await fs20.access(path46);
|
|
@@ -8627,7 +8650,7 @@ var init_graph_provision = __esm({
|
|
|
8627
8650
|
dataStorageDir
|
|
8628
8651
|
} = paths;
|
|
8629
8652
|
try {
|
|
8630
|
-
|
|
8653
|
+
execFileSync9("java", ["-version"], { stdio: "ignore" });
|
|
8631
8654
|
} catch {
|
|
8632
8655
|
return {
|
|
8633
8656
|
success: false,
|
|
@@ -8640,9 +8663,9 @@ var init_graph_provision = __esm({
|
|
|
8640
8663
|
const downloadUrl = `https://github.com/JanusGraph/janusgraph/releases/download/v${janusgraphVersion}/janusgraph-${janusgraphVersion}.zip`;
|
|
8641
8664
|
if (!await fileExists2(janusgraphDir)) {
|
|
8642
8665
|
console.log(`Downloading JanusGraph ${janusgraphVersion}...`);
|
|
8643
|
-
|
|
8666
|
+
execFileSync9("curl", ["-L", "-o", zipPath, downloadUrl], { stdio: "inherit" });
|
|
8644
8667
|
console.log("Extracting JanusGraph...");
|
|
8645
|
-
|
|
8668
|
+
execFileSync9("unzip", ["-q", zipPath, "-d", dataDir], { stdio: "inherit" });
|
|
8646
8669
|
await fs20.unlink(zipPath);
|
|
8647
8670
|
}
|
|
8648
8671
|
let graphProperties = `
|
|
@@ -8771,7 +8794,7 @@ ssl: {
|
|
|
8771
8794
|
import * as fs21 from "fs";
|
|
8772
8795
|
import * as path18 from "path";
|
|
8773
8796
|
import * as crypto from "crypto";
|
|
8774
|
-
import { execFileSync as
|
|
8797
|
+
import { execFileSync as execFileSync10 } from "child_process";
|
|
8775
8798
|
import { SemiontProject as SemiontProject9 } from "@semiont/core/node";
|
|
8776
8799
|
var provisionBackendService, preflightBackendProvision, backendProvisionDescriptor;
|
|
8777
8800
|
var init_backend_provision = __esm({
|
|
@@ -8788,7 +8811,7 @@ var init_backend_provision = __esm({
|
|
|
8788
8811
|
printInfo("Installing @semiont/backend...");
|
|
8789
8812
|
}
|
|
8790
8813
|
try {
|
|
8791
|
-
|
|
8814
|
+
execFileSync10("npm", ["install", "@semiont/backend", "--prefix", projectRoot], {
|
|
8792
8815
|
cwd: projectRoot,
|
|
8793
8816
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8794
8817
|
});
|
|
@@ -8824,16 +8847,13 @@ var init_backend_provision = __esm({
|
|
|
8824
8847
|
}
|
|
8825
8848
|
const envConfig = service.environmentConfig;
|
|
8826
8849
|
const dbConfig = envConfig.services.database;
|
|
8827
|
-
const dbUser = dbConfig.user;
|
|
8828
|
-
const dbPassword = dbConfig.password;
|
|
8829
|
-
const dbName = dbConfig.name;
|
|
8830
|
-
const dbPort = dbConfig.port;
|
|
8831
|
-
const dbHost = dbConfig.host || "localhost";
|
|
8832
|
-
const databaseUrl = `postgresql://${dbUser}:${dbPassword}@${dbHost}:${dbPort}/${dbName}`;
|
|
8833
8850
|
if (!service.quiet) {
|
|
8851
|
+
const dbName = dbConfig.name;
|
|
8852
|
+
const dbHost = dbConfig.host || "localhost";
|
|
8853
|
+
const dbPort = dbConfig.port;
|
|
8834
8854
|
printInfo(`Using database configuration for environment '${service.environment}':`);
|
|
8835
8855
|
printInfo(` Database: ${dbName} on ${dbHost}:${dbPort}`);
|
|
8836
|
-
printInfo(` User: ${
|
|
8856
|
+
printInfo(` User: ${dbConfig.user}`);
|
|
8837
8857
|
}
|
|
8838
8858
|
let jwtSecret = options.rotateSecret ? void 0 : readSecret("JWT_SECRET");
|
|
8839
8859
|
if (!jwtSecret) {
|
|
@@ -8853,8 +8873,8 @@ var init_backend_provision = __esm({
|
|
|
8853
8873
|
printInfo("Generating Prisma client...");
|
|
8854
8874
|
}
|
|
8855
8875
|
try {
|
|
8856
|
-
|
|
8857
|
-
cwd:
|
|
8876
|
+
execFileSync10("npx", ["prisma", "generate", `--schema=${prismaSchemaPath}`], {
|
|
8877
|
+
cwd: packageDir,
|
|
8858
8878
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8859
8879
|
});
|
|
8860
8880
|
if (!service.quiet) {
|
|
@@ -8864,24 +8884,6 @@ var init_backend_provision = __esm({
|
|
|
8864
8884
|
printWarning(`Failed to generate Prisma client: ${error}`);
|
|
8865
8885
|
}
|
|
8866
8886
|
}
|
|
8867
|
-
if (options.migrate !== false && fs21.existsSync(prismaSchemaPath)) {
|
|
8868
|
-
if (!service.quiet) {
|
|
8869
|
-
printInfo("Running database migrations...");
|
|
8870
|
-
}
|
|
8871
|
-
try {
|
|
8872
|
-
execFileSync9("npx", ["prisma", "migrate", "deploy", `--schema=${prismaSchemaPath}`], {
|
|
8873
|
-
cwd: project.stateDir,
|
|
8874
|
-
env: { ...process.env, DATABASE_URL: databaseUrl },
|
|
8875
|
-
stdio: service.verbose ? "inherit" : "pipe"
|
|
8876
|
-
});
|
|
8877
|
-
if (!service.quiet) {
|
|
8878
|
-
printSuccess("Database migrations completed");
|
|
8879
|
-
}
|
|
8880
|
-
} catch (error) {
|
|
8881
|
-
printWarning(`Failed to run migrations: ${error}`);
|
|
8882
|
-
printInfo("You may need to run migrations manually: npx prisma migrate deploy");
|
|
8883
|
-
}
|
|
8884
|
-
}
|
|
8885
8887
|
const metadata = {
|
|
8886
8888
|
serviceType: "backend",
|
|
8887
8889
|
entryPoint,
|
|
@@ -8944,7 +8946,7 @@ var init_backend_provision = __esm({
|
|
|
8944
8946
|
import * as fs22 from "fs";
|
|
8945
8947
|
import * as path19 from "path";
|
|
8946
8948
|
import * as crypto2 from "crypto";
|
|
8947
|
-
import { execFileSync as
|
|
8949
|
+
import { execFileSync as execFileSync11 } from "child_process";
|
|
8948
8950
|
import { SemiontProject as SemiontProject10 } from "@semiont/core/node";
|
|
8949
8951
|
var provisionFrontendService, preflightFrontendProvision, frontendProvisionDescriptor;
|
|
8950
8952
|
var init_frontend_provision = __esm({
|
|
@@ -8961,7 +8963,7 @@ var init_frontend_provision = __esm({
|
|
|
8961
8963
|
printInfo("Installing @semiont/frontend...");
|
|
8962
8964
|
}
|
|
8963
8965
|
try {
|
|
8964
|
-
|
|
8966
|
+
execFileSync11("npm", ["install", "@semiont/frontend", "--prefix", projectRoot], {
|
|
8965
8967
|
cwd: projectRoot,
|
|
8966
8968
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
8967
8969
|
});
|
|
@@ -8984,7 +8986,7 @@ var init_frontend_provision = __esm({
|
|
|
8984
8986
|
metadata: { serviceType: "frontend" }
|
|
8985
8987
|
};
|
|
8986
8988
|
}
|
|
8987
|
-
const serverScript = path19.join(npmDir, "
|
|
8989
|
+
const serverScript = path19.join(npmDir, "standalone", "apps", "frontend", "server.js");
|
|
8988
8990
|
const project = new SemiontProject10(projectRoot);
|
|
8989
8991
|
if (!service.quiet) {
|
|
8990
8992
|
printInfo(`Provisioning frontend service ${service.name}...`);
|
|
@@ -9349,7 +9351,7 @@ var init_graph_stop = __esm({
|
|
|
9349
9351
|
});
|
|
9350
9352
|
|
|
9351
9353
|
// src/platforms/posix/utils/process-manager.ts
|
|
9352
|
-
import { execFileSync as
|
|
9354
|
+
import { execFileSync as execFileSync12 } from "child_process";
|
|
9353
9355
|
async function killProcessGroupAndRelated(pid, serviceType, verbose = false) {
|
|
9354
9356
|
let killed = false;
|
|
9355
9357
|
try {
|
|
@@ -9389,7 +9391,7 @@ async function killProcessGroupAndRelated(pid, serviceType, verbose = false) {
|
|
|
9389
9391
|
try {
|
|
9390
9392
|
for (const pattern of cleanupPatterns.patterns) {
|
|
9391
9393
|
try {
|
|
9392
|
-
|
|
9394
|
+
execFileSync12("pkill", ["-f", pattern], { stdio: "ignore" });
|
|
9393
9395
|
} catch {
|
|
9394
9396
|
}
|
|
9395
9397
|
}
|
|
@@ -10197,12 +10199,12 @@ var init_inference_stop = __esm({
|
|
|
10197
10199
|
|
|
10198
10200
|
// src/platforms/posix/handlers/inference-provision.ts
|
|
10199
10201
|
import * as fs30 from "fs";
|
|
10200
|
-
import { execFileSync as
|
|
10202
|
+
import { execFileSync as execFileSync13 } from "child_process";
|
|
10201
10203
|
function detectGpu() {
|
|
10202
10204
|
const platform = process.platform;
|
|
10203
10205
|
if (platform === "darwin") {
|
|
10204
10206
|
try {
|
|
10205
|
-
const brand =
|
|
10207
|
+
const brand = execFileSync13("sysctl", ["-n", "machdep.cpu.brand_string"], {
|
|
10206
10208
|
encoding: "utf-8"
|
|
10207
10209
|
}).trim();
|
|
10208
10210
|
if (brand.includes("Apple")) {
|
|
@@ -10214,7 +10216,7 @@ function detectGpu() {
|
|
|
10214
10216
|
}
|
|
10215
10217
|
}
|
|
10216
10218
|
try {
|
|
10217
|
-
const gpuName =
|
|
10219
|
+
const gpuName = execFileSync13("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
10218
10220
|
encoding: "utf-8",
|
|
10219
10221
|
stdio: ["ignore", "pipe", "ignore"]
|
|
10220
10222
|
}).trim();
|
|
@@ -10224,7 +10226,7 @@ function detectGpu() {
|
|
|
10224
10226
|
} catch {
|
|
10225
10227
|
}
|
|
10226
10228
|
try {
|
|
10227
|
-
const output =
|
|
10229
|
+
const output = execFileSync13("rocm-smi", ["--showproductname"], {
|
|
10228
10230
|
encoding: "utf-8",
|
|
10229
10231
|
stdio: ["ignore", "pipe", "ignore"]
|
|
10230
10232
|
}).trim();
|
|
@@ -10260,7 +10262,7 @@ var init_inference_provision = __esm({
|
|
|
10260
10262
|
printInfo(`Pulling model ${model}...`);
|
|
10261
10263
|
}
|
|
10262
10264
|
try {
|
|
10263
|
-
|
|
10265
|
+
execFileSync13("ollama", ["pull", model], {
|
|
10264
10266
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
10265
10267
|
});
|
|
10266
10268
|
pulledModels.push(model);
|
|
@@ -10377,7 +10379,7 @@ var init_handlers = __esm({
|
|
|
10377
10379
|
});
|
|
10378
10380
|
|
|
10379
10381
|
// src/platforms/posix/platform.ts
|
|
10380
|
-
import { execFileSync as
|
|
10382
|
+
import { execFileSync as execFileSync14 } from "child_process";
|
|
10381
10383
|
import * as fs31 from "fs";
|
|
10382
10384
|
import * as path25 from "path";
|
|
10383
10385
|
var PosixPlatform;
|
|
@@ -10467,7 +10469,7 @@ var init_platform2 = __esm({
|
|
|
10467
10469
|
try {
|
|
10468
10470
|
if (process.platform === "darwin") {
|
|
10469
10471
|
try {
|
|
10470
|
-
const output =
|
|
10472
|
+
const output = execFileSync14(
|
|
10471
10473
|
"log",
|
|
10472
10474
|
["show", "--process", String(pid), "--last", `${tail}m`, "--style", "json"],
|
|
10473
10475
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -10489,7 +10491,7 @@ var init_platform2 = __esm({
|
|
|
10489
10491
|
}
|
|
10490
10492
|
} else {
|
|
10491
10493
|
try {
|
|
10492
|
-
const output =
|
|
10494
|
+
const output = execFileSync14(
|
|
10493
10495
|
"journalctl",
|
|
10494
10496
|
[`_PID=${pid}`, "-n", String(tail), "--no-pager", "--output=json"],
|
|
10495
10497
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -10596,13 +10598,13 @@ var init_platform2 = __esm({
|
|
|
10596
10598
|
tailFile(filePath, lines) {
|
|
10597
10599
|
try {
|
|
10598
10600
|
if (process.platform === "win32") {
|
|
10599
|
-
return
|
|
10601
|
+
return execFileSync14(
|
|
10600
10602
|
"powershell",
|
|
10601
10603
|
["-Command", `Get-Content '${filePath}' -Tail ${lines}`],
|
|
10602
10604
|
{ encoding: "utf-8" }
|
|
10603
10605
|
);
|
|
10604
10606
|
} else {
|
|
10605
|
-
return
|
|
10607
|
+
return execFileSync14(
|
|
10606
10608
|
"tail",
|
|
10607
10609
|
["-n", String(lines), filePath],
|
|
10608
10610
|
{ encoding: "utf-8" }
|
|
@@ -10665,7 +10667,7 @@ var init_platform2 = __esm({
|
|
|
10665
10667
|
});
|
|
10666
10668
|
|
|
10667
10669
|
// src/platforms/container/handlers/web-check.ts
|
|
10668
|
-
import { execFileSync as
|
|
10670
|
+
import { execFileSync as execFileSync15 } from "child_process";
|
|
10669
10671
|
import { baseUrl as baseUrl2 } from "@semiont/core";
|
|
10670
10672
|
import { SemiontApiClient as SemiontApiClient2 } from "@semiont/api-client";
|
|
10671
10673
|
var checkWebContainer, preflightWebCheck, webCheckDescriptor;
|
|
@@ -10677,7 +10679,7 @@ var init_web_check = __esm({
|
|
|
10677
10679
|
const { platform, service, runtime, containerName } = context;
|
|
10678
10680
|
const config = service.config;
|
|
10679
10681
|
try {
|
|
10680
|
-
const containerStatus =
|
|
10682
|
+
const containerStatus = execFileSync15(
|
|
10681
10683
|
runtime,
|
|
10682
10684
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10683
10685
|
{ encoding: "utf-8" }
|
|
@@ -10693,14 +10695,14 @@ var init_web_check = __esm({
|
|
|
10693
10695
|
metadata: { containerStatus }
|
|
10694
10696
|
};
|
|
10695
10697
|
}
|
|
10696
|
-
const containerId =
|
|
10698
|
+
const containerId = execFileSync15(
|
|
10697
10699
|
runtime,
|
|
10698
10700
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
10699
10701
|
{ encoding: "utf-8" }
|
|
10700
10702
|
).trim().substring(0, 12);
|
|
10701
10703
|
let dockerHealthStatus;
|
|
10702
10704
|
try {
|
|
10703
|
-
dockerHealthStatus =
|
|
10705
|
+
dockerHealthStatus = execFileSync15(
|
|
10704
10706
|
runtime,
|
|
10705
10707
|
["inspect", containerName, "--format", "{{.State.Health.Status}}"],
|
|
10706
10708
|
{ encoding: "utf-8" }
|
|
@@ -10841,7 +10843,7 @@ var init_web_check = __esm({
|
|
|
10841
10843
|
});
|
|
10842
10844
|
|
|
10843
10845
|
// src/platforms/container/handlers/database-check.ts
|
|
10844
|
-
import { execFileSync as
|
|
10846
|
+
import { execFileSync as execFileSync16 } from "child_process";
|
|
10845
10847
|
var checkDatabaseContainer, preflightDatabaseCheck2, databaseCheckDescriptor2;
|
|
10846
10848
|
var init_database_check2 = __esm({
|
|
10847
10849
|
"src/platforms/container/handlers/database-check.ts"() {
|
|
@@ -10851,7 +10853,7 @@ var init_database_check2 = __esm({
|
|
|
10851
10853
|
const { platform, service, runtime, containerName } = context;
|
|
10852
10854
|
const config = service.config;
|
|
10853
10855
|
try {
|
|
10854
|
-
const containerStatus =
|
|
10856
|
+
const containerStatus = execFileSync16(
|
|
10855
10857
|
runtime,
|
|
10856
10858
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10857
10859
|
{ encoding: "utf-8" }
|
|
@@ -10867,7 +10869,7 @@ var init_database_check2 = __esm({
|
|
|
10867
10869
|
metadata: { containerStatus }
|
|
10868
10870
|
};
|
|
10869
10871
|
}
|
|
10870
|
-
const containerId =
|
|
10872
|
+
const containerId = execFileSync16(
|
|
10871
10873
|
runtime,
|
|
10872
10874
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
10873
10875
|
{ encoding: "utf-8" }
|
|
@@ -10886,13 +10888,13 @@ var init_database_check2 = __esm({
|
|
|
10886
10888
|
const port = config.port;
|
|
10887
10889
|
try {
|
|
10888
10890
|
try {
|
|
10889
|
-
|
|
10891
|
+
execFileSync16(
|
|
10890
10892
|
runtime,
|
|
10891
10893
|
["exec", containerName, "sh", "-c", `netstat -ln | grep :${port}`],
|
|
10892
10894
|
{ encoding: "utf-8" }
|
|
10893
10895
|
);
|
|
10894
10896
|
} catch {
|
|
10895
|
-
|
|
10897
|
+
execFileSync16(
|
|
10896
10898
|
runtime,
|
|
10897
10899
|
["exec", containerName, "sh", "-c", `nc -z localhost ${port}`],
|
|
10898
10900
|
{ encoding: "utf-8" }
|
|
@@ -10963,7 +10965,7 @@ var init_database_check2 = __esm({
|
|
|
10963
10965
|
});
|
|
10964
10966
|
|
|
10965
10967
|
// src/platforms/container/handlers/graph-check.ts
|
|
10966
|
-
import { execFileSync as
|
|
10968
|
+
import { execFileSync as execFileSync17 } from "child_process";
|
|
10967
10969
|
function getGraphEndpoint2(graphType, port) {
|
|
10968
10970
|
const host = "localhost";
|
|
10969
10971
|
switch (graphType) {
|
|
@@ -10988,7 +10990,7 @@ var init_graph_check2 = __esm({
|
|
|
10988
10990
|
const config = service.config;
|
|
10989
10991
|
const graphType = config.type;
|
|
10990
10992
|
try {
|
|
10991
|
-
const containerStatus =
|
|
10993
|
+
const containerStatus = execFileSync17(
|
|
10992
10994
|
runtime,
|
|
10993
10995
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
10994
10996
|
{ encoding: "utf-8" }
|
|
@@ -11008,12 +11010,12 @@ var init_graph_check2 = __esm({
|
|
|
11008
11010
|
}
|
|
11009
11011
|
};
|
|
11010
11012
|
}
|
|
11011
|
-
const containerId =
|
|
11013
|
+
const containerId = execFileSync17(
|
|
11012
11014
|
runtime,
|
|
11013
11015
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
11014
11016
|
{ encoding: "utf-8" }
|
|
11015
11017
|
).trim();
|
|
11016
|
-
const portsOutput =
|
|
11018
|
+
const portsOutput = execFileSync17(
|
|
11017
11019
|
runtime,
|
|
11018
11020
|
["port", containerName],
|
|
11019
11021
|
{ encoding: "utf-8" }
|
|
@@ -11039,7 +11041,7 @@ var init_graph_check2 = __esm({
|
|
|
11039
11041
|
case "janusgraph":
|
|
11040
11042
|
case "neptune":
|
|
11041
11043
|
try {
|
|
11042
|
-
|
|
11044
|
+
execFileSync17(
|
|
11043
11045
|
runtime,
|
|
11044
11046
|
["exec", containerName, "sh", "-c", `echo 'test' | nc -w 1 localhost ${port}`],
|
|
11045
11047
|
{ encoding: "utf-8", timeout: 5e3, stdio: "pipe" }
|
|
@@ -11047,12 +11049,12 @@ var init_graph_check2 = __esm({
|
|
|
11047
11049
|
isHealthy = true;
|
|
11048
11050
|
if (graphType === "janusgraph") {
|
|
11049
11051
|
try {
|
|
11050
|
-
const cassandraRunning =
|
|
11052
|
+
const cassandraRunning = execFileSync17(
|
|
11051
11053
|
runtime,
|
|
11052
11054
|
["ps", "--filter", "name=semiont-cassandra", "--format", "{{.Names}}"],
|
|
11053
11055
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
11054
11056
|
).trim().includes("semiont-cassandra");
|
|
11055
|
-
const elasticsearchRunning =
|
|
11057
|
+
const elasticsearchRunning = execFileSync17(
|
|
11056
11058
|
runtime,
|
|
11057
11059
|
["ps", "--filter", "name=semiont-elasticsearch", "--format", "{{.Names}}"],
|
|
11058
11060
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11075,7 +11077,7 @@ var init_graph_check2 = __esm({
|
|
|
11075
11077
|
}
|
|
11076
11078
|
}
|
|
11077
11079
|
} catch {
|
|
11078
|
-
const processes =
|
|
11080
|
+
const processes = execFileSync17(
|
|
11079
11081
|
runtime,
|
|
11080
11082
|
["exec", containerName, "ps", "aux"],
|
|
11081
11083
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11087,11 +11089,11 @@ var init_graph_check2 = __esm({
|
|
|
11087
11089
|
}
|
|
11088
11090
|
break;
|
|
11089
11091
|
case "neo4j":
|
|
11090
|
-
|
|
11092
|
+
execFileSync17("nc", ["-z", "localhost", String(port)], { timeout: 5e3 });
|
|
11091
11093
|
isHealthy = true;
|
|
11092
11094
|
break;
|
|
11093
11095
|
case "arangodb":
|
|
11094
|
-
const httpCode =
|
|
11096
|
+
const httpCode = execFileSync17(
|
|
11095
11097
|
"curl",
|
|
11096
11098
|
["-s", "-o", "/dev/null", "-w", "%{http_code}", `http://localhost:${port}/_api/version`],
|
|
11097
11099
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11099,7 +11101,7 @@ var init_graph_check2 = __esm({
|
|
|
11099
11101
|
isHealthy = httpCode === "200";
|
|
11100
11102
|
break;
|
|
11101
11103
|
default:
|
|
11102
|
-
|
|
11104
|
+
execFileSync17("nc", ["-z", "localhost", String(port)], { timeout: 5e3 });
|
|
11103
11105
|
isHealthy = true;
|
|
11104
11106
|
}
|
|
11105
11107
|
} catch (healthCheckError) {
|
|
@@ -11108,7 +11110,7 @@ var init_graph_check2 = __esm({
|
|
|
11108
11110
|
}
|
|
11109
11111
|
let logs;
|
|
11110
11112
|
try {
|
|
11111
|
-
const logOutput =
|
|
11113
|
+
const logOutput = execFileSync17(
|
|
11112
11114
|
runtime,
|
|
11113
11115
|
["logs", containerName, "--tail", "20"],
|
|
11114
11116
|
{ encoding: "utf-8", maxBuffer: 1024 * 1024 }
|
|
@@ -11122,7 +11124,7 @@ var init_graph_check2 = __esm({
|
|
|
11122
11124
|
};
|
|
11123
11125
|
} catch (logError) {
|
|
11124
11126
|
}
|
|
11125
|
-
const image =
|
|
11127
|
+
const image = execFileSync17(
|
|
11126
11128
|
runtime,
|
|
11127
11129
|
["inspect", containerName, "--format", "{{.Config.Image}}"],
|
|
11128
11130
|
{ encoding: "utf-8" }
|
|
@@ -11208,13 +11210,13 @@ var init_platform_resources = __esm({
|
|
|
11208
11210
|
});
|
|
11209
11211
|
|
|
11210
11212
|
// src/platforms/container/handlers/web-start.ts
|
|
11211
|
-
import { execFileSync as
|
|
11213
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
11212
11214
|
async function waitForContainer(runtime, containerName) {
|
|
11213
11215
|
const maxAttempts = 30;
|
|
11214
11216
|
let attempts = 0;
|
|
11215
11217
|
while (attempts < maxAttempts) {
|
|
11216
11218
|
try {
|
|
11217
|
-
const status =
|
|
11219
|
+
const status = execFileSync18(
|
|
11218
11220
|
runtime,
|
|
11219
11221
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11220
11222
|
{ encoding: "utf-8" }
|
|
@@ -11241,12 +11243,12 @@ var init_web_start = __esm({
|
|
|
11241
11243
|
const config = service.config;
|
|
11242
11244
|
const image = service.getImage();
|
|
11243
11245
|
try {
|
|
11244
|
-
|
|
11246
|
+
execFileSync18(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
11245
11247
|
} catch {
|
|
11246
11248
|
}
|
|
11247
11249
|
const networkName = `semiont-${service.environment}`;
|
|
11248
11250
|
try {
|
|
11249
|
-
|
|
11251
|
+
execFileSync18(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11250
11252
|
} catch {
|
|
11251
11253
|
}
|
|
11252
11254
|
const runArgs = [
|
|
@@ -11279,7 +11281,7 @@ var init_web_start = __esm({
|
|
|
11279
11281
|
printInfo(`Starting web container: ${containerName}`);
|
|
11280
11282
|
}
|
|
11281
11283
|
try {
|
|
11282
|
-
const containerId =
|
|
11284
|
+
const containerId = execFileSync18(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
11283
11285
|
await waitForContainer(runtime, containerName);
|
|
11284
11286
|
const endpoint = `http://localhost:${port}`;
|
|
11285
11287
|
return {
|
|
@@ -11330,7 +11332,7 @@ var init_web_start = __esm({
|
|
|
11330
11332
|
});
|
|
11331
11333
|
|
|
11332
11334
|
// src/platforms/container/handlers/database-start.ts
|
|
11333
|
-
import { execFileSync as
|
|
11335
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
11334
11336
|
async function waitForDatabase(runtime, containerName, image, quiet, dbUser, verbose) {
|
|
11335
11337
|
const maxAttempts = 15;
|
|
11336
11338
|
let attempts = 0;
|
|
@@ -11338,7 +11340,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11338
11340
|
const skipHealthCheck = process.env.SKIP_DB_HEALTH_CHECK === "true";
|
|
11339
11341
|
if (skipHealthCheck) {
|
|
11340
11342
|
try {
|
|
11341
|
-
const status =
|
|
11343
|
+
const status = execFileSync19(
|
|
11342
11344
|
runtime,
|
|
11343
11345
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11344
11346
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11353,7 +11355,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11353
11355
|
}
|
|
11354
11356
|
while (attempts < maxAttempts) {
|
|
11355
11357
|
try {
|
|
11356
|
-
const status =
|
|
11358
|
+
const status = execFileSync19(
|
|
11357
11359
|
runtime,
|
|
11358
11360
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11359
11361
|
{ encoding: "utf-8", timeout: 5e3 }
|
|
@@ -11373,7 +11375,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11373
11375
|
if (verbose) {
|
|
11374
11376
|
printInfo(`Checking PostgreSQL readiness with user '${dbUser}'...`);
|
|
11375
11377
|
}
|
|
11376
|
-
|
|
11378
|
+
execFileSync19(runtime, ["exec", containerName, "pg_isready", "-U", dbUser, "-t", "1"], {
|
|
11377
11379
|
stdio: verbose ? "inherit" : "ignore",
|
|
11378
11380
|
timeout: 5e3
|
|
11379
11381
|
});
|
|
@@ -11389,7 +11391,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11389
11391
|
}
|
|
11390
11392
|
} else if (image.includes("mysql")) {
|
|
11391
11393
|
try {
|
|
11392
|
-
|
|
11394
|
+
execFileSync19(runtime, ["exec", containerName, "mysqladmin", "ping", "-h", "localhost"], {
|
|
11393
11395
|
stdio: "ignore",
|
|
11394
11396
|
timeout: 5e3
|
|
11395
11397
|
});
|
|
@@ -11398,7 +11400,7 @@ async function waitForDatabase(runtime, containerName, image, quiet, dbUser, ver
|
|
|
11398
11400
|
}
|
|
11399
11401
|
} else if (image.includes("mongo")) {
|
|
11400
11402
|
try {
|
|
11401
|
-
|
|
11403
|
+
execFileSync19(runtime, ["exec", containerName, "mongosh", "--eval", "db.adminCommand('ping')"], {
|
|
11402
11404
|
stdio: "ignore",
|
|
11403
11405
|
timeout: 5e3
|
|
11404
11406
|
});
|
|
@@ -11432,12 +11434,12 @@ var init_database_start2 = __esm({
|
|
|
11432
11434
|
const config = service.config;
|
|
11433
11435
|
const image = service.getImage();
|
|
11434
11436
|
try {
|
|
11435
|
-
|
|
11437
|
+
execFileSync19(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
11436
11438
|
} catch {
|
|
11437
11439
|
}
|
|
11438
11440
|
const networkName = `semiont-${service.environment}`;
|
|
11439
11441
|
try {
|
|
11440
|
-
|
|
11442
|
+
execFileSync19(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11441
11443
|
} catch {
|
|
11442
11444
|
}
|
|
11443
11445
|
const runArgs = [
|
|
@@ -11459,7 +11461,7 @@ var init_database_start2 = __esm({
|
|
|
11459
11461
|
}
|
|
11460
11462
|
const volumeName = `${containerName}-data`;
|
|
11461
11463
|
try {
|
|
11462
|
-
|
|
11464
|
+
execFileSync19(runtime, ["volume", "create", volumeName], { stdio: "ignore" });
|
|
11463
11465
|
} catch {
|
|
11464
11466
|
}
|
|
11465
11467
|
const mountPath = image.includes("postgres") ? "/var/lib/postgresql/data" : image.includes("mysql") ? "/var/lib/mysql" : image.includes("mongo") ? "/data/db" : "/data";
|
|
@@ -11485,7 +11487,7 @@ var init_database_start2 = __esm({
|
|
|
11485
11487
|
printInfo(`Run command: ${runtime} ${runArgs.join(" ")}`);
|
|
11486
11488
|
}
|
|
11487
11489
|
try {
|
|
11488
|
-
const containerId =
|
|
11490
|
+
const containerId = execFileSync19(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
11489
11491
|
const dbUser = envVars.POSTGRES_USER || envVars.MYSQL_USER || envVars.MONGO_INITDB_ROOT_USERNAME;
|
|
11490
11492
|
await waitForDatabase(runtime, containerName, image, service.quiet, dbUser, context.options.verbose);
|
|
11491
11493
|
const endpoint = `localhost:${port}`;
|
|
@@ -11541,7 +11543,7 @@ var init_database_start2 = __esm({
|
|
|
11541
11543
|
// src/platforms/container/handlers/graph-start.ts
|
|
11542
11544
|
import * as fs32 from "fs/promises";
|
|
11543
11545
|
import * as path26 from "path";
|
|
11544
|
-
import { execFileSync as
|
|
11546
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
11545
11547
|
async function startJanusGraph2(context) {
|
|
11546
11548
|
const { service, runtime, containerName } = context;
|
|
11547
11549
|
const composePath = path26.join(service.projectRoot, "docker-compose.janusgraph.yml");
|
|
@@ -11553,7 +11555,7 @@ async function startJanusGraph2(context) {
|
|
|
11553
11555
|
};
|
|
11554
11556
|
}
|
|
11555
11557
|
try {
|
|
11556
|
-
const output =
|
|
11558
|
+
const output = execFileSync20(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
11557
11559
|
if (output.includes(containerName)) {
|
|
11558
11560
|
if (!service.quiet) {
|
|
11559
11561
|
printWarning("JanusGraph container is already running");
|
|
@@ -11574,7 +11576,7 @@ async function startJanusGraph2(context) {
|
|
|
11574
11576
|
if (!service.quiet) {
|
|
11575
11577
|
printInfo("Starting JanusGraph Docker stack...");
|
|
11576
11578
|
}
|
|
11577
|
-
|
|
11579
|
+
execFileSync20("docker-compose", ["-f", composePath, "up", "-d"], {
|
|
11578
11580
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
11579
11581
|
});
|
|
11580
11582
|
if (!service.quiet) {
|
|
@@ -11584,13 +11586,13 @@ async function startJanusGraph2(context) {
|
|
|
11584
11586
|
const maxAttempts = 20;
|
|
11585
11587
|
for (let i = 0; i < maxAttempts; i++) {
|
|
11586
11588
|
try {
|
|
11587
|
-
const status =
|
|
11589
|
+
const status = execFileSync20(
|
|
11588
11590
|
runtime,
|
|
11589
11591
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11590
11592
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
11591
11593
|
).trim();
|
|
11592
11594
|
if (status === "running") {
|
|
11593
|
-
const logs =
|
|
11595
|
+
const logs = execFileSync20(
|
|
11594
11596
|
runtime,
|
|
11595
11597
|
["logs", "--tail", "20", containerName],
|
|
11596
11598
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11610,7 +11612,7 @@ async function startJanusGraph2(context) {
|
|
|
11610
11612
|
}
|
|
11611
11613
|
if (!ready) {
|
|
11612
11614
|
try {
|
|
11613
|
-
const finalStatus =
|
|
11615
|
+
const finalStatus = execFileSync20(
|
|
11614
11616
|
runtime,
|
|
11615
11617
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11616
11618
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11625,14 +11627,14 @@ async function startJanusGraph2(context) {
|
|
|
11625
11627
|
}
|
|
11626
11628
|
}
|
|
11627
11629
|
if (!ready) {
|
|
11628
|
-
|
|
11630
|
+
execFileSync20("docker-compose", ["-f", composePath, "down"], { stdio: "ignore" });
|
|
11629
11631
|
return {
|
|
11630
11632
|
success: false,
|
|
11631
11633
|
error: "JanusGraph failed to start within timeout",
|
|
11632
11634
|
metadata: { serviceType: "graph", serviceName: "janusgraph" }
|
|
11633
11635
|
};
|
|
11634
11636
|
}
|
|
11635
|
-
const runningContainers =
|
|
11637
|
+
const runningContainers = execFileSync20(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
11636
11638
|
const hasCassandra = runningContainers.includes("semiont-cassandra");
|
|
11637
11639
|
const hasElasticsearch = runningContainers.includes("semiont-elasticsearch");
|
|
11638
11640
|
if (!service.quiet) {
|
|
@@ -11719,7 +11721,7 @@ var init_graph_start2 = __esm({
|
|
|
11719
11721
|
});
|
|
11720
11722
|
|
|
11721
11723
|
// src/platforms/container/handlers/database-provision.ts
|
|
11722
|
-
import { execFileSync as
|
|
11724
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
11723
11725
|
import * as fs33 from "fs";
|
|
11724
11726
|
import * as path27 from "path";
|
|
11725
11727
|
var provisionDatabaseContainer, preflightDatabaseProvision, databaseProvisionDescriptor;
|
|
@@ -11735,12 +11737,12 @@ var init_database_provision = __esm({
|
|
|
11735
11737
|
}
|
|
11736
11738
|
const networkName = `semiont-${service.environment}`;
|
|
11737
11739
|
try {
|
|
11738
|
-
|
|
11740
|
+
execFileSync21(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
11739
11741
|
} catch {
|
|
11740
11742
|
}
|
|
11741
11743
|
const volumeName = `${containerName}-data`;
|
|
11742
11744
|
try {
|
|
11743
|
-
|
|
11745
|
+
execFileSync21(runtime, ["volume", "create", volumeName], { stdio: "ignore" });
|
|
11744
11746
|
if (!service.quiet) {
|
|
11745
11747
|
printInfo(`Created volume: ${volumeName}`);
|
|
11746
11748
|
}
|
|
@@ -11751,7 +11753,7 @@ var init_database_provision = __esm({
|
|
|
11751
11753
|
printInfo(`Pulling database image ${image}...`);
|
|
11752
11754
|
}
|
|
11753
11755
|
try {
|
|
11754
|
-
|
|
11756
|
+
execFileSync21(runtime, ["pull", image], {
|
|
11755
11757
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
11756
11758
|
});
|
|
11757
11759
|
} catch (error) {
|
|
@@ -11768,7 +11770,7 @@ var init_database_provision = __esm({
|
|
|
11768
11770
|
const dbUser = envVars.POSTGRES_USER || envVars.MYSQL_USER;
|
|
11769
11771
|
let containerRunning = false;
|
|
11770
11772
|
try {
|
|
11771
|
-
const status =
|
|
11773
|
+
const status = execFileSync21(
|
|
11772
11774
|
runtime,
|
|
11773
11775
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
11774
11776
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -11799,7 +11801,7 @@ var init_database_provision = __esm({
|
|
|
11799
11801
|
}
|
|
11800
11802
|
runArgs.push(image);
|
|
11801
11803
|
try {
|
|
11802
|
-
|
|
11804
|
+
execFileSync21(runtime, runArgs, { encoding: "utf-8" });
|
|
11803
11805
|
if (!service.quiet) {
|
|
11804
11806
|
printInfo("Waiting for database to be ready...");
|
|
11805
11807
|
}
|
|
@@ -11808,10 +11810,10 @@ var init_database_provision = __esm({
|
|
|
11808
11810
|
while (attempts < maxAttempts) {
|
|
11809
11811
|
try {
|
|
11810
11812
|
if (image.includes("postgres")) {
|
|
11811
|
-
|
|
11813
|
+
execFileSync21(runtime, ["exec", initContainerName, "pg_isready", "-U", dbUser || "postgres"], { stdio: "ignore" });
|
|
11812
11814
|
break;
|
|
11813
11815
|
} else if (image.includes("mysql")) {
|
|
11814
|
-
|
|
11816
|
+
execFileSync21(runtime, ["exec", initContainerName, "mysqladmin", "ping", "-h", "localhost"], { stdio: "ignore" });
|
|
11815
11817
|
break;
|
|
11816
11818
|
}
|
|
11817
11819
|
} catch {
|
|
@@ -11828,15 +11830,15 @@ var init_database_provision = __esm({
|
|
|
11828
11830
|
if (hasSeedData && !service.quiet) {
|
|
11829
11831
|
printInfo("Seed data found in db/seed - this should be loaded by your application");
|
|
11830
11832
|
}
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
+
execFileSync21(runtime, ["stop", initContainerName], { stdio: "ignore" });
|
|
11834
|
+
execFileSync21(runtime, ["rm", initContainerName], { stdio: "ignore" });
|
|
11833
11835
|
if (!service.quiet) {
|
|
11834
11836
|
printSuccess("Database initialized successfully");
|
|
11835
11837
|
}
|
|
11836
11838
|
} catch (error) {
|
|
11837
11839
|
try {
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
+
execFileSync21(runtime, ["stop", initContainerName], { stdio: "ignore" });
|
|
11841
|
+
execFileSync21(runtime, ["rm", initContainerName], { stdio: "ignore" });
|
|
11840
11842
|
} catch {
|
|
11841
11843
|
}
|
|
11842
11844
|
return {
|
|
@@ -14513,7 +14515,7 @@ var init_js_yaml = __esm({
|
|
|
14513
14515
|
// src/platforms/container/handlers/graph-provision.ts
|
|
14514
14516
|
import * as fs34 from "fs/promises";
|
|
14515
14517
|
import * as path28 from "path";
|
|
14516
|
-
import { execFileSync as
|
|
14518
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
14517
14519
|
var provisionGraphService2, preflightGraphProvision2, graphProvisionDescriptor2;
|
|
14518
14520
|
var init_graph_provision2 = __esm({
|
|
14519
14521
|
"src/platforms/container/handlers/graph-provision.ts"() {
|
|
@@ -14542,7 +14544,7 @@ var init_graph_provision2 = __esm({
|
|
|
14542
14544
|
const withCassandra = storage === "cassandra";
|
|
14543
14545
|
const networkName = "semiont-network";
|
|
14544
14546
|
try {
|
|
14545
|
-
|
|
14547
|
+
execFileSync22(runtime, ["--version"], { stdio: "ignore" });
|
|
14546
14548
|
} catch {
|
|
14547
14549
|
return {
|
|
14548
14550
|
success: false,
|
|
@@ -14551,14 +14553,14 @@ var init_graph_provision2 = __esm({
|
|
|
14551
14553
|
};
|
|
14552
14554
|
}
|
|
14553
14555
|
try {
|
|
14554
|
-
|
|
14556
|
+
execFileSync22(runtime, ["network", "create", networkName], { stdio: "ignore" });
|
|
14555
14557
|
} catch {
|
|
14556
14558
|
}
|
|
14557
14559
|
if (!service.quiet) {
|
|
14558
14560
|
printInfo("Pulling required Docker images...");
|
|
14559
14561
|
}
|
|
14560
14562
|
try {
|
|
14561
|
-
|
|
14563
|
+
execFileSync22(runtime, ["pull", "janusgraph/janusgraph:1.0.0"], {
|
|
14562
14564
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14563
14565
|
});
|
|
14564
14566
|
} catch (error) {
|
|
@@ -14566,7 +14568,7 @@ var init_graph_provision2 = __esm({
|
|
|
14566
14568
|
}
|
|
14567
14569
|
if (withCassandra) {
|
|
14568
14570
|
try {
|
|
14569
|
-
|
|
14571
|
+
execFileSync22(runtime, ["pull", "cassandra:4"], {
|
|
14570
14572
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14571
14573
|
});
|
|
14572
14574
|
} catch (error) {
|
|
@@ -14575,7 +14577,7 @@ var init_graph_provision2 = __esm({
|
|
|
14575
14577
|
}
|
|
14576
14578
|
if (withElasticsearch) {
|
|
14577
14579
|
try {
|
|
14578
|
-
|
|
14580
|
+
execFileSync22(runtime, ["pull", "docker.elastic.co/elasticsearch/elasticsearch:7.17.10"], {
|
|
14579
14581
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
14580
14582
|
});
|
|
14581
14583
|
} catch (error) {
|
|
@@ -14724,7 +14726,7 @@ var init_graph_provision2 = __esm({
|
|
|
14724
14726
|
|
|
14725
14727
|
// src/platforms/container/handlers/graph-stop.ts
|
|
14726
14728
|
import * as path29 from "path";
|
|
14727
|
-
import { execFileSync as
|
|
14729
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
14728
14730
|
import * as fs35 from "fs/promises";
|
|
14729
14731
|
async function stopJanusGraph2(context) {
|
|
14730
14732
|
const { service, runtime, options, containerName } = context;
|
|
@@ -14744,7 +14746,7 @@ async function stopJanusGraph2(context) {
|
|
|
14744
14746
|
}
|
|
14745
14747
|
let runningContainers = [];
|
|
14746
14748
|
try {
|
|
14747
|
-
const output =
|
|
14749
|
+
const output = execFileSync23(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
14748
14750
|
const containerNames = [containerName, "semiont-cassandra", "semiont-elasticsearch"];
|
|
14749
14751
|
runningContainers = containerNames.filter((name) => output.includes(name));
|
|
14750
14752
|
if (runningContainers.length === 0) {
|
|
@@ -14773,10 +14775,10 @@ async function stopJanusGraph2(context) {
|
|
|
14773
14775
|
if (!service.quiet) {
|
|
14774
14776
|
printInfo("Force stopping JanusGraph Docker stack...");
|
|
14775
14777
|
}
|
|
14776
|
-
|
|
14778
|
+
execFileSync23("docker-compose", ["-f", composePath, "kill"], {
|
|
14777
14779
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14778
14780
|
});
|
|
14779
|
-
|
|
14781
|
+
execFileSync23("docker-compose", ["-f", composePath, "down"], {
|
|
14780
14782
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14781
14783
|
});
|
|
14782
14784
|
if (!service.quiet) {
|
|
@@ -14796,10 +14798,10 @@ async function stopJanusGraph2(context) {
|
|
|
14796
14798
|
if (!service.quiet) {
|
|
14797
14799
|
printInfo(`Stopping JanusGraph Docker stack gracefully (timeout: ${options.timeout}s)...`);
|
|
14798
14800
|
}
|
|
14799
|
-
|
|
14801
|
+
execFileSync23("docker-compose", ["-f", composePath, "stop", "-t", options.timeout.toString()], {
|
|
14800
14802
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14801
14803
|
});
|
|
14802
|
-
|
|
14804
|
+
execFileSync23("docker-compose", ["-f", composePath, "down"], {
|
|
14803
14805
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
14804
14806
|
});
|
|
14805
14807
|
if (!service.quiet) {
|
|
@@ -14870,7 +14872,7 @@ var init_graph_stop2 = __esm({
|
|
|
14870
14872
|
});
|
|
14871
14873
|
|
|
14872
14874
|
// src/platforms/container/handlers/database-stop.ts
|
|
14873
|
-
import { execFileSync as
|
|
14875
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
14874
14876
|
var stopDatabaseContainer, preflightDatabaseStop, databaseStopDescriptor;
|
|
14875
14877
|
var init_database_stop = __esm({
|
|
14876
14878
|
"src/platforms/container/handlers/database-stop.ts"() {
|
|
@@ -14884,7 +14886,7 @@ var init_database_stop = __esm({
|
|
|
14884
14886
|
printInfo(`Stopping database container: ${containerName}`);
|
|
14885
14887
|
}
|
|
14886
14888
|
try {
|
|
14887
|
-
const status =
|
|
14889
|
+
const status = execFileSync24(
|
|
14888
14890
|
runtime,
|
|
14889
14891
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
14890
14892
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -14906,7 +14908,7 @@ var init_database_stop = __esm({
|
|
|
14906
14908
|
}
|
|
14907
14909
|
};
|
|
14908
14910
|
}
|
|
14909
|
-
const containerId =
|
|
14911
|
+
const containerId = execFileSync24(
|
|
14910
14912
|
runtime,
|
|
14911
14913
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
14912
14914
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -14915,7 +14917,7 @@ var init_database_stop = __esm({
|
|
|
14915
14917
|
if (!service.quiet) {
|
|
14916
14918
|
printWarning("Force stopping database (may cause data corruption)...");
|
|
14917
14919
|
}
|
|
14918
|
-
|
|
14920
|
+
execFileSync24(runtime, ["kill", containerName], { stdio: "pipe" });
|
|
14919
14921
|
} else {
|
|
14920
14922
|
if (!service.quiet) {
|
|
14921
14923
|
printInfo(`Gracefully stopping database (timeout: ${timeout}s)...`);
|
|
@@ -14923,7 +14925,7 @@ var init_database_stop = __esm({
|
|
|
14923
14925
|
const image = service.getImage();
|
|
14924
14926
|
if (image.includes("postgres")) {
|
|
14925
14927
|
try {
|
|
14926
|
-
|
|
14928
|
+
execFileSync24(
|
|
14927
14929
|
runtime,
|
|
14928
14930
|
[
|
|
14929
14931
|
"exec",
|
|
@@ -14936,20 +14938,20 @@ var init_database_stop = __esm({
|
|
|
14936
14938
|
{ stdio: "pipe", timeout: (timeout + 5) * 1e3 }
|
|
14937
14939
|
);
|
|
14938
14940
|
} catch {
|
|
14939
|
-
|
|
14941
|
+
execFileSync24(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
14940
14942
|
}
|
|
14941
14943
|
} else if (image.includes("mysql")) {
|
|
14942
14944
|
try {
|
|
14943
|
-
|
|
14945
|
+
execFileSync24(
|
|
14944
14946
|
runtime,
|
|
14945
14947
|
["exec", containerName, "mysqladmin", "shutdown"],
|
|
14946
14948
|
{ stdio: "pipe", timeout: timeout * 1e3 }
|
|
14947
14949
|
);
|
|
14948
14950
|
} catch {
|
|
14949
|
-
|
|
14951
|
+
execFileSync24(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
14950
14952
|
}
|
|
14951
14953
|
} else {
|
|
14952
|
-
|
|
14954
|
+
execFileSync24(runtime, ["stop", "-t", timeout.toString(), containerName], { stdio: "pipe" });
|
|
14953
14955
|
}
|
|
14954
14956
|
}
|
|
14955
14957
|
let stopped = false;
|
|
@@ -14957,7 +14959,7 @@ var init_database_stop = __esm({
|
|
|
14957
14959
|
const maxAttempts = 10;
|
|
14958
14960
|
while (!stopped && attempts < maxAttempts) {
|
|
14959
14961
|
try {
|
|
14960
|
-
const currentStatus =
|
|
14962
|
+
const currentStatus = execFileSync24(
|
|
14961
14963
|
runtime,
|
|
14962
14964
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
14963
14965
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15053,14 +15055,14 @@ var init_proxy_paths2 = __esm({
|
|
|
15053
15055
|
// src/platforms/container/handlers/proxy-provision.ts
|
|
15054
15056
|
import * as fs36 from "fs";
|
|
15055
15057
|
import * as path31 from "path";
|
|
15056
|
-
import { execFileSync as
|
|
15058
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
15057
15059
|
function getHostAddress(runtime) {
|
|
15058
15060
|
const platform = process.platform;
|
|
15059
15061
|
if (platform === "darwin" || platform === "win32") {
|
|
15060
15062
|
return "host.docker.internal";
|
|
15061
15063
|
} else {
|
|
15062
15064
|
try {
|
|
15063
|
-
|
|
15065
|
+
execFileSync25(runtime, ["run", "--rm", "alpine", "getent", "hosts", "host-gateway"], { stdio: "pipe" });
|
|
15064
15066
|
return "host-gateway";
|
|
15065
15067
|
} catch {
|
|
15066
15068
|
return "172.17.0.1";
|
|
@@ -15147,7 +15149,7 @@ var init_proxy_provision2 = __esm({
|
|
|
15147
15149
|
printInfo(`Pulling image: ${imageName}...`);
|
|
15148
15150
|
}
|
|
15149
15151
|
try {
|
|
15150
|
-
|
|
15152
|
+
execFileSync25(runtime, ["pull", imageName], {
|
|
15151
15153
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15152
15154
|
});
|
|
15153
15155
|
if (!service.quiet) {
|
|
@@ -15222,7 +15224,7 @@ var init_proxy_provision2 = __esm({
|
|
|
15222
15224
|
});
|
|
15223
15225
|
|
|
15224
15226
|
// src/platforms/container/handlers/proxy-start.ts
|
|
15225
|
-
import { execFileSync as
|
|
15227
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
15226
15228
|
import * as fs37 from "fs";
|
|
15227
15229
|
function getProxyImage2(type2, customImage) {
|
|
15228
15230
|
if (customImage) {
|
|
@@ -15273,9 +15275,9 @@ var init_proxy_start2 = __esm({
|
|
|
15273
15275
|
};
|
|
15274
15276
|
}
|
|
15275
15277
|
try {
|
|
15276
|
-
const existingContainer =
|
|
15278
|
+
const existingContainer = execFileSync26(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15277
15279
|
if (existingContainer) {
|
|
15278
|
-
const isRunning =
|
|
15280
|
+
const isRunning = execFileSync26(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15279
15281
|
if (isRunning) {
|
|
15280
15282
|
if (!service.quiet) {
|
|
15281
15283
|
printInfo(`Proxy container ${containerName} is already running`);
|
|
@@ -15293,7 +15295,7 @@ var init_proxy_start2 = __esm({
|
|
|
15293
15295
|
if (!service.quiet) {
|
|
15294
15296
|
printInfo(`Removing stopped container ${containerName}`);
|
|
15295
15297
|
}
|
|
15296
|
-
|
|
15298
|
+
execFileSync26(runtime, ["rm", containerName], { stdio: "pipe" });
|
|
15297
15299
|
}
|
|
15298
15300
|
}
|
|
15299
15301
|
} catch (error) {
|
|
@@ -15332,7 +15334,7 @@ var init_proxy_start2 = __esm({
|
|
|
15332
15334
|
}
|
|
15333
15335
|
}
|
|
15334
15336
|
try {
|
|
15335
|
-
const containerId =
|
|
15337
|
+
const containerId = execFileSync26(runtime, runArgs, { encoding: "utf-8" }).trim();
|
|
15336
15338
|
if (!service.quiet) {
|
|
15337
15339
|
printSuccess(`Container started with ID: ${containerId.substring(0, 12)}`);
|
|
15338
15340
|
}
|
|
@@ -15340,9 +15342,9 @@ var init_proxy_start2 = __esm({
|
|
|
15340
15342
|
printInfo("Waiting for proxy to become healthy...");
|
|
15341
15343
|
}
|
|
15342
15344
|
await new Promise((resolve12) => setTimeout(resolve12, 2e3));
|
|
15343
|
-
const isRunning =
|
|
15345
|
+
const isRunning = execFileSync26(runtime, ["ps", "-q", "-f", `id=${containerId}`], { encoding: "utf-8" }).trim();
|
|
15344
15346
|
if (!isRunning) {
|
|
15345
|
-
const logs =
|
|
15347
|
+
const logs = execFileSync26(runtime, ["logs", containerId], { encoding: "utf-8" });
|
|
15346
15348
|
return {
|
|
15347
15349
|
success: false,
|
|
15348
15350
|
error: `Container exited unexpectedly. Logs:
|
|
@@ -15352,7 +15354,7 @@ ${logs}`,
|
|
|
15352
15354
|
}
|
|
15353
15355
|
if (config.type === "envoy") {
|
|
15354
15356
|
try {
|
|
15355
|
-
|
|
15357
|
+
execFileSync26("curl", ["-s", "-o", "/dev/null", `http://localhost:${adminPort}/clusters`], { stdio: "pipe" });
|
|
15356
15358
|
if (!service.quiet) {
|
|
15357
15359
|
printSuccess("Proxy admin interface is accessible");
|
|
15358
15360
|
}
|
|
@@ -15430,7 +15432,7 @@ ${logs}`,
|
|
|
15430
15432
|
});
|
|
15431
15433
|
|
|
15432
15434
|
// src/platforms/container/handlers/proxy-stop.ts
|
|
15433
|
-
import { execFileSync as
|
|
15435
|
+
import { execFileSync as execFileSync27 } from "child_process";
|
|
15434
15436
|
var stopProxyService2, preflightProxyStop, proxyStopDescriptor2;
|
|
15435
15437
|
var init_proxy_stop2 = __esm({
|
|
15436
15438
|
"src/platforms/container/handlers/proxy-stop.ts"() {
|
|
@@ -15444,7 +15446,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15444
15446
|
printInfo(`Stopping proxy service ${service.name} (type: ${config.type})...`);
|
|
15445
15447
|
}
|
|
15446
15448
|
try {
|
|
15447
|
-
const existingContainer =
|
|
15449
|
+
const existingContainer = execFileSync27(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15448
15450
|
if (!existingContainer) {
|
|
15449
15451
|
if (!service.quiet) {
|
|
15450
15452
|
printWarning(`Proxy container ${containerName} not found`);
|
|
@@ -15458,12 +15460,12 @@ var init_proxy_stop2 = __esm({
|
|
|
15458
15460
|
}
|
|
15459
15461
|
};
|
|
15460
15462
|
}
|
|
15461
|
-
const isRunning =
|
|
15463
|
+
const isRunning = execFileSync27(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15462
15464
|
if (isRunning) {
|
|
15463
15465
|
if (!service.quiet) {
|
|
15464
15466
|
printInfo(`Stopping container ${containerName}...`);
|
|
15465
15467
|
}
|
|
15466
|
-
|
|
15468
|
+
execFileSync27(runtime, ["stop", containerName], {
|
|
15467
15469
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15468
15470
|
});
|
|
15469
15471
|
if (!service.quiet) {
|
|
@@ -15477,7 +15479,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15477
15479
|
if (!service.quiet) {
|
|
15478
15480
|
printInfo(`Removing container ${containerName}...`);
|
|
15479
15481
|
}
|
|
15480
|
-
|
|
15482
|
+
execFileSync27(runtime, ["rm", containerName], {
|
|
15481
15483
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
15482
15484
|
});
|
|
15483
15485
|
if (!service.quiet) {
|
|
@@ -15522,7 +15524,7 @@ var init_proxy_stop2 = __esm({
|
|
|
15522
15524
|
});
|
|
15523
15525
|
|
|
15524
15526
|
// src/platforms/container/handlers/proxy-check.ts
|
|
15525
|
-
import { execFileSync as
|
|
15527
|
+
import { execFileSync as execFileSync28 } from "child_process";
|
|
15526
15528
|
import * as fs38 from "fs";
|
|
15527
15529
|
async function checkUrl(url, timeout = 5e3) {
|
|
15528
15530
|
try {
|
|
@@ -15537,7 +15539,7 @@ async function checkUrl(url, timeout = 5e3) {
|
|
|
15537
15539
|
}
|
|
15538
15540
|
function getContainerUptime(runtime, containerName) {
|
|
15539
15541
|
try {
|
|
15540
|
-
const uptime =
|
|
15542
|
+
const uptime = execFileSync28(
|
|
15541
15543
|
runtime,
|
|
15542
15544
|
["ps", "--format", "{{.Status}}", "--filter", `name=${containerName}`],
|
|
15543
15545
|
{ encoding: "utf-8" }
|
|
@@ -15549,7 +15551,7 @@ function getContainerUptime(runtime, containerName) {
|
|
|
15549
15551
|
}
|
|
15550
15552
|
function getRecentLogs(runtime, containerName, lines = 20) {
|
|
15551
15553
|
try {
|
|
15552
|
-
const logs =
|
|
15554
|
+
const logs = execFileSync28(runtime, ["logs", "--tail", lines.toString(), containerName], { encoding: "utf-8" });
|
|
15553
15555
|
return logs;
|
|
15554
15556
|
} catch {
|
|
15555
15557
|
return void 0;
|
|
@@ -15576,7 +15578,7 @@ var init_proxy_check2 = __esm({
|
|
|
15576
15578
|
backendRouting: false
|
|
15577
15579
|
};
|
|
15578
15580
|
try {
|
|
15579
|
-
const containerId =
|
|
15581
|
+
const containerId = execFileSync28(runtime, ["ps", "-q", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15580
15582
|
if (containerId) {
|
|
15581
15583
|
healthCheck.containerRunning = true;
|
|
15582
15584
|
healthCheck.containerId = containerId.substring(0, 12);
|
|
@@ -15588,7 +15590,7 @@ var init_proxy_check2 = __esm({
|
|
|
15588
15590
|
}
|
|
15589
15591
|
}
|
|
15590
15592
|
} else {
|
|
15591
|
-
const stoppedContainer =
|
|
15593
|
+
const stoppedContainer = execFileSync28(runtime, ["ps", "-aq", "-f", `name=${containerName}`], { encoding: "utf-8" }).trim();
|
|
15592
15594
|
if (stoppedContainer) {
|
|
15593
15595
|
if (!service.quiet) {
|
|
15594
15596
|
printWarning(`Container ${containerName} exists but is not running`);
|
|
@@ -15758,7 +15760,7 @@ Proxy service ${service.name} is healthy`);
|
|
|
15758
15760
|
});
|
|
15759
15761
|
|
|
15760
15762
|
// src/platforms/container/handlers/inference-check.ts
|
|
15761
|
-
import { execFileSync as
|
|
15763
|
+
import { execFileSync as execFileSync29 } from "child_process";
|
|
15762
15764
|
var OLLAMA_DEFAULT_PORT3, checkInference2, preflightInferenceCheck2, inferenceCheckDescriptor2;
|
|
15763
15765
|
var init_inference_check2 = __esm({
|
|
15764
15766
|
"src/platforms/container/handlers/inference-check.ts"() {
|
|
@@ -15775,13 +15777,13 @@ var init_inference_check2 = __esm({
|
|
|
15775
15777
|
let containerId;
|
|
15776
15778
|
const modelAvailability = {};
|
|
15777
15779
|
try {
|
|
15778
|
-
const containerStatus =
|
|
15780
|
+
const containerStatus = execFileSync29(
|
|
15779
15781
|
runtime,
|
|
15780
15782
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15781
15783
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
15782
15784
|
).trim();
|
|
15783
15785
|
if (containerStatus === "running") {
|
|
15784
|
-
containerId =
|
|
15786
|
+
containerId = execFileSync29(
|
|
15785
15787
|
runtime,
|
|
15786
15788
|
["inspect", containerName, "--format", "{{.Id}}"],
|
|
15787
15789
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15811,7 +15813,7 @@ var init_inference_check2 = __esm({
|
|
|
15811
15813
|
let logs;
|
|
15812
15814
|
if (containerId) {
|
|
15813
15815
|
try {
|
|
15814
|
-
const output =
|
|
15816
|
+
const output = execFileSync29(
|
|
15815
15817
|
runtime,
|
|
15816
15818
|
["logs", "--tail", "10", containerName],
|
|
15817
15819
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }
|
|
@@ -15871,10 +15873,10 @@ var init_inference_check2 = __esm({
|
|
|
15871
15873
|
});
|
|
15872
15874
|
|
|
15873
15875
|
// src/platforms/container/handlers/inference-start.ts
|
|
15874
|
-
import { execFileSync as
|
|
15876
|
+
import { execFileSync as execFileSync30 } from "child_process";
|
|
15875
15877
|
function detectNvidiaGpu() {
|
|
15876
15878
|
try {
|
|
15877
|
-
|
|
15879
|
+
execFileSync30("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
15878
15880
|
stdio: ["ignore", "pipe", "ignore"]
|
|
15879
15881
|
});
|
|
15880
15882
|
return true;
|
|
@@ -15897,7 +15899,7 @@ var init_inference_start2 = __esm({
|
|
|
15897
15899
|
const port = serviceConfig.port || OLLAMA_DEFAULT_PORT4;
|
|
15898
15900
|
const image = serviceConfig.image || OLLAMA_IMAGE;
|
|
15899
15901
|
try {
|
|
15900
|
-
const output =
|
|
15902
|
+
const output = execFileSync30(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
15901
15903
|
if (output.includes(containerName)) {
|
|
15902
15904
|
if (!service.quiet) {
|
|
15903
15905
|
printWarning("Ollama container is already running");
|
|
@@ -15915,7 +15917,7 @@ var init_inference_start2 = __esm({
|
|
|
15915
15917
|
} catch {
|
|
15916
15918
|
}
|
|
15917
15919
|
try {
|
|
15918
|
-
|
|
15920
|
+
execFileSync30(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
15919
15921
|
} catch {
|
|
15920
15922
|
}
|
|
15921
15923
|
if (!service.quiet) {
|
|
@@ -15923,7 +15925,7 @@ var init_inference_start2 = __esm({
|
|
|
15923
15925
|
}
|
|
15924
15926
|
const gpuArgs = detectNvidiaGpu() ? ["--gpus", "all"] : [];
|
|
15925
15927
|
try {
|
|
15926
|
-
const containerId =
|
|
15928
|
+
const containerId = execFileSync30(runtime, [
|
|
15927
15929
|
"run",
|
|
15928
15930
|
"-d",
|
|
15929
15931
|
"--name",
|
|
@@ -15942,7 +15944,7 @@ var init_inference_start2 = __esm({
|
|
|
15942
15944
|
for (let i = 0; i < maxAttempts; i++) {
|
|
15943
15945
|
await new Promise((resolve12) => setTimeout(resolve12, 1e3));
|
|
15944
15946
|
try {
|
|
15945
|
-
const status =
|
|
15947
|
+
const status = execFileSync30(
|
|
15946
15948
|
runtime,
|
|
15947
15949
|
["inspect", containerName, "--format", "{{.State.Status}}"],
|
|
15948
15950
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -15962,7 +15964,7 @@ var init_inference_start2 = __esm({
|
|
|
15962
15964
|
}
|
|
15963
15965
|
if (!ready) {
|
|
15964
15966
|
try {
|
|
15965
|
-
|
|
15967
|
+
execFileSync30(runtime, ["rm", "-f", containerName], { stdio: "ignore" });
|
|
15966
15968
|
} catch {
|
|
15967
15969
|
}
|
|
15968
15970
|
return {
|
|
@@ -16024,7 +16026,7 @@ var init_inference_start2 = __esm({
|
|
|
16024
16026
|
});
|
|
16025
16027
|
|
|
16026
16028
|
// src/platforms/container/handlers/inference-stop.ts
|
|
16027
|
-
import { execFileSync as
|
|
16029
|
+
import { execFileSync as execFileSync31 } from "child_process";
|
|
16028
16030
|
var stopInference2, preflightInferenceStop, inferenceStopDescriptor2;
|
|
16029
16031
|
var init_inference_stop2 = __esm({
|
|
16030
16032
|
"src/platforms/container/handlers/inference-stop.ts"() {
|
|
@@ -16034,7 +16036,7 @@ var init_inference_stop2 = __esm({
|
|
|
16034
16036
|
stopInference2 = async (context) => {
|
|
16035
16037
|
const { service, runtime, options, containerName } = context;
|
|
16036
16038
|
try {
|
|
16037
|
-
const output =
|
|
16039
|
+
const output = execFileSync31(runtime, ["ps", "--format", "{{.Names}}"], { encoding: "utf-8" });
|
|
16038
16040
|
if (!output.includes(containerName)) {
|
|
16039
16041
|
if (!service.quiet) {
|
|
16040
16042
|
printWarning("Ollama container is not running");
|
|
@@ -16057,17 +16059,17 @@ var init_inference_stop2 = __esm({
|
|
|
16057
16059
|
if (!service.quiet) {
|
|
16058
16060
|
printInfo("Force stopping Ollama container...");
|
|
16059
16061
|
}
|
|
16060
|
-
|
|
16062
|
+
execFileSync31(runtime, ["rm", "-f", containerName], {
|
|
16061
16063
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16062
16064
|
});
|
|
16063
16065
|
} else {
|
|
16064
16066
|
if (!service.quiet) {
|
|
16065
16067
|
printInfo(`Stopping Ollama container gracefully (timeout: ${options.timeout}s)...`);
|
|
16066
16068
|
}
|
|
16067
|
-
|
|
16069
|
+
execFileSync31(runtime, ["stop", "-t", options.timeout.toString(), containerName], {
|
|
16068
16070
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16069
16071
|
});
|
|
16070
|
-
|
|
16072
|
+
execFileSync31(runtime, ["rm", containerName], {
|
|
16071
16073
|
stdio: "ignore"
|
|
16072
16074
|
});
|
|
16073
16075
|
}
|
|
@@ -16107,10 +16109,10 @@ var init_inference_stop2 = __esm({
|
|
|
16107
16109
|
});
|
|
16108
16110
|
|
|
16109
16111
|
// src/platforms/container/handlers/inference-provision.ts
|
|
16110
|
-
import { execFileSync as
|
|
16112
|
+
import { execFileSync as execFileSync32 } from "child_process";
|
|
16111
16113
|
function detectGpu2(runtime) {
|
|
16112
16114
|
try {
|
|
16113
|
-
const output =
|
|
16115
|
+
const output = execFileSync32(runtime, ["info", "--format", "{{.Runtimes}}"], {
|
|
16114
16116
|
encoding: "utf-8",
|
|
16115
16117
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16116
16118
|
}).trim();
|
|
@@ -16120,7 +16122,7 @@ function detectGpu2(runtime) {
|
|
|
16120
16122
|
} catch {
|
|
16121
16123
|
}
|
|
16122
16124
|
try {
|
|
16123
|
-
const gpuName =
|
|
16125
|
+
const gpuName = execFileSync32("nvidia-smi", ["--query-gpu=name", "--format=csv,noheader"], {
|
|
16124
16126
|
encoding: "utf-8",
|
|
16125
16127
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16126
16128
|
}).trim();
|
|
@@ -16155,7 +16157,7 @@ var init_inference_provision2 = __esm({
|
|
|
16155
16157
|
printInfo(`Pulling ${image}...`);
|
|
16156
16158
|
}
|
|
16157
16159
|
try {
|
|
16158
|
-
|
|
16160
|
+
execFileSync32(runtime, ["pull", image], {
|
|
16159
16161
|
stdio: service.quiet ? "ignore" : "inherit"
|
|
16160
16162
|
});
|
|
16161
16163
|
} catch (error) {
|
|
@@ -16166,7 +16168,7 @@ var init_inference_provision2 = __esm({
|
|
|
16166
16168
|
};
|
|
16167
16169
|
}
|
|
16168
16170
|
try {
|
|
16169
|
-
|
|
16171
|
+
execFileSync32(runtime, ["volume", "create", VOLUME_NAME2], {
|
|
16170
16172
|
stdio: "ignore"
|
|
16171
16173
|
});
|
|
16172
16174
|
} catch {
|
|
@@ -16177,7 +16179,7 @@ var init_inference_provision2 = __esm({
|
|
|
16177
16179
|
printInfo(`Pulling model ${model} (this may take several minutes)...`);
|
|
16178
16180
|
}
|
|
16179
16181
|
try {
|
|
16180
|
-
|
|
16182
|
+
execFileSync32(runtime, [
|
|
16181
16183
|
"run",
|
|
16182
16184
|
"--rm",
|
|
16183
16185
|
"-v",
|
|
@@ -16297,7 +16299,7 @@ var init_handlers2 = __esm({
|
|
|
16297
16299
|
});
|
|
16298
16300
|
|
|
16299
16301
|
// src/platforms/container/platform.ts
|
|
16300
|
-
import { execFileSync as
|
|
16302
|
+
import { execFileSync as execFileSync33 } from "child_process";
|
|
16301
16303
|
var ContainerPlatform;
|
|
16302
16304
|
var init_platform3 = __esm({
|
|
16303
16305
|
"src/platforms/container/platform.ts"() {
|
|
@@ -16325,11 +16327,11 @@ var init_platform3 = __esm({
|
|
|
16325
16327
|
*/
|
|
16326
16328
|
detectContainerRuntime() {
|
|
16327
16329
|
try {
|
|
16328
|
-
|
|
16330
|
+
execFileSync33("docker", ["--version"], { stdio: "ignore" });
|
|
16329
16331
|
return "docker";
|
|
16330
16332
|
} catch {
|
|
16331
16333
|
try {
|
|
16332
|
-
|
|
16334
|
+
execFileSync33("podman", ["--version"], { stdio: "ignore" });
|
|
16333
16335
|
return "podman";
|
|
16334
16336
|
} catch {
|
|
16335
16337
|
throw new Error("No container runtime (Docker or Podman) found");
|
|
@@ -16355,7 +16357,7 @@ var init_platform3 = __esm({
|
|
|
16355
16357
|
return false;
|
|
16356
16358
|
}
|
|
16357
16359
|
try {
|
|
16358
|
-
const status =
|
|
16360
|
+
const status = execFileSync33(
|
|
16359
16361
|
this.runtime,
|
|
16360
16362
|
["inspect", containerId, "--format", "{{.State.Status}}"],
|
|
16361
16363
|
{ encoding: "utf-8", stdio: "pipe" }
|
|
@@ -16417,7 +16419,7 @@ var init_platform3 = __esm({
|
|
|
16417
16419
|
if (since) {
|
|
16418
16420
|
args.push("--since", since.toISOString());
|
|
16419
16421
|
}
|
|
16420
|
-
const output =
|
|
16422
|
+
const output = execFileSync33(this.runtime, args, {
|
|
16421
16423
|
encoding: "utf-8",
|
|
16422
16424
|
stdio: ["ignore", "pipe", "pipe"]
|
|
16423
16425
|
// Capture both stdout and stderr
|
|
@@ -16635,7 +16637,7 @@ var init_lambda_check = __esm({
|
|
|
16635
16637
|
});
|
|
16636
16638
|
|
|
16637
16639
|
// src/platforms/aws/handlers/ecs-check.ts
|
|
16638
|
-
import { execFileSync as
|
|
16640
|
+
import { execFileSync as execFileSync34 } from "child_process";
|
|
16639
16641
|
import { DescribeServicesCommand } from "@aws-sdk/client-ecs";
|
|
16640
16642
|
import { DescribeTargetHealthCommand } from "@aws-sdk/client-elastic-load-balancing-v2";
|
|
16641
16643
|
import { FilterLogEventsCommand as FilterLogEventsCommand2 } from "@aws-sdk/client-cloudwatch-logs";
|
|
@@ -16687,7 +16689,7 @@ var init_ecs_check = __esm({
|
|
|
16687
16689
|
let imageTag = "unknown";
|
|
16688
16690
|
if (activeDeployment?.taskDefinition) {
|
|
16689
16691
|
try {
|
|
16690
|
-
const taskDefJson =
|
|
16692
|
+
const taskDefJson = execFileSync34("aws", [
|
|
16691
16693
|
"ecs",
|
|
16692
16694
|
"describe-task-definition",
|
|
16693
16695
|
"--task-definition",
|
|
@@ -16946,10 +16948,10 @@ var init_rds_check = __esm({
|
|
|
16946
16948
|
});
|
|
16947
16949
|
|
|
16948
16950
|
// src/platforms/aws/handlers/s3-cloudfront-check.ts
|
|
16949
|
-
import { execFileSync as
|
|
16951
|
+
import { execFileSync as execFileSync35 } from "child_process";
|
|
16950
16952
|
async function getCloudFrontDistribution(bucketName, region) {
|
|
16951
16953
|
try {
|
|
16952
|
-
const distributionId =
|
|
16954
|
+
const distributionId = execFileSync35("aws", [
|
|
16953
16955
|
"cloudfront",
|
|
16954
16956
|
"list-distributions",
|
|
16955
16957
|
"--query",
|
|
@@ -16966,7 +16968,7 @@ async function getCloudFrontDistribution(bucketName, region) {
|
|
|
16966
16968
|
}
|
|
16967
16969
|
async function getCloudFrontStatus(distributionId, region) {
|
|
16968
16970
|
try {
|
|
16969
|
-
const status =
|
|
16971
|
+
const status = execFileSync35("aws", [
|
|
16970
16972
|
"cloudfront",
|
|
16971
16973
|
"get-distribution",
|
|
16972
16974
|
"--id",
|
|
@@ -16993,7 +16995,7 @@ var init_s3_cloudfront_check = __esm({
|
|
|
16993
16995
|
const { service, region, resourceName } = context;
|
|
16994
16996
|
const bucketName = `${resourceName}-static`;
|
|
16995
16997
|
try {
|
|
16996
|
-
|
|
16998
|
+
execFileSync35("aws", ["s3api", "head-bucket", "--bucket", bucketName, "--region", region], {
|
|
16997
16999
|
stdio: ["pipe", "pipe", "ignore"]
|
|
16998
17000
|
});
|
|
16999
17001
|
const status = "running";
|
|
@@ -17228,7 +17230,7 @@ var init_neptune_check = __esm({
|
|
|
17228
17230
|
});
|
|
17229
17231
|
|
|
17230
17232
|
// src/platforms/aws/handlers/ecs-start.ts
|
|
17231
|
-
import { execFileSync as
|
|
17233
|
+
import { execFileSync as execFileSync36 } from "child_process";
|
|
17232
17234
|
var startECSService, preflightEcsStart, ecsFargateStartDescriptor, ecsStartDescriptor;
|
|
17233
17235
|
var init_ecs_start = __esm({
|
|
17234
17236
|
"src/platforms/aws/handlers/ecs-start.ts"() {
|
|
@@ -17243,7 +17245,7 @@ var init_ecs_start = __esm({
|
|
|
17243
17245
|
const serviceName = cfnDiscoveredResources?.serviceName || resourceName;
|
|
17244
17246
|
const desiredCount = requirements.resources?.replicas || 1;
|
|
17245
17247
|
try {
|
|
17246
|
-
|
|
17248
|
+
execFileSync36("aws", [
|
|
17247
17249
|
"ecs",
|
|
17248
17250
|
"update-service",
|
|
17249
17251
|
"--cluster",
|
|
@@ -17258,7 +17260,7 @@ var init_ecs_start = __esm({
|
|
|
17258
17260
|
let endpoint;
|
|
17259
17261
|
if (requirements.network?.needsLoadBalancer) {
|
|
17260
17262
|
try {
|
|
17261
|
-
const albDns =
|
|
17263
|
+
const albDns = execFileSync36("aws", [
|
|
17262
17264
|
"elbv2",
|
|
17263
17265
|
"describe-load-balancers",
|
|
17264
17266
|
"--names",
|
|
@@ -17330,7 +17332,7 @@ var init_ecs_start = __esm({
|
|
|
17330
17332
|
});
|
|
17331
17333
|
|
|
17332
17334
|
// src/platforms/aws/handlers/rds-start.ts
|
|
17333
|
-
import { execFileSync as
|
|
17335
|
+
import { execFileSync as execFileSync37 } from "child_process";
|
|
17334
17336
|
var startRDSInstance, preflightRdsStart, rdsStartDescriptor;
|
|
17335
17337
|
var init_rds_start = __esm({
|
|
17336
17338
|
"src/platforms/aws/handlers/rds-start.ts"() {
|
|
@@ -17343,7 +17345,7 @@ var init_rds_start = __esm({
|
|
|
17343
17345
|
const resourceName = `semiont-${service.name}-${service.environment}`;
|
|
17344
17346
|
const instanceId = `${resourceName}-db`;
|
|
17345
17347
|
try {
|
|
17346
|
-
|
|
17348
|
+
execFileSync37("aws", ["rds", "start-db-instance", "--db-instance-identifier", instanceId, "--region", region], {
|
|
17347
17349
|
encoding: "utf-8"
|
|
17348
17350
|
});
|
|
17349
17351
|
if (!service.quiet) {
|
|
@@ -17351,7 +17353,7 @@ var init_rds_start = __esm({
|
|
|
17351
17353
|
}
|
|
17352
17354
|
let endpoint;
|
|
17353
17355
|
try {
|
|
17354
|
-
endpoint =
|
|
17356
|
+
endpoint = execFileSync37("aws", [
|
|
17355
17357
|
"rds",
|
|
17356
17358
|
"describe-db-instances",
|
|
17357
17359
|
"--db-instance-identifier",
|
|
@@ -17585,7 +17587,7 @@ var init_stack_provision = __esm({
|
|
|
17585
17587
|
});
|
|
17586
17588
|
|
|
17587
17589
|
// src/platforms/aws/handlers/ecs-publish.ts
|
|
17588
|
-
import { execFileSync as
|
|
17590
|
+
import { execFileSync as execFileSync38, spawnSync as spawnSync3 } from "child_process";
|
|
17589
17591
|
import * as path33 from "path";
|
|
17590
17592
|
import * as fs40 from "fs";
|
|
17591
17593
|
async function createNewTaskDefinition(service, imageUri, region, _accountId, cfnDiscoveredResources, resourceName) {
|
|
@@ -17597,7 +17599,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17597
17599
|
console.warn(` \u26A0\uFE0F Could not find ECS service name for ${service.name}`);
|
|
17598
17600
|
return "";
|
|
17599
17601
|
}
|
|
17600
|
-
const serviceJson =
|
|
17602
|
+
const serviceJson = execFileSync38("aws", [
|
|
17601
17603
|
"ecs",
|
|
17602
17604
|
"describe-services",
|
|
17603
17605
|
"--cluster",
|
|
@@ -17615,7 +17617,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17615
17617
|
console.warn(` \u26A0\uFE0F Could not find task definition for ${serviceName}`);
|
|
17616
17618
|
return "";
|
|
17617
17619
|
}
|
|
17618
|
-
const taskDefJson =
|
|
17620
|
+
const taskDefJson = execFileSync38("aws", [
|
|
17619
17621
|
"ecs",
|
|
17620
17622
|
"describe-task-definition",
|
|
17621
17623
|
"--task-definition",
|
|
@@ -17646,7 +17648,7 @@ async function createNewTaskDefinition(service, imageUri, region, _accountId, cf
|
|
|
17646
17648
|
memory: taskDef.memory,
|
|
17647
17649
|
runtimePlatform: taskDef.runtimePlatform
|
|
17648
17650
|
};
|
|
17649
|
-
const registerOutput =
|
|
17651
|
+
const registerOutput = execFileSync38("aws", [
|
|
17650
17652
|
"ecs",
|
|
17651
17653
|
"register-task-definition",
|
|
17652
17654
|
"--cli-input-json",
|
|
@@ -17686,7 +17688,7 @@ var init_ecs_publish = __esm({
|
|
|
17686
17688
|
const deploymentStrategy = envConfig.deployment?.imageTagStrategy || "mutable";
|
|
17687
17689
|
if (deploymentStrategy === "immutable" || deploymentStrategy === "git-hash") {
|
|
17688
17690
|
try {
|
|
17689
|
-
const gitHash =
|
|
17691
|
+
const gitHash = execFileSync38("git", ["rev-parse", "--short", "HEAD"], {
|
|
17690
17692
|
encoding: "utf-8",
|
|
17691
17693
|
cwd: service.projectRoot
|
|
17692
17694
|
}).trim();
|
|
@@ -17706,7 +17708,7 @@ var init_ecs_publish = __esm({
|
|
|
17706
17708
|
const ecrRepo = `semiont-${service.name}`;
|
|
17707
17709
|
const imageUri = `${accountId}.dkr.ecr.${region}.amazonaws.com/${ecrRepo}:${version}`;
|
|
17708
17710
|
try {
|
|
17709
|
-
|
|
17711
|
+
execFileSync38("aws", ["ecr", "create-repository", "--repository-name", ecrRepo, "--region", region]);
|
|
17710
17712
|
} catch {
|
|
17711
17713
|
}
|
|
17712
17714
|
if (service.verbose) {
|
|
@@ -17745,7 +17747,7 @@ var init_ecs_publish = __esm({
|
|
|
17745
17747
|
try {
|
|
17746
17748
|
const apiTypesPath = path33.join(buildContext, "packages", "api-types");
|
|
17747
17749
|
if (fs40.existsSync(apiTypesPath)) {
|
|
17748
|
-
|
|
17750
|
+
execFileSync38("npm", ["run", "build"], {
|
|
17749
17751
|
cwd: apiTypesPath,
|
|
17750
17752
|
env: buildEnv,
|
|
17751
17753
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -17753,7 +17755,7 @@ var init_ecs_publish = __esm({
|
|
|
17753
17755
|
}
|
|
17754
17756
|
const appPath = path33.join(buildContext, "apps", service.name);
|
|
17755
17757
|
if (fs40.existsSync(appPath)) {
|
|
17756
|
-
|
|
17758
|
+
execFileSync38("npm", ["run", "build"], {
|
|
17757
17759
|
cwd: appPath,
|
|
17758
17760
|
env: buildEnv,
|
|
17759
17761
|
stdio: service.verbose ? "inherit" : "pipe"
|
|
@@ -17769,7 +17771,7 @@ var init_ecs_publish = __esm({
|
|
|
17769
17771
|
};
|
|
17770
17772
|
}
|
|
17771
17773
|
try {
|
|
17772
|
-
const ecrPassword =
|
|
17774
|
+
const ecrPassword = execFileSync38("aws", [
|
|
17773
17775
|
"ecr",
|
|
17774
17776
|
"get-login-password",
|
|
17775
17777
|
"--region",
|
|
@@ -17797,8 +17799,8 @@ var init_ecs_publish = __esm({
|
|
|
17797
17799
|
if (service.verbose) {
|
|
17798
17800
|
console.log(`[DEBUG] Docker build args: ${dockerBuildArgs.join(" ")}`);
|
|
17799
17801
|
}
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
+
execFileSync38("docker", dockerBuildArgs, { stdio: service.verbose ? "inherit" : "pipe" });
|
|
17803
|
+
execFileSync38("docker", ["push", imageUri], { stdio: service.verbose ? "inherit" : "pipe" });
|
|
17802
17804
|
artifacts.imageTag = version;
|
|
17803
17805
|
artifacts.imageUrl = imageUri;
|
|
17804
17806
|
const newTaskDefRevision = await createNewTaskDefinition(service, imageUri, region, accountId, cfnDiscoveredResources, resourceName);
|
|
@@ -17865,10 +17867,10 @@ var init_ecs_publish = __esm({
|
|
|
17865
17867
|
});
|
|
17866
17868
|
|
|
17867
17869
|
// src/platforms/aws/handlers/ecs-update.ts
|
|
17868
|
-
import { execFileSync as
|
|
17870
|
+
import { execFileSync as execFileSync39 } from "child_process";
|
|
17869
17871
|
async function getCurrentTaskDefinition(cluster, service, region) {
|
|
17870
17872
|
try {
|
|
17871
|
-
const taskDef =
|
|
17873
|
+
const taskDef = execFileSync39("aws", ["ecs", "describe-services", "--cluster", cluster, "--services", service, "--query", "services[0].taskDefinition", "--output", "text", "--region", region], { encoding: "utf-8" }).trim();
|
|
17872
17874
|
return taskDef.split(":").pop() || "";
|
|
17873
17875
|
} catch {
|
|
17874
17876
|
return "";
|
|
@@ -17876,7 +17878,7 @@ async function getCurrentTaskDefinition(cluster, service, region) {
|
|
|
17876
17878
|
}
|
|
17877
17879
|
async function getTaskDefinitionFamily(cluster, service, region) {
|
|
17878
17880
|
try {
|
|
17879
|
-
const taskDefArn =
|
|
17881
|
+
const taskDefArn = execFileSync39("aws", ["ecs", "describe-services", "--cluster", cluster, "--services", service, "--query", "services[0].taskDefinition", "--output", "text", "--region", region], { encoding: "utf-8" }).trim();
|
|
17880
17882
|
const parts = taskDefArn.split("/");
|
|
17881
17883
|
if (parts.length > 1) {
|
|
17882
17884
|
return parts[1].split(":")[0];
|
|
@@ -17890,7 +17892,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
17890
17892
|
try {
|
|
17891
17893
|
const family = await getTaskDefinitionFamily(cluster, service, region);
|
|
17892
17894
|
if (!family) return "";
|
|
17893
|
-
const taskDefArn =
|
|
17895
|
+
const taskDefArn = execFileSync39("aws", [
|
|
17894
17896
|
"ecs",
|
|
17895
17897
|
"list-task-definitions",
|
|
17896
17898
|
"--family-prefix",
|
|
@@ -17916,7 +17918,7 @@ async function getLatestTaskDefinitionRevision(cluster, service, region) {
|
|
|
17916
17918
|
async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
17917
17919
|
try {
|
|
17918
17920
|
const taskId = taskArn.split("/").pop();
|
|
17919
|
-
const taskDetails =
|
|
17921
|
+
const taskDetails = execFileSync39("aws", [
|
|
17920
17922
|
"ecs",
|
|
17921
17923
|
"describe-tasks",
|
|
17922
17924
|
"--cluster",
|
|
@@ -17932,7 +17934,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
17932
17934
|
if (!task) {
|
|
17933
17935
|
return [];
|
|
17934
17936
|
}
|
|
17935
|
-
const taskDefDetails =
|
|
17937
|
+
const taskDefDetails = execFileSync39("aws", [
|
|
17936
17938
|
"ecs",
|
|
17937
17939
|
"describe-task-definition",
|
|
17938
17940
|
"--task-definition",
|
|
@@ -17955,7 +17957,7 @@ async function fetchTaskLogs(clusterName, taskArn, region, verbose = false) {
|
|
|
17955
17957
|
}
|
|
17956
17958
|
const containerName = mainContainer.name;
|
|
17957
17959
|
const logStream = `${streamPrefix}/${containerName}/${taskId}`;
|
|
17958
|
-
const logsJson =
|
|
17960
|
+
const logsJson = execFileSync39("aws", [
|
|
17959
17961
|
"logs",
|
|
17960
17962
|
"filter-log-events",
|
|
17961
17963
|
"--log-group-name",
|
|
@@ -17990,7 +17992,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
17990
17992
|
let failedTaskInfo = [];
|
|
17991
17993
|
while (Date.now() - startTime < effectiveTimeout * 1e3) {
|
|
17992
17994
|
try {
|
|
17993
|
-
const serviceData =
|
|
17995
|
+
const serviceData = execFileSync39("aws", [
|
|
17994
17996
|
"ecs",
|
|
17995
17997
|
"describe-services",
|
|
17996
17998
|
"--cluster",
|
|
@@ -18039,7 +18041,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18039
18041
|
const ourRevision = ourDeployment.taskDefinition?.split(":").pop() || "unknown";
|
|
18040
18042
|
const oldRevisions = /* @__PURE__ */ new Set();
|
|
18041
18043
|
try {
|
|
18042
|
-
const stoppedTasksData =
|
|
18044
|
+
const stoppedTasksData = execFileSync39("aws", [
|
|
18043
18045
|
"ecs",
|
|
18044
18046
|
"list-tasks",
|
|
18045
18047
|
"--cluster",
|
|
@@ -18055,7 +18057,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18055
18057
|
], { encoding: "utf-8" });
|
|
18056
18058
|
const stoppedTaskArns = JSON.parse(stoppedTasksData).taskArns || [];
|
|
18057
18059
|
if (stoppedTaskArns.length > 0) {
|
|
18058
|
-
const stoppedTasksJson =
|
|
18060
|
+
const stoppedTasksJson = execFileSync39("aws", [
|
|
18059
18061
|
"ecs",
|
|
18060
18062
|
"describe-tasks",
|
|
18061
18063
|
"--cluster",
|
|
@@ -18144,7 +18146,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18144
18146
|
}
|
|
18145
18147
|
}
|
|
18146
18148
|
try {
|
|
18147
|
-
const tasksData =
|
|
18149
|
+
const tasksData = execFileSync39("aws", [
|
|
18148
18150
|
"ecs",
|
|
18149
18151
|
"list-tasks",
|
|
18150
18152
|
"--cluster",
|
|
@@ -18160,7 +18162,7 @@ async function waitForECSDeployment(clusterName, serviceName, deploymentId, regi
|
|
|
18160
18162
|
], { encoding: "utf-8" });
|
|
18161
18163
|
const taskArns = JSON.parse(tasksData).taskArns || [];
|
|
18162
18164
|
if (taskArns.length > 0) {
|
|
18163
|
-
const taskDetailsJson =
|
|
18165
|
+
const taskDetailsJson = execFileSync39("aws", [
|
|
18164
18166
|
"ecs",
|
|
18165
18167
|
"describe-tasks",
|
|
18166
18168
|
"--cluster",
|
|
@@ -18379,13 +18381,13 @@ var init_ecs_update = __esm({
|
|
|
18379
18381
|
printInfo(`No newer task definition found. Forcing redeployment of current revision ${currentRevision}`);
|
|
18380
18382
|
}
|
|
18381
18383
|
}
|
|
18382
|
-
const updateResult =
|
|
18384
|
+
const updateResult = execFileSync39("aws", updateArgs, { encoding: "utf-8" });
|
|
18383
18385
|
if (service.verbose) {
|
|
18384
18386
|
try {
|
|
18385
|
-
const serviceData =
|
|
18387
|
+
const serviceData = execFileSync39("aws", ["ecs", "describe-services", "--cluster", clusterName, "--services", serviceName, "--region", region, "--output", "json"], { encoding: "utf-8" });
|
|
18386
18388
|
const ecsService = JSON.parse(serviceData).services?.[0];
|
|
18387
18389
|
if (ecsService?.taskDefinition) {
|
|
18388
|
-
const currentTaskDef =
|
|
18390
|
+
const currentTaskDef = execFileSync39("aws", ["ecs", "describe-task-definition", "--task-definition", ecsService.taskDefinition, "--region", region, "--output", "json"], { encoding: "utf-8" });
|
|
18389
18391
|
const taskDef = JSON.parse(currentTaskDef).taskDefinition;
|
|
18390
18392
|
const images = taskDef.containerDefinitions?.map((c) => c.image).filter(Boolean);
|
|
18391
18393
|
if (images?.length > 0) {
|
|
@@ -18513,10 +18515,10 @@ __export(credential_validator_exports, {
|
|
|
18513
18515
|
isAWSCliInstalled: () => isAWSCliInstalled,
|
|
18514
18516
|
validateAWSCredentials: () => validateAWSCredentials
|
|
18515
18517
|
});
|
|
18516
|
-
import { execFileSync as
|
|
18518
|
+
import { execFileSync as execFileSync40 } from "child_process";
|
|
18517
18519
|
async function validateAWSCredentials(_environment) {
|
|
18518
18520
|
try {
|
|
18519
|
-
const output =
|
|
18521
|
+
const output = execFileSync40("aws", ["sts", "get-caller-identity", "--output", "json"], {
|
|
18520
18522
|
stdio: ["pipe", "pipe", "pipe"],
|
|
18521
18523
|
encoding: "utf8",
|
|
18522
18524
|
env: {
|
|
@@ -18559,7 +18561,7 @@ async function validateAWSCredentials(_environment) {
|
|
|
18559
18561
|
}
|
|
18560
18562
|
function isAWSCliInstalled() {
|
|
18561
18563
|
try {
|
|
18562
|
-
|
|
18564
|
+
execFileSync40("aws", ["--version"], { stdio: "ignore" });
|
|
18563
18565
|
return true;
|
|
18564
18566
|
} catch {
|
|
18565
18567
|
return false;
|
|
@@ -18567,7 +18569,7 @@ function isAWSCliInstalled() {
|
|
|
18567
18569
|
}
|
|
18568
18570
|
function getAWSProfiles() {
|
|
18569
18571
|
try {
|
|
18570
|
-
const output =
|
|
18572
|
+
const output = execFileSync40("aws", ["configure", "list-profiles"], {
|
|
18571
18573
|
stdio: "pipe",
|
|
18572
18574
|
encoding: "utf8"
|
|
18573
18575
|
});
|
|
@@ -27018,7 +27020,7 @@ var require_package = __commonJS({
|
|
|
27018
27020
|
"package.json"(exports, module) {
|
|
27019
27021
|
module.exports = {
|
|
27020
27022
|
name: "@semiont/cli",
|
|
27021
|
-
version: "0.4.
|
|
27023
|
+
version: "0.4.1",
|
|
27022
27024
|
description: "Semiont CLI - Unified environment management tool",
|
|
27023
27025
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
27024
27026
|
type: "module",
|
|
@@ -27082,12 +27084,12 @@ var require_package = __commonJS({
|
|
|
27082
27084
|
"@aws-sdk/client-secrets-manager": "^3.600.0",
|
|
27083
27085
|
"@aws-sdk/client-sts": "^3.859.0",
|
|
27084
27086
|
"@aws-sdk/client-wafv2": "^3.859.0",
|
|
27085
|
-
"@semiont/api-client": "^0.4.
|
|
27086
|
-
"@semiont/content": "^0.4.
|
|
27087
|
-
"@semiont/core": "^0.4.
|
|
27088
|
-
"@semiont/event-sourcing": "^0.4.
|
|
27089
|
-
"@semiont/graph": "^0.4.
|
|
27090
|
-
"@semiont/make-meaning": "^0.4.
|
|
27087
|
+
"@semiont/api-client": "^0.4.1",
|
|
27088
|
+
"@semiont/content": "^0.4.1",
|
|
27089
|
+
"@semiont/core": "^0.4.1",
|
|
27090
|
+
"@semiont/event-sourcing": "^0.4.1",
|
|
27091
|
+
"@semiont/graph": "^0.4.1",
|
|
27092
|
+
"@semiont/make-meaning": "^0.4.1",
|
|
27091
27093
|
"@vitest/ui": "4.0.18",
|
|
27092
27094
|
arg: "^5.0.2",
|
|
27093
27095
|
argon2: "^0.44.0",
|
|
@@ -29003,13 +29005,9 @@ init_base_options_schema();
|
|
|
29003
29005
|
import * as fs49 from "fs";
|
|
29004
29006
|
import * as path42 from "path";
|
|
29005
29007
|
import * as readline2 from "readline";
|
|
29006
|
-
import { execFileSync as
|
|
29007
|
-
import { SemiontProject as SemiontProject20 } from "@semiont/core/node";
|
|
29008
|
+
import { execFileSync as execFileSync41 } from "child_process";
|
|
29008
29009
|
var LocalOptionsSchema = BaseOptionsSchema.extend({
|
|
29009
29010
|
directory: external_exports.string().optional(),
|
|
29010
|
-
email: external_exports.string().optional(),
|
|
29011
|
-
password: external_exports.string().optional(),
|
|
29012
|
-
generatePassword: external_exports.boolean().default(true),
|
|
29013
29011
|
yes: external_exports.boolean().default(false)
|
|
29014
29012
|
}).transform((data) => ({
|
|
29015
29013
|
...data,
|
|
@@ -29024,34 +29022,8 @@ function prompt2(question) {
|
|
|
29024
29022
|
});
|
|
29025
29023
|
});
|
|
29026
29024
|
}
|
|
29027
|
-
function promptPassword(question) {
|
|
29028
|
-
return new Promise((resolve12) => {
|
|
29029
|
-
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
29030
|
-
process.stdout.write(question);
|
|
29031
|
-
let password = "";
|
|
29032
|
-
process.stdin.setRawMode?.(true);
|
|
29033
|
-
process.stdin.resume();
|
|
29034
|
-
process.stdin.setEncoding("utf8");
|
|
29035
|
-
const onData = (ch) => {
|
|
29036
|
-
if (ch === "\n" || ch === "\r" || ch === "") {
|
|
29037
|
-
process.stdin.setRawMode?.(false);
|
|
29038
|
-
process.stdin.pause();
|
|
29039
|
-
process.stdin.removeListener("data", onData);
|
|
29040
|
-
process.stdout.write("\n");
|
|
29041
|
-
rl.close();
|
|
29042
|
-
resolve12(password);
|
|
29043
|
-
} else if (ch === "\x7F") {
|
|
29044
|
-
password = password.slice(0, -1);
|
|
29045
|
-
} else {
|
|
29046
|
-
password += ch;
|
|
29047
|
-
process.stdout.write("*");
|
|
29048
|
-
}
|
|
29049
|
-
};
|
|
29050
|
-
process.stdin.on("data", onData);
|
|
29051
|
-
});
|
|
29052
|
-
}
|
|
29053
29025
|
function runSemiont(args, env, captureOutput = false) {
|
|
29054
|
-
return
|
|
29026
|
+
return execFileSync41("semiont", args, {
|
|
29055
29027
|
env,
|
|
29056
29028
|
stdio: captureOutput ? "pipe" : "inherit",
|
|
29057
29029
|
encoding: "utf8"
|
|
@@ -29059,7 +29031,7 @@ function runSemiont(args, env, captureOutput = false) {
|
|
|
29059
29031
|
}
|
|
29060
29032
|
function runSemiontSafe(args, env) {
|
|
29061
29033
|
try {
|
|
29062
|
-
const output =
|
|
29034
|
+
const output = execFileSync41("semiont", args, {
|
|
29063
29035
|
env,
|
|
29064
29036
|
stdio: "pipe",
|
|
29065
29037
|
encoding: "utf8"
|
|
@@ -29251,45 +29223,21 @@ Press Enter to create one in ${colors.bright}${defaultPath}${colors.reset}, or t
|
|
|
29251
29223
|
}
|
|
29252
29224
|
}
|
|
29253
29225
|
console.log("");
|
|
29254
|
-
const
|
|
29255
|
-
|
|
29256
|
-
|
|
29257
|
-
|
|
29258
|
-
|
|
29226
|
+
const adminEmail = "admin@example.com";
|
|
29227
|
+
const adminPassword = "password";
|
|
29228
|
+
console.log(`${colors.cyan}\u25B6 Creating admin user...${colors.reset}`);
|
|
29229
|
+
const useraddResult = runSemiontSafe(
|
|
29230
|
+
["useradd", "--email", adminEmail, "--password", adminPassword, "--admin"],
|
|
29231
|
+
env
|
|
29232
|
+
);
|
|
29233
|
+
if (useraddResult.success) {
|
|
29234
|
+
console.log(`${colors.green}\u2713${colors.reset} Admin user created
|
|
29259
29235
|
`);
|
|
29260
29236
|
} else {
|
|
29261
|
-
console.log(`${colors.
|
|
29262
|
-
|
|
29263
|
-
if (!email) {
|
|
29264
|
-
const answer = options.yes ? "" : await prompt2(` Admin email [admin@local]: `);
|
|
29265
|
-
email = answer || "admin@local";
|
|
29266
|
-
}
|
|
29267
|
-
let generatePassword2 = options.generatePassword;
|
|
29268
|
-
if (!options.password && !options.yes) {
|
|
29269
|
-
const answer = await prompt2(` Generate password? [Y/n]: `);
|
|
29270
|
-
generatePassword2 = answer === "" || answer.toLowerCase() === "y";
|
|
29271
|
-
}
|
|
29272
|
-
const useraddArgs = ["useradd", "--email", email, "--admin"];
|
|
29273
|
-
if (generatePassword2) {
|
|
29274
|
-
useraddArgs.push("--generate-password");
|
|
29275
|
-
} else {
|
|
29276
|
-
const pw = options.password || await promptPassword(` Password: `);
|
|
29277
|
-
useraddArgs.push("--password", pw);
|
|
29278
|
-
}
|
|
29279
|
-
const useraddResult = runSemiontSafe(useraddArgs, env);
|
|
29280
|
-
if (useraddResult.success) {
|
|
29281
|
-
const output = useraddResult.output;
|
|
29282
|
-
console.log(output);
|
|
29283
|
-
fs49.writeFileSync(credentialsPath, output, { mode: 384 });
|
|
29284
|
-
console.log(`${colors.green}\u2713${colors.reset} Credentials saved to ${credentialsPath}`);
|
|
29285
|
-
console.log(`${colors.yellow} \u26A0 credentials.txt contains a plaintext password \u2014 keep it safe${colors.reset}
|
|
29286
|
-
`);
|
|
29287
|
-
} else {
|
|
29288
|
-
console.log(`${colors.yellow}\u26A0 useradd failed: ${useraddResult.error}${colors.reset}`);
|
|
29289
|
-
console.log(` Run manually: semiont useradd --email <email> --generate-password --admin
|
|
29237
|
+
console.log(`${colors.yellow}\u26A0 useradd failed: ${useraddResult.error}${colors.reset}`);
|
|
29238
|
+
console.log(` Run manually: semiont useradd --email ${adminEmail} --password ${adminPassword} --admin
|
|
29290
29239
|
`);
|
|
29291
|
-
|
|
29292
|
-
}
|
|
29240
|
+
warnings.push(`useradd failed: ${useraddResult.error}`);
|
|
29293
29241
|
}
|
|
29294
29242
|
console.log(`${colors.cyan}\u25B6 Final service check...${colors.reset}
|
|
29295
29243
|
`);
|
|
@@ -29297,7 +29245,8 @@ Press Enter to create one in ${colors.bright}${defaultPath}${colors.reset}, or t
|
|
|
29297
29245
|
console.log(`
|
|
29298
29246
|
${colors.bright}${colors.green}\u2713 Semiont is running at http://localhost:8080${colors.reset}
|
|
29299
29247
|
`);
|
|
29300
|
-
console.log(`
|
|
29248
|
+
console.log(` Admin email: ${adminEmail}`);
|
|
29249
|
+
console.log(` Admin password: ${adminPassword}`);
|
|
29301
29250
|
if (warnings.length > 0) {
|
|
29302
29251
|
console.log(`
|
|
29303
29252
|
${colors.yellow}Warnings:${colors.reset}`);
|
|
@@ -29313,7 +29262,7 @@ To persist your environment across sessions, add to your shell profile:`);
|
|
|
29313
29262
|
}
|
|
29314
29263
|
}
|
|
29315
29264
|
results.summary.succeeded = 1;
|
|
29316
|
-
results.metadata = { semiotRoot, semiotEnv
|
|
29265
|
+
results.metadata = { semiotRoot, semiotEnv };
|
|
29317
29266
|
} catch (error) {
|
|
29318
29267
|
const msg = error instanceof Error ? error.message : String(error);
|
|
29319
29268
|
console.error(`
|
|
@@ -29329,33 +29278,17 @@ var localCommand = new CommandBuilder().name("local").description("Set up and st
|
|
|
29329
29278
|
type: "string",
|
|
29330
29279
|
description: "Project directory (default: cwd)"
|
|
29331
29280
|
},
|
|
29332
|
-
"--email": {
|
|
29333
|
-
type: "string",
|
|
29334
|
-
description: "Admin user email (default: admin@local)"
|
|
29335
|
-
},
|
|
29336
|
-
"--password": {
|
|
29337
|
-
type: "string",
|
|
29338
|
-
description: "Admin user password (default: auto-generate)"
|
|
29339
|
-
},
|
|
29340
|
-
"--generate-password": {
|
|
29341
|
-
type: "boolean",
|
|
29342
|
-
description: "Generate a random admin password",
|
|
29343
|
-
default: true
|
|
29344
|
-
},
|
|
29345
29281
|
"--yes": {
|
|
29346
29282
|
type: "boolean",
|
|
29347
29283
|
description: "Non-interactive: accept all defaults (for scripts)",
|
|
29348
29284
|
default: false
|
|
29349
29285
|
}
|
|
29350
29286
|
}, {
|
|
29351
|
-
"--email": "--email",
|
|
29352
29287
|
"--yes": "-y"
|
|
29353
29288
|
})).requiresEnvironment(false).requiresServices(false).examples(
|
|
29354
29289
|
"semiont local",
|
|
29355
|
-
"semiont local --email me@example.com",
|
|
29356
|
-
"semiont local --email me@example.com --generate-password",
|
|
29357
29290
|
"semiont local --yes",
|
|
29358
|
-
"semiont local --directory /opt/myproject --
|
|
29291
|
+
"semiont local --directory /opt/myproject --yes"
|
|
29359
29292
|
).setupHandler(local).build();
|
|
29360
29293
|
|
|
29361
29294
|
// src/core/commands/clean.ts
|
|
@@ -29365,8 +29298,8 @@ init_command_definition();
|
|
|
29365
29298
|
init_base_options_schema();
|
|
29366
29299
|
import * as fs50 from "fs";
|
|
29367
29300
|
import * as readline3 from "readline";
|
|
29368
|
-
import { execFileSync as
|
|
29369
|
-
import { SemiontProject as
|
|
29301
|
+
import { execFileSync as execFileSync42 } from "child_process";
|
|
29302
|
+
import { SemiontProject as SemiontProject20 } from "@semiont/core/node";
|
|
29370
29303
|
var CleanOptionsSchema = BaseOptionsSchema.extend({
|
|
29371
29304
|
force: external_exports.boolean().default(false),
|
|
29372
29305
|
logs: external_exports.boolean().default(false),
|
|
@@ -29418,7 +29351,7 @@ function listDir(dir) {
|
|
|
29418
29351
|
function containerRuntime() {
|
|
29419
29352
|
for (const rt of ["docker", "podman"]) {
|
|
29420
29353
|
try {
|
|
29421
|
-
|
|
29354
|
+
execFileSync42(rt, ["info"], { stdio: "ignore" });
|
|
29422
29355
|
return rt;
|
|
29423
29356
|
} catch {
|
|
29424
29357
|
}
|
|
@@ -29448,7 +29381,7 @@ async function clean(options) {
|
|
|
29448
29381
|
const cleanVolumes = !anyFilter || options.volumes;
|
|
29449
29382
|
let project;
|
|
29450
29383
|
try {
|
|
29451
|
-
project = new
|
|
29384
|
+
project = new SemiontProject20(projectRoot);
|
|
29452
29385
|
} catch (err) {
|
|
29453
29386
|
results.summary.failed = 1;
|
|
29454
29387
|
results.error = `Not a Semiont project: ${err.message}`;
|
|
@@ -29511,9 +29444,9 @@ async function clean(options) {
|
|
|
29511
29444
|
for (const svc of ["database", "graph", "inference"]) {
|
|
29512
29445
|
const volName = `semiont-${svc}-${env}-data`;
|
|
29513
29446
|
try {
|
|
29514
|
-
|
|
29447
|
+
execFileSync42(runtime, ["volume", "inspect", volName], { stdio: "ignore" });
|
|
29515
29448
|
if (!options.dryRun) {
|
|
29516
|
-
|
|
29449
|
+
execFileSync42(runtime, ["volume", "rm", volName], { stdio: "pipe" });
|
|
29517
29450
|
}
|
|
29518
29451
|
removed.push(volName);
|
|
29519
29452
|
} catch {
|
|
@@ -29521,9 +29454,9 @@ async function clean(options) {
|
|
|
29521
29454
|
}
|
|
29522
29455
|
const netName = `semiont-${env}`;
|
|
29523
29456
|
try {
|
|
29524
|
-
|
|
29457
|
+
execFileSync42(runtime, ["network", "inspect", netName], { stdio: "ignore" });
|
|
29525
29458
|
if (!options.dryRun) {
|
|
29526
|
-
|
|
29459
|
+
execFileSync42(runtime, ["network", "rm", netName], { stdio: "pipe" });
|
|
29527
29460
|
}
|
|
29528
29461
|
removed.push(`network: ${netName}`);
|
|
29529
29462
|
} catch {
|
|
@@ -29656,7 +29589,7 @@ init_base_options_schema();
|
|
|
29656
29589
|
init_cli_logger();
|
|
29657
29590
|
init_config_loader();
|
|
29658
29591
|
init_preflight_utils();
|
|
29659
|
-
import { SemiontProject as
|
|
29592
|
+
import { SemiontProject as SemiontProject21 } from "@semiont/core/node";
|
|
29660
29593
|
import { EventBus as EventBus3 } from "@semiont/core";
|
|
29661
29594
|
import { createEventStore as createEventStore5 } from "@semiont/event-sourcing";
|
|
29662
29595
|
import { Stower as Stower3, createKnowledgeBase as createKnowledgeBase3 } from "@semiont/make-meaning";
|
|
@@ -29732,7 +29665,7 @@ async function runMv(options) {
|
|
|
29732
29665
|
if (!options.quiet) {
|
|
29733
29666
|
printInfo(`Moving resource: ${fromUri} \u2192 ${toUri}`);
|
|
29734
29667
|
}
|
|
29735
|
-
const project = new
|
|
29668
|
+
const project = new SemiontProject21(projectRoot);
|
|
29736
29669
|
if (project.gitSync && !options.noGit) {
|
|
29737
29670
|
const gitCheck = checkGitAvailable();
|
|
29738
29671
|
if (!gitCheck.pass) throw new Error(gitCheck.message);
|
|
@@ -29810,7 +29743,7 @@ init_preflight_utils();
|
|
|
29810
29743
|
import * as path43 from "path";
|
|
29811
29744
|
import { promises as nodeFs } from "fs";
|
|
29812
29745
|
import { createHash } from "crypto";
|
|
29813
|
-
import { SemiontProject as
|
|
29746
|
+
import { SemiontProject as SemiontProject22 } from "@semiont/core/node";
|
|
29814
29747
|
import { EventBus as EventBus4, resourceId as toResourceId } from "@semiont/core";
|
|
29815
29748
|
import { createEventStore as createEventStore6 } from "@semiont/event-sourcing";
|
|
29816
29749
|
import { resolveStorageUri, ResourceNotFoundError } from "@semiont/event-sourcing";
|
|
@@ -29902,7 +29835,7 @@ async function runYield(options) {
|
|
|
29902
29835
|
if (options.name && options.files.length > 1) {
|
|
29903
29836
|
throw new Error("--name can only be used when yielding a single file");
|
|
29904
29837
|
}
|
|
29905
|
-
const project = new
|
|
29838
|
+
const project = new SemiontProject22(projectRoot);
|
|
29906
29839
|
if (project.gitSync && !options.noGit) {
|
|
29907
29840
|
const gitCheck = checkGitAvailable();
|
|
29908
29841
|
if (!gitCheck.pass) throw new Error(gitCheck.message);
|
|
@@ -30017,7 +29950,7 @@ init_cli_logger();
|
|
|
30017
29950
|
init_config_loader();
|
|
30018
29951
|
init_preflight_utils();
|
|
30019
29952
|
import * as path44 from "path";
|
|
30020
|
-
import { SemiontProject as
|
|
29953
|
+
import { SemiontProject as SemiontProject23 } from "@semiont/core/node";
|
|
30021
29954
|
import { EventBus as EventBus5 } from "@semiont/core";
|
|
30022
29955
|
import { createEventStore as createEventStore7 } from "@semiont/event-sourcing";
|
|
30023
29956
|
import { resolveStorageUri as resolveStorageUri2, ResourceNotFoundError as ResourceNotFoundError2 } from "@semiont/event-sourcing";
|
|
@@ -30086,7 +30019,7 @@ async function runArchive(options) {
|
|
|
30086
30019
|
const environment = options.environment;
|
|
30087
30020
|
const logger = createCliLogger7(options.verbose ?? false);
|
|
30088
30021
|
const userId = `did:web:localhost:users:${process.env.USER ?? "cli"}`;
|
|
30089
|
-
const project = new
|
|
30022
|
+
const project = new SemiontProject23(projectRoot);
|
|
30090
30023
|
if (project.gitSync && !options.noGit) {
|
|
30091
30024
|
const gitCheck = checkGitAvailable();
|
|
30092
30025
|
if (!gitCheck.pass) throw new Error(gitCheck.message);
|
|
@@ -30172,7 +30105,7 @@ init_cli_logger();
|
|
|
30172
30105
|
init_config_loader();
|
|
30173
30106
|
import * as path45 from "path";
|
|
30174
30107
|
import { promises as nodeFs2 } from "fs";
|
|
30175
|
-
import { SemiontProject as
|
|
30108
|
+
import { SemiontProject as SemiontProject24 } from "@semiont/core/node";
|
|
30176
30109
|
import { EventBus as EventBus6 } from "@semiont/core";
|
|
30177
30110
|
import { createEventStore as createEventStore8 } from "@semiont/event-sourcing";
|
|
30178
30111
|
import { resolveStorageUri as resolveStorageUri3, ResourceNotFoundError as ResourceNotFoundError3 } from "@semiont/event-sourcing";
|
|
@@ -30239,7 +30172,7 @@ async function runUnarchive(options) {
|
|
|
30239
30172
|
const environment = options.environment;
|
|
30240
30173
|
const logger = createCliLogger8(options.verbose ?? false);
|
|
30241
30174
|
const userId = `did:web:localhost:users:${process.env.USER ?? "cli"}`;
|
|
30242
|
-
const project = new
|
|
30175
|
+
const project = new SemiontProject24(projectRoot);
|
|
30243
30176
|
const eventBus = new EventBus6();
|
|
30244
30177
|
const eventStore = createEventStore8(project, eventBus, logger);
|
|
30245
30178
|
const kb = createKnowledgeBase6(eventStore, project, createNoopGraphDatabase6(), logger);
|