-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da3fe2a
commit b1390a2
Showing
235 changed files
with
9,049 additions
and
2,173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Playground Selenium Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 6 * * *" | ||
|
||
jobs: | ||
selenium-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setting up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Installing all necessary packages | ||
run: pip install -r packages/playground/tests/frontend_selenium/requirements.txt | ||
- name: Node install | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Yarn install | ||
run: yarn install | ||
- name: Lerna Build | ||
run: yarn lerna run build | ||
- name: Yarn Serve | ||
run: make run project=playground & | ||
- name: Wait for localhost | ||
run: sleep 60 | ||
- name: Run tests | ||
working-directory: ./packages/playground/tests/frontend_selenium | ||
env: | ||
TFCHAIN_MNEMONICS: ${{ secrets.TFCHAIN_MNEMONICS }} | ||
TFCHAIN_NODE_MNEMONICS: ${{ secrets.TFCHAIN_NODE_MNEMONICS }} | ||
STELLAR_ADDRESS: ${{ secrets.STELLAR_ADDRESS }} | ||
EMAIL: ${{ secrets.EMAIL }} | ||
run: python -m pytest -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"version": "2.4.1", | ||
"version": "2.5.0-rc1", | ||
"npmClient": "yarn" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { FilterOptions, MachinesModel } from "../../src"; | ||
import { config, getClient } from "../client_loader"; | ||
import { log, pingNodes } from "../utils"; | ||
|
||
async function deploy(client, vms) { | ||
const resultVM = await client.machines.deploy(vms); | ||
log("================= Deploying VM ================="); | ||
log(resultVM); | ||
log("================= Deploying VM ================="); | ||
} | ||
|
||
async function getDeployment(client, vms) { | ||
const resultVM = await client.machines.getObj(vms.name); | ||
log("================= Getting deployment information ================="); | ||
log(resultVM); | ||
log("================= Getting deployment information ================="); | ||
} | ||
|
||
async function cancel(client, vms) { | ||
const resultVM = await client.machines.delete(vms); | ||
log("================= Canceling the deployment ================="); | ||
log(resultVM); | ||
log("================= Canceling the deployment ================="); | ||
} | ||
|
||
async function main() { | ||
const name = "newalgorand"; | ||
const grid3 = await getClient(`algorand/${name}`); | ||
const instanceCapacity = { cru: 2, mru: 4, sru: 100 }; // Update the instance capacity values according to your requirements. | ||
|
||
//VMNode Selection | ||
const vmQueryOptions: FilterOptions = { | ||
cru: instanceCapacity.cru, | ||
mru: instanceCapacity.mru, | ||
sru: instanceCapacity.sru, | ||
availableFor: grid3.twinId, | ||
farmId: 1, | ||
}; | ||
const nodes = await grid3.capacity.filterNodes(vmQueryOptions); | ||
const vmNode = await pingNodes(grid3, nodes); | ||
|
||
const vms: MachinesModel = { | ||
name, | ||
network: { | ||
name: "wedtest", | ||
ip_range: "10.249.0.0/16", | ||
}, | ||
machines: [ | ||
{ | ||
name: "algorand", | ||
node_id: vmNode, | ||
disks: [ | ||
{ | ||
name: "docker", | ||
size: instanceCapacity.sru, | ||
mountpoint: "/var/lib/docker", | ||
}, | ||
], | ||
planetary: true, | ||
public_ip: false, | ||
public_ip6: false, | ||
mycelium: false, | ||
cpu: instanceCapacity.cru, | ||
memory: 1024 * instanceCapacity.mru, | ||
rootfs_size: 0, | ||
flist: "https://hub.grid.tf/tf-official-apps/algorand-latest.flist", | ||
entrypoint: "/sbin/zinit init", | ||
env: { | ||
SSH_KEY: config.ssh_key, | ||
// Select a network to work against. | ||
NETWORK: "mainnet", | ||
// Default, Relay, Indexer | ||
NODE_TYPE: "default", | ||
}, | ||
}, | ||
], | ||
metadata: "", | ||
description: "test deploying Algorand via ts grid3 client", | ||
}; | ||
|
||
//Deploy VMs | ||
await deploy(grid3, vms); | ||
|
||
//Get the deployment | ||
await getDeployment(grid3, vms); | ||
|
||
//Uncomment the line below to cancel the deployment | ||
// await cancel(grid3, { name }); | ||
|
||
await grid3.disconnect(); | ||
} | ||
|
||
main(); |
117 changes: 117 additions & 0 deletions
117
packages/grid_client/scripts/applications/casberlabs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { FilterOptions, GatewayNameModel, MachinesModel } from "../../src"; | ||
import { config, getClient } from "../client_loader"; | ||
import { log, pingNodes } from "../utils"; | ||
|
||
async function deploy(client, vms, subdomain, gatewayNode) { | ||
const resultVM = await client.machines.deploy(vms); | ||
log("================= Deploying VM ================="); | ||
log(resultVM); | ||
log("================= Deploying VM ================="); | ||
|
||
const vmPlanetary = (await client.machines.getObj(vms.name))[0].planetary; | ||
//Name Gateway Model | ||
const gw: GatewayNameModel = { | ||
name: subdomain, | ||
node_id: gatewayNode.nodeId, | ||
tls_passthrough: false, | ||
backends: ["http://[" + vmPlanetary + "]:80"], | ||
}; | ||
|
||
const resultGateway = await client.gateway.deploy_name(gw); | ||
log("================= Deploying name gateway ================="); | ||
log(resultGateway); | ||
log("================= Deploying name gateway ================="); | ||
} | ||
|
||
async function getDeployment(client, vms, gw) { | ||
const resultVM = await client.machines.getObj(vms.name); | ||
const resultGateway = await client.gateway.getObj(gw); | ||
log("================= Getting deployment information ================="); | ||
log(resultVM); | ||
log(resultGateway); | ||
log("https://" + resultGateway[0].domain); | ||
log("================= Getting deployment information ================="); | ||
} | ||
|
||
async function cancel(client, vms, gw) { | ||
const resultVM = await client.machines.delete(vms); | ||
const resultGateway = await client.gateway.delete_name(gw); | ||
log("================= Canceling the deployment ================="); | ||
log(resultVM); | ||
log(resultGateway); | ||
log("================= Canceling the deployment ================="); | ||
} | ||
|
||
async function main() { | ||
const name = "newcasperlabs"; | ||
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. | ||
|
||
//VMNode Selection | ||
const vmQueryOptions: FilterOptions = { | ||
cru: instanceCapacity.cru, | ||
mru: instanceCapacity.mru, | ||
sru: instanceCapacity.sru, | ||
availableFor: grid3.twinId, | ||
farmId: 1, | ||
}; | ||
//GatewayNode Selection | ||
const gatewayQueryOptions: FilterOptions = { | ||
gateway: true, | ||
availableFor: grid3.twinId, | ||
}; | ||
const gatewayNode = (await grid3.capacity.filterNodes(gatewayQueryOptions))[0]; | ||
const nodes = await grid3.capacity.filterNodes(vmQueryOptions); | ||
const vmNode = await pingNodes(grid3, nodes); | ||
const domain = subdomain + "." + gatewayNode.publicConfig.domain; | ||
|
||
const vms: MachinesModel = { | ||
name, | ||
network: { | ||
name: "wedtest", | ||
ip_range: "10.249.0.0/16", | ||
}, | ||
machines: [ | ||
{ | ||
name: "casperlabs", | ||
node_id: vmNode, | ||
disks: [ | ||
{ | ||
name: "wedDisk", | ||
size: instanceCapacity.sru, | ||
mountpoint: "/data", | ||
}, | ||
], | ||
planetary: true, | ||
public_ip: false, | ||
public_ip6: false, | ||
mycelium: false, | ||
cpu: instanceCapacity.cru, | ||
memory: 1024 * instanceCapacity.mru, | ||
rootfs_size: 0, | ||
flist: "https://hub.grid.tf/tf-official-apps/casperlabs-latest.flist", | ||
entrypoint: "/sbin/zinit init", | ||
env: { | ||
SSH_KEY: config.ssh_key, | ||
CASPERLABS_HOSTNAME: domain, | ||
}, | ||
}, | ||
], | ||
metadata: "", | ||
description: "test deploying CasberLabs via ts grid3 client", | ||
}; | ||
|
||
//Deploy VMs | ||
await deploy(grid3, vms, subdomain, gatewayNode); | ||
|
||
//Get the deployment | ||
await getDeployment(grid3, vms, subdomain); | ||
|
||
//Uncomment the line below to cancel the deployment | ||
// await cancel(grid3, { name }, { name: subdomain }); | ||
|
||
await grid3.disconnect(); | ||
} | ||
|
||
main(); |
Oops, something went wrong.