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

Preserve previous remote CMDs #131

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
<span class="input-group-text">vCPU</span>
</div>
<input type="number" class="form-control m-0" id='minVCPU' value="1" min="1" max="1447" step="1">
<span class="mx-1">~</span>
<span class="mx-1">.</span>
<input type="number" class="form-control m-0" id='maxVCPU' value="8" min="1" max="1448" step="1">
</div>
</div>
Expand All @@ -290,11 +290,11 @@
<div class="form-group col">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Mem(GiB)</span>
<span class="input-group-text">Mem(Gi)</span>
</div>
<input type="number" class="form-control m-0" id='minRAM' value="0.5" min="0.5" max="112288"
step="0.5">
<span class="mx-1">~</span>
<span class="mx-1">.</span>
<input type="number" class="form-control m-0" id='maxRAM' value="16" min="0.5" max="112289" step="0.5">
</div>
</div>
Expand Down Expand Up @@ -359,7 +359,7 @@
<span class="input-group-text">Count</span>
</div>
<input type="number" class="form-control" id='minAcceleratorCount' min="1" max="999998" step="1">
<span class="mx-1">~</span>
<span class="mx-1">.</span>
<input type="number" class="form-control" id='maxAcceleratorCount' min="1" max="999999" step="1">
</div>
</div>
Expand All @@ -371,7 +371,7 @@
<span class="input-group-text">Mem(GB)</span>
</div>
<input type="number" class="form-control" id='minAMEM' min="1" max="999998" step="1">
<span class="mx-1">~</span>
<span class="mx-1">.</span>
<input type="number" class="form-control" id='maxAMEM' min="1" max="999999" step="1">
</div>
</div>
Expand Down
57 changes: 28 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2564,12 +2564,10 @@ function sleep(ms) {
return new Promise((r) => setTimeout(r, ms));
}

var defaultRemoteCommand =
"client_ip=$(echo $SSH_CLIENT | awk '{print $1}'); my_ip=$(hostname -I)";
var defaultRemoteCommand01 =
"echo SSH client (bastion) IP is: $client_ip";
var defaultRemoteCommand02 =
"echo IPs of my network: $my_ip";
var defaultRemoteCommand = [];
defaultRemoteCommand.push("hostname -I");
defaultRemoteCommand.push("echo $SSH_CLIENT");
defaultRemoteCommand.push("");

// function for startApp by startApp button item
function startApp() {
Expand Down Expand Up @@ -2606,53 +2604,53 @@ function startApp() {
}

if (selectApp.value == "Xonotic") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/usecases/xonotic/startServer.sh";
defaultRemoteCommand01 =
defaultRemoteCommand[1] =
"chmod +x ~/startServer.sh";
defaultRemoteCommand02 =
defaultRemoteCommand[2] =
"sudo ~/startServer.sh " + "Xonotic-by-Cloud-Barista-" + mcisid + " 26000" + " 8"+ " 8";
} else if (selectApp.value == "ELK") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/usecases/elastic-stack/startELK.sh";
defaultRemoteCommand01 =
defaultRemoteCommand[1] =
"chmod +x ~/startServer.sh";
defaultRemoteCommand02 =
defaultRemoteCommand[2] =
"sudo ~/startServer.sh ";
} else if (selectApp.value == "LLM") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/usecases/llm/llmServer.py";
defaultRemoteCommand01 =
defaultRemoteCommand[1] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/usecases/llm/startServer.sh; chmod +x ~/startServer.sh";
defaultRemoteCommand02 =
defaultRemoteCommand[2] =
"~/startServer.sh " + "--ip" + publicIPs + " --port 5000" + " --token 1024" + " --model tiiuae/falcon-7b-instruct";
} else if (selectApp.value == "Westward") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/setgame.sh";
defaultRemoteCommand01 =
defaultRemoteCommand[1] =
"chmod +x ~/setgame.sh; sudo ~/setgame.sh";
} else if (selectApp.value == "WeaveScope") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/usecases/weavescope/startServer.sh";
defaultRemoteCommand01 =
defaultRemoteCommand[1] =
"chmod +x ~/startServer.sh";
defaultRemoteCommand02 =
defaultRemoteCommand[2] =
"sudo ~/startServer.sh " + publicIPs + " " + privateIPs;
} else if (selectApp.value == "Nginx") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget -O ~/setweb.sh https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/setweb.sh; chmod +x ~/setweb.sh; sudo ~/setweb.sh";
} else if (selectApp.value == "Jitsi") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/usecases/jitsi/startServer.sh";
defaultRemoteCommand01 =
defaultRemoteCommand[1] =
"chmod +x ~/startServer.sh";
defaultRemoteCommand02 =
defaultRemoteCommand[2] =
"sudo ~/startServer.sh " + publicIPs + " " + "DNS EMAIL";
} else if (selectApp.value == "Stress") {
defaultRemoteCommand =
defaultRemoteCommand[0] =
"sudo apt install -y stress > /dev/null; stress -c 16 -t 60";
} else {
defaultRemoteCommand = "ls -al";
defaultRemoteCommand[0] = "ls -al";
}

executeRemoteCmd();
Expand Down Expand Up @@ -2841,15 +2839,15 @@ function executeRemoteCmd() {
<p><font size=4><b>[Commands]</b></font></p>
<div id="cmdContainer" style="margin-bottom: 20px;">
<div id="cmdDiv1" class="cmdRow">
Command 1: <input type="text" id="cmd1" style="width: 75%" value="${defaultRemoteCommand}">
Command 1: <input type="text" id="cmd1" style="width: 75%" value="${defaultRemoteCommand[0]}">
<button onclick="document.getElementById('cmd1').value = ''">Clear</button>
</div>
<div id="cmdDiv2" class="cmdRow">
Command 2: <input type="text" id="cmd2" style="width: 75%" value="${defaultRemoteCommand01}">
Command 2: <input type="text" id="cmd2" style="width: 75%" value="${defaultRemoteCommand[1]}">
<button onclick="document.getElementById('cmd2').value = ''">Clear</button>
</div>
<div id="cmdDiv3" class="cmdRow">
Command 3: <input type="text" id="cmd3" style="width: 75%" value="${defaultRemoteCommand02}">
Command 3: <input type="text" id="cmd3" style="width: 75%" value="${defaultRemoteCommand[2]}">
<button onclick="document.getElementById('cmd3').value = ''">Clear</button>
</div>
<button id="addCmd" onclick="addCmd()" style="margin-left: 1px;"> + </button>
Expand Down Expand Up @@ -2894,6 +2892,7 @@ function executeRemoteCmd() {
const commands = [];
for (let i = 1; i <= cmdCount; i++) {
const cmd = document.getElementById("cmd" + i).value;
defaultRemoteCommand[i-1] = cmd;
if (cmd) {
commands.push(cmd);
}
Expand Down
Loading