Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using generateString in all scripts that deploy a machine #3822

Open
wants to merge 9 commits into
base: development
Choose a base branch
from
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/algorand.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, MachinesModel } from "../../src";
import { FilterOptions, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand All @@ -16,7 +16,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms) {

Check warning on line 19 in packages/grid_client/scripts/applications/algorand.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
log(resultVM);
Expand All @@ -24,7 +24,7 @@
}

async function main() {
const name = "newalgorand";
const name = "algo" + generateString(8);
const grid3 = await getClient(`algorand/${name}`);
const instanceCapacity = { cru: 2, mru: 4, sru: 100 }; // Update the instance capacity values according to your requirements.

Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/casperlabs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -33,7 +33,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms, gw) {

Check warning on line 36 in packages/grid_client/scripts/applications/casperlabs.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
log("================= Canceling the deployment =================");
Expand All @@ -43,7 +43,7 @@
}

async function main() {
const name = "newcasperlabs";
const name = "cl" + generateString(8);
const grid3 = await getClient(`casperlabs/${name}`);
const subdomain = "cl" + grid3.twinId + name;
const instanceCapacity = { cru: 2, mru: 4, sru: 100 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/discourse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Buffer } from "buffer";
import TweetNACL from "tweetnacl";

import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -36,7 +36,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms, gw) {

Check warning on line 39 in packages/grid_client/scripts/applications/discourse.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
log("================= Canceling the deployment =================");
Expand All @@ -51,7 +51,7 @@
}

async function main() {
const name = "newdiscourse";
const name = "dc" + generateString(8);
const grid3 = await getClient(`discourse/${name}`);
const subdomain = "dc" + grid3.twinId + name;
const instanceCapacity = { cru: 1, mru: 2, sru: 15 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/funkwhale.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -33,7 +33,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms, gw) {

Check warning on line 36 in packages/grid_client/scripts/applications/funkwhale.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
log("================= Canceling the deployment =================");
Expand All @@ -43,7 +43,7 @@
}

async function main() {
const name = "newfunkwhale";
const name = "fw" + generateString(8);
const grid3 = await getClient(`funkwhale/${name}`);
const subdomain = "fw" + grid3.twinId + name;
const instanceCapacity = { cru: 1, mru: 2, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/gitea.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -34,7 +34,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms, gw) {

Check warning on line 37 in packages/grid_client/scripts/applications/gitea.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
log("================= Canceling the deployment =================");
Expand All @@ -44,7 +44,7 @@
}

async function main() {
const name = "giteainstance";
const name = "gt" + generateString(8);
const networkName = "giteanetwork";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of consistency, use a random network name here too

const grid3 = await getClient(`gitea/${name}`);
const subdomain = "gt" + grid3.twinId + name;
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/jenkins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -33,7 +33,7 @@
log("================= Getting deployment information =================");
}

async function cancel(client, vms, gw) {

Check warning on line 36 in packages/grid_client/scripts/applications/jenkins.ts

View workflow job for this annotation

GitHub Actions / lint (18.x)

'cancel' is defined but never used
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
log("================= Canceling the deployment =================");
Expand All @@ -43,7 +43,7 @@
}

async function main() {
const name = "newjenkins";
const name = "jk" + generateString(8);
const grid3 = await getClient(`jenkins/${name}`);
const subdomain = "jk" + grid3.twinId + name;
const instanceCapacity = { cru: 2, mru: 4, sru: 50 }; // Medium flavor as an example
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/jitsi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +43,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newjitsi";
const name = "jt" + generateString(8);
const grid3 = await getClient(`jitsi/${name}`);
const subdomain = "jt" + grid3.twinId + name;
const instanceCapacity = { cru: 2, mru: 4, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/mattermost.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +43,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newmattermost";
const name = "mm" + generateString(8);
const grid3 = await getClient(`mattermost/${name}`);
const subdomain = "mm" + grid3.twinId + name;
const instanceCapacity = { cru: 1, mru: 2, sru: 15 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/nextcloud.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +43,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newnextcloud";
const name = "nc" + generateString(8);
const grid3 = await getClient(`nextcloud/${name}`);
const subdomain = "nc" + grid3.twinId + name;
const instanceCapacity = { cru: 2, mru: 4, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/nodepilot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, MachinesModel } from "../../src";
import { Features, FilterOptions, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand All @@ -24,7 +24,7 @@ async function cancel(client, vms) {
}

async function main() {
const name = "newnodepilot";
const name = "np" + generateString(8);
const grid3 = await getClient(`nodepilot/${name}`);
const instanceCapacity = { cru: 8, mru: 8, sru: 32 }; // Update the instance capacity values according to your requirements.

Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/peertube.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +43,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newpeertube";
const name = "pt" + generateString(8);
const grid3 = await getClient(`peertube/${name}`);
const subdomain = "pt" + grid3.twinId + name;
const instanceCapacity = { cru: 1, mru: 2, sru: 15 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/presearch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, MachinesModel } from "../../src";
import { FilterOptions, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand All @@ -24,7 +24,7 @@ async function cancel(client, vms) {
}

async function main() {
const name = "newpresearch";
const name = "ps" + generateString(8);
const grid3 = await getClient(`presearch/${name}`);
const instanceCapacity = { cru: 1, mru: 1, sru: 10 }; // Update the instance capacity values according to your requirements.

Expand Down
12 changes: 10 additions & 2 deletions packages/grid_client/scripts/applications/static_website.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Features, FilterOptions, GatewayNameModel, GridClient, MachinesModel, NodeInfo } from "../../src";
import {
Features,
FilterOptions,
GatewayNameModel,
generateString,
GridClient,
MachinesModel,
NodeInfo,
} from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +51,7 @@ async function cancel(client: GridClient, vms: string, gw: string) {
}

async function main() {
const name = "newstaticwebsite";
const name = "sw" + generateString(8);
const grid3 = await getClient(`staticwebsite/${name}`);
const subdomain = "sw" + grid3.twinId + name;
const instanceCapacity = { cru: 1, mru: 2, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/subsquid.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +43,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newsubsquid";
const name = "ss" + generateString(8);
const grid3 = await getClient(`subsquid/${name}`);
const subdomain = "ss" + grid3.twinId + name;
const instanceCapacity = { cru: 1, mru: 2, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/taiga.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -43,7 +43,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newtaiga";
const name = "tg" + generateString(8);
const grid3 = await getClient(`taiga/${name}`);
const subdomain = "tg" + grid3.twinId + name;
const instanceCapacity = { cru: 2, mru: 4, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/umbrel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, MachinesModel } from "../../src";
import { FilterOptions, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand All @@ -25,7 +25,7 @@ async function cancel(client, vms) {
}

async function main() {
const name = "newumbrel";
const name = "uls" + generateString(8);
const grid3 = await getClient(`umbrel/${name}`);
const instanceCapacity = { cru: 1, mru: 2, sru: 20 }; // Update the instance capacity values according to your requirements.

Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/applications/wordpress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GatewayNameModel, MachinesModel } from "../../src";
import { Features, FilterOptions, GatewayNameModel, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -44,7 +44,7 @@ async function cancel(client, vms, gw) {
}

async function main() {
const name = "newwordpress";
const name = "wp" + generateString(8);
const grid3 = await getClient(`wordpress/${name}`);
const subdomain = "wp" + grid3.twinId + name;
const instanceCapacity = { cru: 2, mru: 4, sru: 50 }; // Update the instance capacity values according to your requirements.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, MachinesModel } from "../../src";
import { Features, FilterOptions, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log } from "../utils";

Expand All @@ -25,7 +25,7 @@ async function cancel(client, vms) {
}

async function main() {
const name = "newVMS5";
const name = "cr" + generateString(8);
const grid3 = await getClient(`caprover/${name}`);

const vmQueryOptions: FilterOptions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, MachinesModel } from "../../src";
import { Features, FilterOptions, generateString, MachinesModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log } from "../utils";

Expand All @@ -24,7 +24,7 @@ async function cancel(client, vms) {
}

async function main() {
const name = "newVMS5";
const name = "cr" + generateString(8);
const grid3 = await getClient(`caprover/${name}`);

const vmQueryOptions: FilterOptions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, K8SModel } from "../../src";
import { Features, FilterOptions, generateString, K8SModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log } from "../utils";

Expand All @@ -24,7 +24,7 @@ async function cancel(client, k8s) {
}

async function main() {
const name = "testk8s";
const name = "k8s" + generateString(8);
const grid3 = await getClient(`kubernetes/${name}`);

const masterQueryOptions: FilterOptions = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterOptions, K8SModel } from "../../src";
import { FilterOptions, generateString, K8SModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log } from "../utils";

Expand All @@ -24,7 +24,7 @@ async function cancel(client, k8s) {
}

async function main() {
const name = "testk8sMy";
const name = "k8s" + generateString(8);
const grid3 = await getClient(`kubernetes/${name}`);

const k: K8SModel = {
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use generateString for qsfs_name?

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Features, FilterOptions, GridClient, K8SModel, QSFSZDBSModel } from "../../src";
import { Features, FilterOptions, generateString, GridClient, K8SModel, QSFSZDBSModel } from "../../src";
import { config, getClient } from "../client_loader";
import { log, pingNodes } from "../utils";

Expand Down Expand Up @@ -38,7 +38,7 @@ async function deleteQsfs(client: GridClient, qsfs: string) {
}

async function main() {
const name = "testk8sqsfs";
const name = "k8s" + generateString(8);
const grid3 = await getClient(`kubernetes/${name}`);

const qsfs_name = "testQsfsK8sq1";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AddWorkerModel, Features, FilterOptions } from "../../src";
import { AddWorkerModel, Features, FilterOptions, generateString } from "../../src";
import { getClient } from "../client_loader";
import { log } from "../utils";

Expand Down Expand Up @@ -26,7 +26,7 @@ async function deleteWorker(client, worker) {
}

async function main() {
const name = "testk8s";
const name = "k8s" + generateString(8);
const grid3 = await getClient(`kubernetes/${name}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment for the user to change the name to an existing cluster name so he can add the worker to it


const workerQueryOptions: FilterOptions = {
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/single_vm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GridClient, MachinesModel } from "../src";
import { generateString, GridClient, MachinesModel } from "../src";
import { type ZmachineData } from "../src/helpers/types";
import { config, getClient } from "./client_loader";
import { log } from "./utils";
Expand Down Expand Up @@ -26,7 +26,7 @@ async function cancel(client: GridClient, name: string) {
}

async function main() {
const name = "newVMS";
const name = "vm" + generateString(8);
const grid3 = await getClient(`vm/${name}`);

const vms: MachinesModel = {
Expand Down
4 changes: 2 additions & 2 deletions packages/grid_client/scripts/single_vm_mycelium.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateRandomHexSeed, GridClient, MachinesDeleteModel, MachinesModel } from "../src";
import { generateRandomHexSeed, generateString, GridClient, MachinesDeleteModel, MachinesModel } from "../src";
import { config, getClient } from "./client_loader";
import { log } from "./utils";

Expand All @@ -24,7 +24,7 @@ async function cancel(client: GridClient, options: MachinesDeleteModel) {
}

async function main() {
const name = "newMY";
const name = "vm" + generateString(8);
const grid3 = await getClient(`vm/${name}`);

const vms: MachinesModel = {
Expand Down
Loading
Loading