copied new version
This commit is contained in:
66
onix-gui/GUI/app/api/check-layer2/route.js
Normal file
66
onix-gui/GUI/app/api/check-layer2/route.js
Normal file
@@ -0,0 +1,66 @@
|
||||
import { exec } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function POST(req) {
|
||||
const request = await req.json();
|
||||
const containerName = request.checked ? "bpp-network" : "bap-network";
|
||||
const fileToCheck = request.fileName;
|
||||
|
||||
const executeShellCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error:", error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.error("Error:", stderr);
|
||||
reject(new Error(stderr));
|
||||
return;
|
||||
}
|
||||
const output = stdout;
|
||||
console.log("Output:", output);
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
try {
|
||||
const containerExists = await executeShellCommand(
|
||||
`docker ps -a --filter "name=${containerName}" --format "{{.Names}}"`
|
||||
);
|
||||
if (!containerExists.trim()) {
|
||||
return new NextResponse(`Error: ${containerName} server not present`, {
|
||||
status: 500,
|
||||
});
|
||||
}
|
||||
|
||||
const result = await executeShellCommand(
|
||||
`docker exec ${containerName} /bin/sh -c "[ -f '/usr/src/app/schemas/${fileToCheck}' ] && echo 'File found' || echo 'File not found'"`
|
||||
);
|
||||
if (result.trim() === "File found") {
|
||||
return NextResponse.json(
|
||||
{ message: true },
|
||||
{
|
||||
status: 200,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
return NextResponse.json(
|
||||
{ message: false },
|
||||
{
|
||||
status: 200,
|
||||
}
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`exec error: ${error}`);
|
||||
return NextResponse.json(
|
||||
{ message: `Error executing shell command: ${error}` },
|
||||
{
|
||||
status: 500,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
36
onix-gui/GUI/app/api/clonning-repo/route.js
Normal file
36
onix-gui/GUI/app/api/clonning-repo/route.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import { spawn } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
// This function is used to clone the github repository of beckn-onix
|
||||
export async function GET(req) {
|
||||
console.log("Cloning GitHub repository...");
|
||||
const repoUrl = "https://github.com/beckn/beckn-onix";
|
||||
const destination = path.join(os.homedir(), "beckn-onix");
|
||||
const gitProcess = spawn("git", ["clone", repoUrl, destination]);
|
||||
|
||||
gitProcess.stdout.on("data", (data) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
});
|
||||
|
||||
gitProcess.stderr.on("data", (data) => {
|
||||
console.error(`stderr: ${data}`);
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
gitProcess.on("close", (code) => {const destination = "~/beckn-onix";
|
||||
if (code === 0) {
|
||||
console.log("Repository cloned successfully");
|
||||
resolve(
|
||||
NextResponse.json(
|
||||
{ success: true, data: "Repo Cloned Successfully" },
|
||||
{ status: 200 }
|
||||
)
|
||||
);
|
||||
} else {
|
||||
console.error(`git process exited with code ${code}`);
|
||||
resolve(NextResponse.json({ success: false }, { status: 500 }));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
116
onix-gui/GUI/app/api/install-bap/route.js
Normal file
116
onix-gui/GUI/app/api/install-bap/route.js
Normal file
@@ -0,0 +1,116 @@
|
||||
import { exec } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
import { promises as fs } from "fs";
|
||||
import { join } from "path";
|
||||
import os from "os";
|
||||
|
||||
const pathDir = join(os.homedir(), "beckn-onix");
|
||||
|
||||
const executeCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error:", error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
const output = stdout + stderr;
|
||||
console.log("Output:", output);
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
async function directoryExists(path) {
|
||||
try {
|
||||
await fs.access(path);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export async function startSupportServices() {
|
||||
try {
|
||||
process.env.COMPOSE_IGNORE_ORPHANS = "1";
|
||||
|
||||
const result1 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d mongo_db`
|
||||
);
|
||||
console.log("Result 1:", result1);
|
||||
|
||||
const result2 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d queue_service`
|
||||
);
|
||||
console.log("Result 2:", result2);
|
||||
|
||||
const result3 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d redis_db`
|
||||
);
|
||||
console.log("Result 3:", result3);
|
||||
await executeCommand("docker volume create registry_data_volume");
|
||||
await executeCommand("docker volume create registry_database_volume");
|
||||
await executeCommand("docker volume create gateway_data_volume");
|
||||
await executeCommand("docker volume create gateway_database_volume");
|
||||
return NextResponse.json({ result1, result2, result3 });
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return NextResponse.json({ error: "An error occurred" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(req) {
|
||||
const becknOnixDirExists = await directoryExists(pathDir);
|
||||
|
||||
if (!becknOnixDirExists) {
|
||||
console.log(`Directory "${pathDir}" does not exist. Cloning repository...`);
|
||||
try {
|
||||
const response = await fetch(`${req.nextUrl.origin}/api/clonning-repo`);
|
||||
if (!response.ok) {
|
||||
console.error(
|
||||
`Failed to clone repository: ${response.status} ${response.statusText}`
|
||||
);
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: `Failed to clone repository: ${response.status} ${response.statusText}`,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
console.log("Repository cloned successfully.");
|
||||
} catch (error) {
|
||||
console.error("An error occurred while cloning the repository:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "An error occurred while cloning the repository" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await startSupportServices();
|
||||
const data = await req.json();
|
||||
|
||||
const registryUrl = data.registryUrl;
|
||||
const bppSubscriberId = data.subscriberId;
|
||||
const bppSubscriberUrl = data.subscriberUrl;
|
||||
const networkconfigurl = data.networkconfigurl;
|
||||
|
||||
let updateBppConfigCommand = `bash ${pathDir}/install/scripts/update_bap_config.sh ${registryUrl} ${bppSubscriberId} ${bppSubscriberUrl} ${networkconfigurl}`;
|
||||
const result1 = await executeCommand(updateBppConfigCommand);
|
||||
console.log("Result 1:", result1);
|
||||
const result3 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-v2.yml up -d "bap-client"`
|
||||
);
|
||||
console.log("Result 3:", result3);
|
||||
|
||||
const result4 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-v2.yml up -d "bap-network"`
|
||||
);
|
||||
console.log("Result 4:", result4);
|
||||
|
||||
return NextResponse.json({ result1, result3, result4 });
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return NextResponse.json({ error: "An error occurred" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
128
onix-gui/GUI/app/api/install-bpp/route.js
Normal file
128
onix-gui/GUI/app/api/install-bpp/route.js
Normal file
@@ -0,0 +1,128 @@
|
||||
import { exec } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
import { promises as fs } from "fs";
|
||||
import { join } from "path";
|
||||
import os from "os";
|
||||
|
||||
const pathDir = join(os.homedir(), "beckn-onix");
|
||||
async function directoryExists(path) {
|
||||
try {
|
||||
await fs.access(path);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const executeCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error:", error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
const output = stdout + stderr;
|
||||
console.log("Output:", output);
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export async function startSupportServices() {
|
||||
try {
|
||||
process.env.COMPOSE_IGNORE_ORPHANS = "1";
|
||||
|
||||
const result1 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d mongo_db`
|
||||
);
|
||||
console.log("Result 1:", result1);
|
||||
|
||||
const result2 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d queue_service`
|
||||
);
|
||||
console.log("Result 2:", result2);
|
||||
|
||||
const result3 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-app.yml up -d redis_db`
|
||||
);
|
||||
console.log("Result 3:", result3);
|
||||
await executeCommand("docker volume create registry_data_volume");
|
||||
await executeCommand("docker volume create registry_database_volume");
|
||||
await executeCommand("docker volume create gateway_data_volume");
|
||||
await executeCommand("docker volume create gateway_database_volume");
|
||||
return NextResponse.json({ result1, result2, result3 });
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return NextResponse.json({ error: "An error occurred" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(req, res) {
|
||||
const becknOnixDirExists = await directoryExists(pathDir);
|
||||
console.log("Installing Beckn Onix...", becknOnixDirExists);
|
||||
|
||||
if (!becknOnixDirExists) {
|
||||
console.log(`Directory beckn-onix does not exist. Cloning repository...`);
|
||||
try {
|
||||
const response = await fetch(`${req.nextUrl.origin}/api/clonning-repo`);
|
||||
if (!response.ok) {
|
||||
console.error(
|
||||
`Failed to clone repository: ${response.status} ${response.statusText}`
|
||||
);
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: `Failed to clone repository: ${response.status} ${response.statusText}`,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
console.log("Repository cloned successfully.");
|
||||
} catch (error) {
|
||||
console.error("An error occurred while cloning the repository:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "An error occurred while cloning the repository" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await startSupportServices();
|
||||
const data = req.json();
|
||||
const registryUrl = data.registryUrl;
|
||||
const bppSubscriberId = data.subscriberId;
|
||||
const bppSubscriberUrl = data.subscriberUrl;
|
||||
const webhookUrl = data.webhookUrl;
|
||||
// const webhookUrl = "https://unified-bpp.becknprotocol.io/beckn-bpp-adapter";
|
||||
|
||||
// let updateBppConfigCommand = "bash scripts/update_bpp_config.sh";
|
||||
// if (registryUrl) {
|
||||
// updateBppConfigCommand += ``;
|
||||
// }
|
||||
let updateBppConfigCommand = `bash ${pathDir}/install/scripts/update_bpp_config.sh ${registryUrl} ${bppSubscriberId} ${bppSubscriberUrl} ${webhookUrl}`;
|
||||
const result1 = await executeCommand(updateBppConfigCommand);
|
||||
console.log("Result 1:", result1);
|
||||
|
||||
const result2 = await executeCommand("sleep 10");
|
||||
console.log("Result 2:", result2);
|
||||
|
||||
const result3 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-v2.yml up -d bpp-client`
|
||||
);
|
||||
console.log("Result 3:", result3);
|
||||
|
||||
const result4 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-v2.yml up -d bpp-network`
|
||||
);
|
||||
console.log("Result 4:", result4);
|
||||
|
||||
const result5 = await executeCommand("sleep 10");
|
||||
console.log("Result 5:", result5);
|
||||
|
||||
return NextResponse.json({ result1, result2, result3, result4, result5 });
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return NextResponse.json({ error: "An error occurred" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
92
onix-gui/GUI/app/api/install-gateway/route.js
Normal file
92
onix-gui/GUI/app/api/install-gateway/route.js
Normal file
@@ -0,0 +1,92 @@
|
||||
import { exec } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
import { promises as fs } from "fs";
|
||||
import { join } from "path";
|
||||
import os from "os";
|
||||
|
||||
async function directoryExists(path) {
|
||||
try {
|
||||
await fs.access(path);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(req, res) {
|
||||
const pathDir = join(os.homedir(), "beckn-onix");
|
||||
const becknOnixDirExists = await directoryExists(pathDir);
|
||||
console.log("Installing Beckn Onix...", becknOnixDirExists);
|
||||
|
||||
if (!becknOnixDirExists) {
|
||||
console.log(`Directory beckn-onix does not exist. Cloning repository...`);
|
||||
try {
|
||||
const response = await fetch(`${req.nextUrl.origin}/api/clonning-repo`);
|
||||
if (!response.ok) {
|
||||
console.error(
|
||||
`Failed to clone repository: ${response.status} ${response.statusText}`
|
||||
);
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: `Failed to clone repository: ${response.status} ${response.statusText}`,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
console.log("Repository cloned successfully.");
|
||||
} catch (error) {
|
||||
console.error("An error occurred while cloning the repository:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "An error occurred while cloning the repository" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const data = await req.json();
|
||||
const executeCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error:", error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
const output = stdout + stderr;
|
||||
console.log("Output:", output);
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
try {
|
||||
const result1 = await executeCommand(
|
||||
`bash ${pathDir}/install/scripts/package_manager.sh`
|
||||
);
|
||||
console.log("Result 1:", result1);
|
||||
await executeCommand("docker volume create registry_data_volume");
|
||||
await executeCommand("docker volume create registry_database_volume");
|
||||
const result2 = await executeCommand(
|
||||
` bash ${pathDir}/install/scripts/update_gateway_details.sh ${data.registryUrl} ${data.gatewayUrl}`
|
||||
);
|
||||
console.log("Result 2:", result2);
|
||||
|
||||
const result3 = await executeCommand(
|
||||
`docker-compose -f ${pathDir}/install/docker-compose-v2.yml up -d gateway`
|
||||
);
|
||||
console.log("Result 3:", result3);
|
||||
|
||||
const result4 = await executeCommand(`sleep 2`);
|
||||
console.log("Result 4:", result4);
|
||||
|
||||
const result5 = await executeCommand(
|
||||
`bash ${pathDir}/install/scripts/register_gateway.sh ${data.gatewayUrl}`
|
||||
);
|
||||
console.log("Result 5:", result5);
|
||||
|
||||
return NextResponse.json({ result1, result2, result3, result4, result5 });
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return NextResponse.json({ error: "An error occurred" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
38
onix-gui/GUI/app/api/install-layer2/route.js
Normal file
38
onix-gui/GUI/app/api/install-layer2/route.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { exec } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function POST(req) {
|
||||
const request = await req.json();
|
||||
const fileURL = request.yamlUrl;
|
||||
const containerName = request.container;
|
||||
|
||||
const executeShellCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error:", error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.error("Error:", stderr);
|
||||
reject(new Error(stderr));
|
||||
return;
|
||||
}
|
||||
const output = stdout;
|
||||
console.log("Output:", output);
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
try {
|
||||
await executeShellCommand(
|
||||
`docker exec ${containerName} wget -P /usr/src/app/schemas/ ${fileURL}`
|
||||
);
|
||||
return NextResponse.json({ status: 200 });
|
||||
} catch (error) {
|
||||
console.error(`exec error: ${error}`);
|
||||
return NextResponse.json({ status: 500 });
|
||||
}
|
||||
}
|
||||
156
onix-gui/GUI/app/api/install-registry/route.js
Normal file
156
onix-gui/GUI/app/api/install-registry/route.js
Normal file
@@ -0,0 +1,156 @@
|
||||
import { exec } from "child_process";
|
||||
import { NextResponse } from "next/server";
|
||||
import { promises as fs } from "fs";
|
||||
import { tmpdir } from "os";
|
||||
import { join } from "path";
|
||||
import os from "os";
|
||||
|
||||
async function directoryExists(path) {
|
||||
try {
|
||||
await fs.access(path);
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function POST(req, res) {
|
||||
const pathDir = join(os.homedir(), "beckn-onix");
|
||||
const becknOnixDirExists = await directoryExists(pathDir);
|
||||
console.log("Installing Beckn Onix...", becknOnixDirExists);
|
||||
|
||||
if (!becknOnixDirExists) {
|
||||
console.log(`Directory beckn-onix does not exist. Cloning repository...`);
|
||||
try {
|
||||
const response = await fetch(`${req.nextUrl.origin}/api/clonning-repo`);
|
||||
if (!response.ok) {
|
||||
console.error(
|
||||
`Failed to clone repository: ${response.status} ${response.statusText}`
|
||||
);
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: `Failed to clone repository: ${response.status} ${response.statusText}`,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
console.log("Repository cloned successfully.");
|
||||
} catch (error) {
|
||||
console.error("An error occurred while cloning the repository:", error);
|
||||
return NextResponse.json(
|
||||
{ error: "An error occurred while cloning the repository" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const data = await req.json();
|
||||
const executeCommand = (command) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error("Error:", error);
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
const output = stdout + stderr;
|
||||
console.log("Output:", output);
|
||||
resolve(output);
|
||||
});
|
||||
});
|
||||
};
|
||||
const updateRegistryDetails = async (url) => {
|
||||
let registryUrl = "";
|
||||
let registryPort = "";
|
||||
let protocol = "";
|
||||
|
||||
if (url) {
|
||||
if (url.startsWith("https://")) {
|
||||
registryUrl = url.replace("https://", "");
|
||||
registryPort = "443";
|
||||
protocol = "https";
|
||||
} else if (url.startsWith("http://")) {
|
||||
registryUrl = url.replace("http://", "");
|
||||
registryPort = "80";
|
||||
protocol = "http";
|
||||
}
|
||||
} else {
|
||||
registryUrl = "registry";
|
||||
registryPort = "3030";
|
||||
protocol = "http";
|
||||
}
|
||||
|
||||
console.log("Registry URL:", registryUrl);
|
||||
|
||||
const configFile = join(
|
||||
pathDir,
|
||||
"install",
|
||||
"registry_data",
|
||||
"config",
|
||||
"swf.properties"
|
||||
);
|
||||
const sampleFile = join(
|
||||
pathDir,
|
||||
"install",
|
||||
"registry_data",
|
||||
"config",
|
||||
"swf.properties-sample"
|
||||
);
|
||||
|
||||
try {
|
||||
await fs.copyFile(sampleFile, configFile);
|
||||
const tempDir = join(os.homedir(), "beckn-onix", "tmp");
|
||||
await fs.mkdir(tempDir, { recursive: true }); // Create the temporary directory if it doesn't exist
|
||||
|
||||
const tempFile = join(tempDir, "tempfile.XXXXXXXXXX");
|
||||
const configData = await fs.readFile(configFile, "utf8");
|
||||
const updatedConfigData = configData
|
||||
.replace(/REGISTRY_URL/g, registryUrl)
|
||||
.replace(/REGISTRY_PORT/g, registryPort)
|
||||
.replace(/PROTOCOL/g, protocol);
|
||||
|
||||
await fs.writeFile(tempFile, updatedConfigData);
|
||||
await fs.rename(tempFile, configFile);
|
||||
await executeCommand("docker volume create registry_data_volume");
|
||||
await executeCommand("docker volume create registry_database_volume");
|
||||
await executeCommand("docker volume create gateway_data_volume");
|
||||
await executeCommand("docker volume create gateway_database_volume");
|
||||
await executeCommand(
|
||||
`docker run --rm -v ${join(
|
||||
pathDir,
|
||||
"install",
|
||||
"registry_data",
|
||||
"config"
|
||||
)}:/source -v registry_data_volume:/target busybox sh -c "cp /source/envvars /target/ && cp /source/logger.properties /target/ && cp /source/swf.properties /target/"`
|
||||
);
|
||||
|
||||
// Start the registry container
|
||||
await executeCommand(
|
||||
`docker-compose -f ${join(
|
||||
pathDir,
|
||||
"install",
|
||||
"docker-compose-v2.yml"
|
||||
)} up -d registry`
|
||||
);
|
||||
|
||||
// Wait for 10 seconds
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
|
||||
console.log("Registry installation successful");
|
||||
} catch (error) {
|
||||
console.error("Error updating registry details:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
const url = data.registryUrl;
|
||||
await updateRegistryDetails(url);
|
||||
return NextResponse.json({
|
||||
message: "Registry details updated successfully",
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("An error occurred:", error);
|
||||
return NextResponse.json({ error: "An error occurred" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user