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
3 changes: 2 additions & 1 deletion packages/grid_client/scripts/algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
BlockchainDeleteModel,
BlockchainGetModel,
BlockchainSignModel,
generateString,
GridClient,
} from "../src";
import { getClient } from "./client_loader";
Expand All @@ -23,7 +24,7 @@ const hexMessage = message
.split("")
.map((letter, i) => message.charCodeAt(i).toString(16))
.join("");
const name = "testAcc";
const name = generateString(10);

async function main() {
const account: AlgorandAccountCreateModel = {
Copy link
Contributor

Choose a reason for hiding this comment

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

please use random name for account creation and deletion

Expand Down
9 changes: 5 additions & 4 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 All @@ -38,16 +38,17 @@
};
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "algorand",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -66,16 +66,17 @@
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "casperlabs",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -74,16 +74,17 @@
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "discourse",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -66,16 +66,17 @@
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "funkwhale",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
6 changes: 3 additions & 3 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 Expand Up @@ -77,7 +77,7 @@
},
machines: [
{
name: "giteavm",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
10 changes: 5 additions & 5 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 All @@ -65,16 +65,16 @@
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;

const networkName = "net" + generateString(8);
const vms: MachinesModel = {
name,
network: {
name: "jknet",
name: networkName,
ip_range: "10.254.0.0/16",
},
machines: [
{
name: "jenkins",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -65,16 +65,17 @@ async function main() {
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "jitnet",
name: networkName,
ip_range: "10.251.0.0/16",
},
machines: [
{
name: "jitsi",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -68,16 +68,17 @@ async function main() {
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "mattermost",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -66,16 +66,17 @@ async function main() {
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "nextcloud",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -39,16 +39,17 @@ async function main() {
};
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "nodepilot",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
9 changes: 5 additions & 4 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 All @@ -66,16 +66,17 @@ async function main() {
const nodes = await grid3.capacity.filterNodes(vmQueryOptions);
const vmNode = await pingNodes(grid3, nodes);
const domain = subdomain + "." + gatewayNode.publicConfig.domain;
const networkName = "net" + generateString(8);

const vms: MachinesModel = {
name,
network: {
name: "wedtest",
name: networkName,
ip_range: "10.249.0.0/16",
},
machines: [
{
name: "peertube",
name: name,
node_id: vmNode,
disks: [
{
Expand Down
Loading
Loading