mirror of
https://github.com/louislam/dockge.git
synced 2024-11-30 14:24:02 +00:00
WIP
This commit is contained in:
parent
875793d6c2
commit
5ed6bd9982
5 changed files with 55 additions and 2 deletions
|
@ -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
|
// down stack
|
||||||
socket.on("downStack", async (stackName : unknown, callback) => {
|
socket.on("downStack", async (stackName : unknown, callback) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -323,6 +323,21 @@ export class Stack {
|
||||||
return exitCode;
|
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> {
|
async stop(socket: DockgeSocket) : Promise<number> {
|
||||||
const terminalName = getComposeTerminalName(this.name);
|
const terminalName = getComposeTerminalName(this.name);
|
||||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "stop" ], this.path);
|
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "stop" ], this.path);
|
||||||
|
|
|
@ -54,6 +54,7 @@ import {
|
||||||
faTerminal, faWarehouse, faHome, faRocket,
|
faTerminal, faWarehouse, faHome, faRocket,
|
||||||
faRotate,
|
faRotate,
|
||||||
faCloudArrowDown, faArrowsRotate,
|
faCloudArrowDown, faArrowsRotate,
|
||||||
|
faPaintRoller,
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
|
@ -109,6 +110,7 @@ library.add(
|
||||||
faRotate,
|
faRotate,
|
||||||
faCloudArrowDown,
|
faCloudArrowDown,
|
||||||
faArrowsRotate,
|
faArrowsRotate,
|
||||||
|
faPaintRoller,
|
||||||
);
|
);
|
||||||
|
|
||||||
export { FontAwesomeIcon };
|
export { FontAwesomeIcon };
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
"updateStack": "Update",
|
"updateStack": "Update",
|
||||||
"startStack": "Start",
|
"startStack": "Start",
|
||||||
"downStack": "Stop & Down",
|
"downStack": "Stop & Down",
|
||||||
|
"rolloutStack": "Rollout Update (Zero Downtime)",
|
||||||
"editStack": "Edit",
|
"editStack": "Edit",
|
||||||
"discardStack": "Discard",
|
"discardStack": "Discard",
|
||||||
"saveStackDraft": "Save",
|
"saveStackDraft": "Save",
|
||||||
|
|
|
@ -41,11 +41,15 @@
|
||||||
{{ $t("stopStack") }}
|
{{ $t("stopStack") }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<BDropdown v-if="!isEditMode && active" right text="" variant="normal">
|
<BDropdown v-if="!isEditMode || active" right text="" variant="normal">
|
||||||
<BDropdownItem @click="downStack">
|
<BDropdownItem v-if="!isEditMode" @click="downStack">
|
||||||
<font-awesome-icon icon="stop" class="me-1" />
|
<font-awesome-icon icon="stop" class="me-1" />
|
||||||
{{ $t("downStack") }}
|
{{ $t("downStack") }}
|
||||||
</BDropdownItem>
|
</BDropdownItem>
|
||||||
|
<BDropdownItem v-if="active" @click="rolloutStack">
|
||||||
|
<font-awesome-icon icon="paint-roller" class="me-1" />
|
||||||
|
{{ $t("rolloutStack") }} <span class="badge bg-info">Beta</span>
|
||||||
|
</BDropdownItem>
|
||||||
</BDropdown>
|
</BDropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -486,6 +490,15 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
rolloutStack() {
|
||||||
|
this.processing = true;
|
||||||
|
|
||||||
|
this.$root.getSocket().emit("rolloutStack", this.stack.name, (res) => {
|
||||||
|
this.processing = false;
|
||||||
|
this.$root.toastRes(res);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
downStack() {
|
downStack() {
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue