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

@ -42,6 +42,23 @@ public function runCommand()
$this->activity = coolifyProcess($this->command, 'testing-host'); $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() public function polling()
{ {
$this->activity?->refresh(); $this->activity?->refresh();

View File

@ -2,13 +2,37 @@
<div> <div>
<div> <div>
<label for="command"> <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> </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 Run command
<button> <button>
</div> </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) @isset($activity?->id)
<div> <div>
Activity: <span>{{ $activity?->id ?? 'waiting' }}</span> Activity: <span>{{ $activity?->id ?? 'waiting' }}</span>
@ -51,7 +75,7 @@
style=" style="
background-color: #FFFFFF; background-color: #FFFFFF;
width: 1200px; width: 1200px;
height: 600px; height: 300px;
overflow-y: scroll; overflow-y: scroll;
display: flex; display: flex;
flex-direction: column-reverse; flex-direction: column-reverse;