mirror of
https://github.com/louislam/dockge.git
synced 2026-05-22 06:22:17 +00:00
WIP
This commit is contained in:
@@ -189,6 +189,28 @@ export class DockerSocketHandler extends SocketHandler {
|
||||
}
|
||||
});
|
||||
|
||||
// rolloutStack
|
||||
socket.on("rolloutStack", async (stackName : unknown, callback) => {
|
||||
try {
|
||||
checkLogin(socket);
|
||||
|
||||
if (typeof(stackName) !== "string") {
|
||||
throw new ValidationError("Stack name must be a string");
|
||||
}
|
||||
|
||||
const stack = Stack.getStack(server, stackName);
|
||||
await stack.rollout(socket);
|
||||
callback({
|
||||
ok: true,
|
||||
msg: "Rolled out"
|
||||
});
|
||||
server.sendStackList();
|
||||
stack.joinCombinedTerminal(socket);
|
||||
} catch (e) {
|
||||
callbackError(e, callback);
|
||||
}
|
||||
});
|
||||
|
||||
// down stack
|
||||
socket.on("downStack", async (stackName : unknown, callback) => {
|
||||
try {
|
||||
|
||||
@@ -323,6 +323,21 @@ export class Stack {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async rollout(socket: DockgeSocket) {
|
||||
let terminalName = getComposeTerminalName(this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "pull" ], this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error("Failed to pull, please check the terminal output for more information.");
|
||||
}
|
||||
|
||||
terminalName = getComposeTerminalName(this.name);
|
||||
exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "rollout", this.name ], this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error("Failed to rollout, please check the terminal output for more information.");
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async stop(socket: DockgeSocket) : Promise<number> {
|
||||
const terminalName = getComposeTerminalName(this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "stop" ], this.path);
|
||||
|
||||
Reference in New Issue
Block a user