mirror of
https://github.com/moghtech/komodo.git
synced 2026-05-07 19:35:38 -05:00
* modularize openapi structs * most of execute openapi * server / stack exec openapi * most of write openapi * more write openapi * add the write openapi definitions * fmt and bump mogh auth * gen types * remove user api, mogh auth handles api keys * clean up * cache latest image digests and use this for image update alerting / auto update * deploy 2.0.0-dev-108 * deploy 2.0.0-dev-109 * add back legacy Action "exec" method calling convention * typegen * improve config quick links styling * improve config styling a bit more * deploy 2.0.0-dev-110 * finish version upgrades page, and use prism theme oneLight and oneDark * stack level terminal page * fix Action import from terminal * clean up dangling action api keys on startup * improve swarm service / stack state inference * deploy 2.0.0-dev-111 * add api docs link * bump ts types and fix SwarmConfig type name conflict * use mogh auth for passkey conversion * align dashboard icon with sidebar * bump frontend node version * bump node version in all the dockerfiles * fix tailwind config module * fix require to import * skip auto update for images with pinned digest * dev 112 * cleanup * batch check for updates, add check to table multi select actions * dev-113 * mogh_server = "1.2.0" * serve static ui index.html with ETag / no-cache * check update available against all digests for image * deploy 2.0.0-dev-114 * bump rust to 1.93.0 * bump mogh server and auth * configure session allow cross site * deploy 2.0.0-dev-115 * add new config value to example config * Stack check for update prefers check against deployed service image * deploy 2.0.0-dev-116 * only send auto updated alert after verifying the deploy was successful * 2.0.0 UI (#1220) * new ui using mantine * resources page * prog on resource page * resources and resource layouts * confirm button and modal * tweaks * update details * topbar updates * add skeletons for resource implementations * add resource tables * add tags to recents cards * resource page table scrolling * table component + tags filter * export toml * New Resource button * Fix update details capture closing * tweaks * omni search * refine config * config tweaks * implement more configs / resource selector * add profile page * provider / account selectors * container table page * build config * deployment config * fix deployment build version selector * fix secrets selector * resource sync config * mobile topbar and updates * update details fz sm * stack config * terminals page * create terminal in prog * create terminal menu * finish create terminal menu * terminal pages working * stack tabs / info * add executions * add server header info * confirm pubkey modal * improve resource header styling * FileSource component * stack service table, move icons.ts * basic procedure config * tweak procedure config * container / image pages * network / volume pages * clean up docker resource pages * basic log / terminal ui * reusable log section * styling * clean up resource components * delete in resource header * log auto select stderr * fix some bgs * stack logs with service selector * stack terminals * add deployment executions * use correct icon * useResource hooks * build info * build info * tweaks * server tabs * fix terminal section target * prog on server tabs * server stats * light theme * start on historical stats * stack service page * resource sync tabs * sync tabs * more topbar icons * add settings basic * add topbar alerts * tweak stream selector behavior * tweak alert icon topbar * improve styling smaller screen * schedules page and other progress * onboarding keys * improve schedule page descriptions * improve update notifications * schedule timezone selector * tag color selector * finish settings / providers * use shared-text-update component so settings tables aren't janky * updates page * refine updates page * alert page * standardize borders * theme and swarm * swarm tabs * swarm node page * swarm config page * swarm pages * swarm task and secret pages * swarm stack page * fix stack log service selector in swarm mode * standard inspect section * swarm inspect tab * server and swarm resources tab * add disable confirm dialog (modal) option for executions * stack update available indicator * deployment update available * add template switch to resource headers * ResourceHeader + rename * set editing name onclick * repo tabs * server stats table * refine a bit * refine deployment / stack header info * show server stats dashboard. dashboard tables * action last run in config * SettingsUsers page * user page etc * manage api key * user base permissions * color the table multi select * user group page * UserAddUserGroup * active includes deployments / stacks * improve small screen view * fix docker pages execution showing * clean up * rename frontend to UI * align profile page styling * config maintenance windows * finish maintenance windows * builder config * add batch execute dropdown / confirm menu * batch execute styling * deploy 2.0.0-dev-117 * improve stats card light theme * add update page * improve mobile * terminal group nowrap * mobile improvements * allow unused again * improve mobile font sizing * improve mobile updates / alerts * mobile tabs * alert page * add server version mismatch color * new resource, clearable selector * Fix build show info tab * copy resources * keyboard shortcuts * server resource header version mismatch * fix type errors * container page server multi select * confirm button clear timeout * hash compare force uses first 8 for short hash * fix log height * copy webhooks * responsive tweaks * add icons to server stat sections * add historical server stats charts * server stat current card shows usage numbers * refine current stats more * fix shortcuts interfering with monaco brave * clean up unused * remove v1 frontend * bump rust version to 1.93.1 and dep versions * deploy 2.0.0-dev-118 * bump chef rust version * improve login no auth configured and passkey pending * Load Average is first historical stat * procedure / action webhook branch mobile style * dashboard active styling * hide actions when none * Select Template * execution buttons disabled when loading * Fix config input issue * improve tab styling * rename ConfigSwitch onChange -> onCheckedChange * ensure section headers consistent spacing * edit swarm join command * fix batch executions width * stack stopped and deployment exited warning instead of critical * smaller more consistent gaps * add close button to update / alert details drawer * stack and deployment state color include update available. Ensure server version mismatch color applied everywhere * deploy 2.0.0-dev-120 * topbar user dropdown shows user avatar if available * post link redirect should be to profile * deploy 2.0.0-dev-121 * improve profile delete styling * standard api key modal size * improve login styling * fix login github / google icon color * fix some wrapping stuff in tables and tag text disappear * fix terminal height - same as logs * single delete terminal * Update / Alert table filter selector formatted * tweaks for lg size * taller data table and blue omnisearch * refine lg screen size view * fix sidebar margin right * "never" -> "Never" * Add hoverable disk info * improve disk usage hover card styling * rename for clarity * thinner topbar * config sidebar save * setters use maps instead of mutations * notification green contents written success * fmt * read request are trace * deploy 2.0.0-dev-122 * debug level core <> periphery auth identifiers logs * mogh auth server 1.2.10 * mogh auth 1.2.11 * deploy 2.0.0-dev-123 * Deploy / DeployStack updates invalidate corresponding list query * confirm action / save modals don't need ConfirmButton * deploy 2.0.0-dev-124 * proper base64url decode * fix init admin user * improve mobile friendly tabs width, and onboardng key copy * rename resource invalidates * better maxheight for mobile friendly tabs * km cli needs to install crypto provider for tls ws * better responsive confirm save width * confirm modal better responsiveness * Fix api key modal too thin * better api key create * improve batch execs * improve tabs * sidebar more compact * add missing Repo header Info * Fix Pull repo * fix repo Links config * improve procedure config UI including run stack service * improve deployment network, restart, termination signal config * fix confirm update showing entries which have not changed * example execute terminal uses bash * Update deployments description * move build server * [Docs] Update connect-servers.mdx (#1256) * Update connect-servers.mdx * Update connect-servers.mdx * clean up connect servers * feat(ci): build (#1018) * fmt * fix: more verbose logging (#1017) * use .with_context for stack run directory canonicalize log * fix failing doc test * Improve server resource header hover info * service selector support swarm stack icon * fix stack terminals sometimes not disabled when it should be * add terminal create and delete messages * bump packages and add Mogh Tech copyright * revamp docsite * soften the borders * clean up stack config * fix config group header too much gap * procedure stage menu easier to reach * deploy 2.0.0-dev-125 * increase universal resource polling * improve server stats * fix data table * down node is critical * cli add print core info * add docker swarm feature card * improve toml resource repetition using macros, and fix Swarm toml support * swarm config: configure alerting options * add swarm header info * Implement New Swarm Config and New Swarm Secret * brighten tag colors * continue docs revamp * fmt * set more refetch intervals to keep display data fresh * fix copy not showing copy source when there are no templates * rename onboarding key fix_existing_servers to privileged * fix Privileged spelling * fmt * more docs improvement * improve docs intro * update the curl instructions with easier call method * fix clippy lints * refresh the server cache after every server connection successful login * deploy 2.0.0-dev-126 * add polling to dashboard summary data * tweak tag opacity * improve server stat table disk hover * fix change historical stat length collapse stats * KOMODO_DISABLE_INIT_RESOURCES * stack Project Missing should be red * Fix files on host stacks showing down after reboot until refresh cache * silence user level write logs SetLastSeenUpdate and PushRecentlyViewed * See the v2 migration guide * Improve api logging using more fields * deploy 2.0.0-dev-127 * cli create api key on database, can use with docker exec into core container * deploy 2.0.0-dev-128 * advanced km create api-key options * create onboarding key with cli * tweak * onboarding keys use tag name * deploy 2.0.0-dev-129 * stack procedure stages can select specific services to apply to (default all services) * docsite dockerfile * ./docusaurus.config.ts * need to yarn build * fix broken link * improve alert (dropdown) icons * fix docs sidebar collapse * add local search functionality * docs search nice * homepage features navigate to docs * only show build cancel when canCancel * more confirm button confirmprops red * fix docsite buttons and list more features * fix sidebar cmd click opens in new tab (is a link) * execute withBorder * cleaner execute section * swap docker compose and deploy containers * make docs logo align with app * better mobile button layout * linked logins / 2fa confirm red styling * bump rust version to 1.94.0 * move bollard::secret to bollard::config * deploy 2.0.0-dev-130 * feat: add compose_cmd_wrapper_include for selective command wrapping (#1124) - Add compose_cmd_wrapper_include field to StackConfig. - Fix wrapper placeholder text not displaying in MonacoEditor. * align configuration by removing bold label stuff * confirm update monaco readonly * dockerfile binaries / ui images default to :2 * fmt * refresh server cache lint * fmt * disabling send alerts should also disable in UI * clean up disabled alerting * deploy 2.0.0-dev-131 * mogh_pki 1.1.3 safer copy from slice * fix dev container issues on 2.0.0 (#1238) * fix node version and yarn build in dev container * ensure keys directories exist and are writable in dev container * update dev container image (necessary to fix compiler error) * fix CORS error in dev container * more dev container fixes KOMODO_SESSION_ALLOW_CROSS_SITE: true needed to properly run on Firefox * fix devcontainer port * update config pages to use "Webhooks" consistently and fix acronym casing (#1239) Co-authored-by: Maxwell Becker <49575486+mbecker20@users.noreply.github.com> * update local dev setup instructions (#1240) * example mongo deploy dev * check binary URL (#1116) * install script improve failed download binary log * align cli installer with periphery installer * improve terminal page create experience * deploy 2.0.0-dev-132 * improve mobile updates with full size query * fix some internal table wrapping * fix schedule expression examples * Add swarm updates / alerts filter * filter by update available uses location hash instead of localstorage * sync commit preserve meta "deploy" and "after" * UI fixes and tweaks * deploy 2.0.0-dev-133 * add error to warn log * Stack / deployment should inherit specific Swarm permissions * Fix inline span formatting (used in logs / errors) * refactor resource sync pending deploy for better display * deploy 2.0.0-dev-134 * improve terminal error handling * deploy 2.0.0-dev-135 * dedicated docs page for v2 * warning about failing to include init: true * Limit Periphery IPs in Advanced config * refine setup guide * 2.0.0 --------- Co-authored-by: Shlee <github@shl.ee> Co-authored-by: Yujia Qiao <code@rapiz.me> Co-authored-by: ChanningHe <52875777+ChanningHe@users.noreply.github.com> Co-authored-by: Steven Loria <sloria1@pm.me> Co-authored-by: Andreas Brett <andreasbrett@users.noreply.github.com>
506 lines
17 KiB
JavaScript
506 lines
17 KiB
JavaScript
import { MoghAuthClient } from "npm:mogh_auth_client";
|
|
import { terminal_methods } from "./terminal.js";
|
|
import { UpdateStatus, } from "./types.js";
|
|
export * as MoghAuth from "npm:mogh_auth_client";
|
|
export * as Types from "./types.js";
|
|
export class CancelToken {
|
|
cancelled;
|
|
constructor() {
|
|
this.cancelled = false;
|
|
}
|
|
cancel() {
|
|
this.cancelled = true;
|
|
}
|
|
}
|
|
/** Initialize a new client for Komodo */
|
|
export function KomodoClient(url, options) {
|
|
const state = {
|
|
jwt: options.type === "jwt" ? options.params.jwt : undefined,
|
|
key: options.type === "api-key" ? options.params.key : undefined,
|
|
secret: options.type === "api-key" ? options.params.secret : undefined,
|
|
};
|
|
const auth = MoghAuthClient(url + "/auth", state.jwt);
|
|
const request = (path, type, params, method = "POST") => new Promise(async (res, rej) => {
|
|
try {
|
|
let response = await fetch(`${url}${path}${type ? "/" + type : ""}`, {
|
|
method,
|
|
body: JSON.stringify(params),
|
|
headers: {
|
|
...(state.jwt
|
|
? {
|
|
authorization: state.jwt,
|
|
}
|
|
: state.key && state.secret
|
|
? {
|
|
"x-api-key": state.key,
|
|
"x-api-secret": state.secret,
|
|
}
|
|
: {}),
|
|
"content-type": "application/json",
|
|
},
|
|
credentials: "include",
|
|
});
|
|
if (response.status === 200) {
|
|
const body = await response.json();
|
|
res(body);
|
|
}
|
|
else {
|
|
try {
|
|
const result = await response.json();
|
|
rej({ status: response.status, result });
|
|
}
|
|
catch (error) {
|
|
rej({
|
|
status: response.status,
|
|
result: {
|
|
error: "Failed to get response body",
|
|
trace: [JSON.stringify(error)],
|
|
},
|
|
error,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
catch (error) {
|
|
rej({
|
|
status: 1,
|
|
result: {
|
|
error: "Request failed with error",
|
|
trace: [JSON.stringify(error)],
|
|
},
|
|
error,
|
|
});
|
|
}
|
|
});
|
|
const getUser = async () => await request("/user", "", undefined, "GET");
|
|
const read = async (type, params) => await request("/read", type, params);
|
|
const write = async (type, params) => await request("/write", type, params);
|
|
const execute = async (type, params) => await request("/execute", type, params);
|
|
const execute_and_poll = async (type, params) => {
|
|
const res = await execute(type, params);
|
|
// Check if its a batch of updates or a single update;
|
|
if (Array.isArray(res)) {
|
|
const batch = res;
|
|
return await Promise.all(batch.map(async (item) => {
|
|
if (item.status === "Err") {
|
|
return item;
|
|
}
|
|
return await poll_update_until_complete(item.data._id?.$oid);
|
|
}));
|
|
}
|
|
else {
|
|
// it is a single update
|
|
const update = res;
|
|
if (update.status === UpdateStatus.Complete || !update._id?.$oid) {
|
|
return update;
|
|
}
|
|
return await poll_update_until_complete(update._id?.$oid);
|
|
}
|
|
};
|
|
const poll_update_until_complete = async (update_id) => {
|
|
while (true) {
|
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
const update = await read("GetUpdate", { id: update_id });
|
|
if (update.status === UpdateStatus.Complete) {
|
|
return update;
|
|
}
|
|
}
|
|
};
|
|
const core_version = () => read("GetVersion", {}).then((res) => res.version);
|
|
const get_update_websocket = ({ on_update, on_login, on_open, on_close, }) => {
|
|
const ws = new WebSocket(url.replace("http", "ws") + "/ws/update");
|
|
// Handle login on websocket open
|
|
ws.addEventListener("open", () => {
|
|
on_open?.();
|
|
const login_msg = options.type === "jwt"
|
|
? {
|
|
type: "Jwt",
|
|
params: {
|
|
jwt: options.params.jwt,
|
|
},
|
|
}
|
|
: {
|
|
type: "ApiKeys",
|
|
params: {
|
|
key: options.params.key,
|
|
secret: options.params.secret,
|
|
},
|
|
};
|
|
ws.send(JSON.stringify(login_msg));
|
|
});
|
|
ws.addEventListener("message", ({ data }) => {
|
|
if (data == "LOGGED_IN")
|
|
return on_login?.();
|
|
on_update(JSON.parse(data));
|
|
});
|
|
if (on_close) {
|
|
ws.addEventListener("close", on_close);
|
|
}
|
|
return ws;
|
|
};
|
|
const subscribe_to_update_websocket = async ({ on_update, on_open, on_login, on_close, retry = true, retry_timeout_ms = 5_000, cancel = new CancelToken(), on_cancel, }) => {
|
|
while (true) {
|
|
if (cancel.cancelled) {
|
|
on_cancel?.();
|
|
return;
|
|
}
|
|
try {
|
|
const ws = get_update_websocket({
|
|
on_open,
|
|
on_login,
|
|
on_update,
|
|
on_close,
|
|
});
|
|
// This while loop will end when the socket is closed
|
|
while (ws.readyState !== WebSocket.CLOSING &&
|
|
ws.readyState !== WebSocket.CLOSED) {
|
|
if (cancel.cancelled)
|
|
ws.close();
|
|
// Sleep for a bit before checking for websocket closed
|
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
}
|
|
if (retry) {
|
|
// Sleep for a bit before retrying connection to avoid spam.
|
|
await new Promise((resolve) => setTimeout(resolve, retry_timeout_ms));
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
}
|
|
catch (error) {
|
|
console.error(error);
|
|
if (retry) {
|
|
// Sleep for a bit before retrying, maybe Komodo Core is down temporarily.
|
|
await new Promise((resolve) => setTimeout(resolve, retry_timeout_ms));
|
|
}
|
|
else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const { connect_terminal, execute_terminal, execute_terminal_stream, execute_server_terminal, execute_container_terminal, execute_stack_service_terminal, execute_deployment_terminal, execute_container_exec, execute_deployment_exec, execute_stack_exec, } = terminal_methods(url, state);
|
|
return {
|
|
/**
|
|
* Call the `/auth` api.
|
|
*
|
|
* ```
|
|
* const { jwt } = await komodo.auth.login("LoginLocalUser", {
|
|
* username: "test-user",
|
|
* password: "test-pass"
|
|
* });
|
|
* ```
|
|
*
|
|
* https://docs.rs/mogh_auth_client/latest/mogh_auth_client/api/index.html
|
|
*/
|
|
auth,
|
|
/**
|
|
* Get the current (calling) user.
|
|
*
|
|
* ```
|
|
* const user = await komodo.getUser();
|
|
* ```
|
|
*
|
|
* https://docs.rs/komodo_client/latest/komodo_client/api/user/index.html
|
|
*/
|
|
getUser,
|
|
/**
|
|
* Call the `/read` api.
|
|
*
|
|
* ```
|
|
* const stack = await komodo.read("GetStack", {
|
|
* stack: "my-stack"
|
|
* });
|
|
* ```
|
|
*
|
|
* https://docs.rs/komodo_client/latest/komodo_client/api/read/index.html
|
|
*/
|
|
read,
|
|
/**
|
|
* Call the `/write` api.
|
|
*
|
|
* ```
|
|
* const build = await komodo.write("UpdateBuild", {
|
|
* id: "my-build",
|
|
* config: {
|
|
* version: "1.0.4"
|
|
* }
|
|
* });
|
|
* ```
|
|
*
|
|
* https://docs.rs/komodo_client/latest/komodo_client/api/write/index.html
|
|
*/
|
|
write,
|
|
/**
|
|
* Call the `/execute` api.
|
|
*
|
|
* ```
|
|
* const update = await komodo.execute("DeployStack", {
|
|
* stack: "my-stack"
|
|
* });
|
|
* ```
|
|
*
|
|
* NOTE. These calls return immediately when the update is created, NOT when the execution task finishes.
|
|
* To have the call only return when the task finishes, use [execute_and_poll_until_complete].
|
|
*
|
|
* https://docs.rs/komodo_client/latest/komodo_client/api/execute/index.html
|
|
*/
|
|
execute,
|
|
/**
|
|
* Call the `/execute` api, and poll the update until the task has completed.
|
|
*
|
|
* ```
|
|
* const update = await komodo.execute_and_poll("DeployStack", {
|
|
* stack: "my-stack"
|
|
* });
|
|
* ```
|
|
*
|
|
* https://docs.rs/komodo_client/latest/komodo_client/api/execute/index.html
|
|
*/
|
|
execute_and_poll,
|
|
/**
|
|
* Poll an Update (returned by the `execute` calls) until the `status` is `Complete`.
|
|
* https://docs.rs/komodo_client/latest/komodo_client/entities/update/struct.Update.html#structfield.status.
|
|
*/
|
|
poll_update_until_complete,
|
|
/** Returns the version of Komodo Core the client is calling to. */
|
|
core_version,
|
|
/**
|
|
* Connects to update websocket, performs login and attaches handlers,
|
|
* and returns the WebSocket handle.
|
|
*/
|
|
get_update_websocket,
|
|
/**
|
|
* Subscribes to the update websocket with automatic reconnect loop.
|
|
*
|
|
* Note. Awaiting this method will never finish.
|
|
*/
|
|
subscribe_to_update_websocket,
|
|
/**
|
|
* Subscribes to terminal io over websocket message,
|
|
* for use with xtermjs.
|
|
*/
|
|
connect_terminal,
|
|
/**
|
|
* Executes a command on a given target / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_terminal(
|
|
* {
|
|
* target: {
|
|
* type: "Server",
|
|
* params: {
|
|
* server: "my-server"
|
|
* }
|
|
* },
|
|
* terminal: "name",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* init: {
|
|
* command: "bash",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* }
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_terminal,
|
|
/**
|
|
* Executes a command on a given target / terminal,
|
|
* and returns a stream to process the output as it comes in.
|
|
*
|
|
* Note. The final line of the stream will usually be
|
|
* `__KOMODO_EXIT_CODE__:0`. The number
|
|
* is the exit code of the command.
|
|
*
|
|
* If this line is NOT present, it means the stream
|
|
* was terminated early, ie like running `exit`.
|
|
*
|
|
* ```ts
|
|
* const stream = await komodo.execute_terminal_stream({
|
|
* target: {
|
|
* type: "Server",
|
|
* params: {
|
|
* server: "my-server"
|
|
* }
|
|
* },
|
|
* terminal: "name",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* init: {
|
|
* command: "bash",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* }
|
|
* });
|
|
*
|
|
* for await (const line of stream) {
|
|
* console.log(line);
|
|
* }
|
|
* ```
|
|
*/
|
|
execute_terminal_stream,
|
|
/**
|
|
* Executes a command on a given Server / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_server_terminal(
|
|
* {
|
|
* server: "my-server",
|
|
* terminal: "name",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* init: {
|
|
* command: "bash",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* }
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_server_terminal,
|
|
/**
|
|
* Executes a command on a given Server / Container / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_container_terminal(
|
|
* {
|
|
* server: "my-server",
|
|
* container: "my-container",
|
|
* terminal: "name",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* init: {
|
|
* command: "bash",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* }
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_container_terminal,
|
|
/**
|
|
* Executes a command on a given Stack / service / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_stack_service_terminal(
|
|
* {
|
|
* stack: "my-stack",
|
|
* service: "my-service",
|
|
* terminal: "name",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* init: {
|
|
* command: "bash",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* }
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_stack_service_terminal,
|
|
/**
|
|
* Executes a command on a given Deployment / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_deployment_terminal(
|
|
* {
|
|
* deployment: "my-deployemnt",
|
|
* terminal: "name",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* init: {
|
|
* command: "bash",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* }
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_deployment_terminal,
|
|
/**
|
|
* Executes a command on a given Server / Container / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_container_exec(
|
|
* {
|
|
* server: "my-server",
|
|
* container: "my-container",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* shell: "bash",
|
|
* terminal: "name",
|
|
* recreate: Types.TerminalRecreateMode.Always,
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_container_exec,
|
|
/**
|
|
* Executes a command on a given Deployment / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_deployment_exec(
|
|
* {
|
|
* deployment: "my-deployemnt",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* shell: "bash",
|
|
* terminal: "name",
|
|
* recreate: Types.TerminalRecreateMode.Always,
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_deployment_exec,
|
|
/**
|
|
* Executes a command on a given Stack / service / terminal,
|
|
* and gives callbacks to handle the output as it comes in.
|
|
*
|
|
* ```ts
|
|
* await komodo.execute_stack_exec(
|
|
* {
|
|
* stack: "my-stack",
|
|
* service: "my-service",
|
|
* command: 'for i in {1..3}; do echo "$i"; sleep 1; done',
|
|
* shell: "bash",
|
|
* terminal: "name",
|
|
* recreate: Types.TerminalRecreateMode.Always
|
|
* },
|
|
* {
|
|
* onLine: (line) => console.log(line),
|
|
* onFinish: (code) => console.log("Finished:", code),
|
|
* }
|
|
* );
|
|
* ```
|
|
*/
|
|
execute_stack_exec,
|
|
};
|
|
}
|