Have Sail and SSU. Runs a command on a remote host.

This commit is contained in:
Joao Patricio 2023-03-20 14:29:03 +00:00
parent bfdae4339c
commit 2d6af39ed0
2 changed files with 46 additions and 5 deletions

View File

@ -26,7 +26,7 @@ public function runCommand()
// Override manual to experiment
$override = 0;
if($override) {
if ($override) {
// Good to play with the throttle feature
$sleepingBeauty = 'x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done';
@ -42,6 +42,23 @@ public function runCommand()
$this->activity = coolifyProcess($this->command, 'testing-host');
}
public function runSleepingBeauty()
{
$this->isKeepAliveOn = true;
$this->activity = coolifyProcess('x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done', 'testing-host');
}
public function runDummyProjectBuild()
{
$this->isKeepAliveOn = true;
$this->activity = coolifyProcess(<<<EOT
cd projects/dummy-project
~/.docker/cli-plugins/docker-compose build --no-cache
EOT, 'testing-host');
}
public function polling()
{
$this->activity?->refresh();

View File

@ -2,13 +2,37 @@
<div>
<div>
<label for="command">
<input class="ring-1" id="command" wire:model="command" type="text"/>
<input class="py-2 rounded ring-1" id="command" wire:model="command" type="text"/>
</label>
<button class="btn btn-success btn-xs rounded-none" wire:click="runCommand">
<button
@disabled($activity)
class="bg-indigo-500 rounded py-2 px-4 disabled:bg-gray-300"
wire:click="runCommand"
>
Run command
<button>
<button>
</div>
<div class="mt-2 flex gap-2">
<button
@disabled($activity)
class="bg-indigo-500 rounded py-2 px-4 disabled:bg-gray-300"
wire:click="runSleepingBeauty"
>
Run sleeping beauty
<button>
</div>
<div class="mt-2 flex gap-2">
<button
@disabled($activity)
class="bg-indigo-500 rounded py-2 px-4 disabled:bg-gray-300"
wire:click="runDummyProjectBuild"
>
Build DummyProject
<button>
</div>
@isset($activity?->id)
<div>
Activity: <span>{{ $activity?->id ?? 'waiting' }}</span>
@ -51,7 +75,7 @@
style="
background-color: #FFFFFF;
width: 1200px;
height: 600px;
height: 300px;
overflow-y: scroll;
display: flex;
flex-direction: column-reverse;