An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
command center
Andras Bacsaib8b0d2243fcc
diff --git a/app/Http/Livewire/RunCommand.php b/app/Http/Livewire/RunCommand.phpindex 41002ca17a..c83a830846 100755--- a/app/Http/Livewire/RunCommand.php+++ b/app/Http/Livewire/RunCommand.php@@ -8,51 +8,24 @@ use Livewire\Component;class RunCommand extends Component{- public $activity;-- public $isKeepAliveOn = false;-- public $manualKeepAlive = false;-- public $command = 'ls';-+ public $command;public $server;-public $servers = [];protected $rules = ['server' => 'required',+ 'command' => 'required',];public function mount(){- $this->servers = Server::all();+ $this->servers = Server::where('team_id', session('currentTeam')->id)->get();$this->server = $this->servers[0]->uuid;}public function runCommand(){- $this->isKeepAliveOn = true;- $this->activity = remoteProcess([$this->command], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);- }-- public function runSleepingBeauty()- {- $this->isKeepAliveOn = true;- $this->activity = remoteProcess(['x=1; while [ $x -le 40 ]; do sleep 0.1 && echo "Welcome $x times" $(( x++ )); done'], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);- }-- public function runDummyProjectBuild()- {- $this->isKeepAliveOn = true;- $this->activity = remoteProcess([' cd projects/dummy-project', 'docker-compose build --no-cache'], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);- }-- public function polling()- {- $this->activity?->refresh();-- if (data_get($this->activity, 'properties.exitCode') !== null) {- $this->isKeepAliveOn = false;- }+ $this->validate();+ $activity = remoteProcess([$this->command], Server::where('uuid', $this->server)->first(), ActivityTypes::INLINE->value);+ $this->emit('newMonitorActivity', $activity->id);}}diff --git a/resources/views/demo.blade.php b/resources/views/command-center.blade.phpsimilarity index 100%rename from resources/views/demo.blade.phprename to resources/views/command-center.blade.phpdiff --git a/resources/views/components/inputs/input.blade.php b/resources/views/components/inputs/input.blade.phpindex f899cb64ed..a09af04961 100644--- a/resources/views/components/inputs/input.blade.php+++ b/resources/views/components/inputs/input.blade.php@@ -1,32 +1,19 @@@props(['id' => null,+ 'type' => 'text','required' => false,'readonly' => false,'label' => null,- 'type' => 'text',- 'class' => '','instantSave' => false,'disabled' => false,'hidden' => false,])-@if ($type === 'checkbox')- <label for={{ $id }}>- @if ($label)- {{ $label }}- @else- {{ $id }}- @endif- @if ($required)- *- @endif- <input type="checkbox" id={{ $id }}- @if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $id }} @endif>- </label>- @error($id)- <span class="text-red-500">{{ $message }}</span>- @enderror-@else++<span @class([+ 'flex justify-end' => $type === 'checkbox',+ 'flex flex-col' => $type !== 'checkbox',+])><label for={{ $id }}>@if ($label){{ $label }}@@ -38,17 +25,13 @@@endif</label>@if ($type === 'textarea')- <textarea class={{ $class }} type={{ $type }} id={{ $id }}- wire:model.defer={{ $id }} @if ($required) required @endif- @if ($disabled) disabled @endif @if ($readonly) readOnly disabled @endif></textarea>+ <textarea {{ $attributes }} type={{ $type }} id={{ $id }} wire:model.defer={{ $id }}></textarea>@else- <input class={{ $class }} type={{ $type }} id={{ $id }}- wire:model.defer={{ $id }} @if ($required) required @endif- @if ($disabled) disabled @endif- @if ($readonly) readOnly disabled @endif />+ <input {{ $attributes }} type={{ $type }} id={{ $id }}+ @if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $id }} @endif />@endif@error($id)<div class="text-red-500">{{ $message }}</div>@enderror-@endif+</span>diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.phpindex 3d5ce67a15..7b6f916832 100644--- a/resources/views/components/navbar.blade.php+++ b/resources/views/components/navbar.blade.php@@ -2,9 +2,7 @@<div>v{{ config('coolify.version') }}</div>@auth<a href="/">Home</a>- @env('local')- <a href="/demo">Demo</a>- @endenv+ <a href="/command-center">Command Center</a><a href="/profile">Profile</a>@if (auth()->user()->isRoot())<a href="/settings">Settings</a>diff --git a/resources/views/livewire/activity-monitor.blade.php b/resources/views/livewire/activity-monitor.blade.phpindex 33a55da537..4f995e51fc 100644--- a/resources/views/livewire/activity-monitor.blade.php+++ b/resources/views/livewire/activity-monitor.blade.php@@ -1,6 +1,5 @@<div>@isset($this->activity)- <span>Activity: {{ $this->activity?->id }}</span><span>Status: {{ $this->activity?->properties->get('status') }}</span><pre class="flex flex-col-reverse w-full overflow-y-scroll"@if ($isPollingActive) wire:poll.750ms="polling" @endif>{{ \App\Actions\CoolifyTask\RunRemoteProcess::decodeOutput($this->activity) }}</pre>diff --git a/resources/views/livewire/run-command.blade.php b/resources/views/livewire/run-command.blade.phpindex 81473dd405..951fd5407f 100755--- a/resources/views/livewire/run-command.blade.php+++ b/resources/views/livewire/run-command.blade.php@@ -1,26 +1,12 @@<div>- <div>- <label for="command">- <input autofocus id="command" wire:model.defer="command" type="text" wire:keydown.enter="runCommand" />- <select wire:model.defer="server">- @foreach ($servers as $server)- <option value="{{ $server->uuid }}">{{ $server->name }}</option>- @endforeach- </select>- </label>- <x-inputs.button wire:click="runCommand">Run command</x-inputs.button>- <x-inputs.button wire:click="runSleepingBeauty">Run sleeping beauty</x-inputs.button>- <x-inputs.button wire:click="runDummyProjectBuild">Build DummyProject</x-inputs.button>- </div>-- <div>- <input id="manualKeepAlive" name="manualKeepAlive" type="checkbox" wire:model="manualKeepAlive">- <label for="manualKeepAlive">Real-time logs</label>- @if ($isKeepAliveOn || $manualKeepAlive)- Polling...- @endif- </div>- @isset($activity?->id)- <pre style="width: 100%;overflow-y: scroll;" @if ($isKeepAliveOn) wire:poll.750ms="polling" @endif>{{ \App\Actions\CoolifyTask\RunRemoteProcess::decodeOutput($activity) }}</pre>- @endisset+ <form class="flex gap-2" wire:submit.prevent='runCommand'>+ <x-inputs.input autofocus id="command" label="Command" required />+ <select wire:model.defer="server">+ @foreach ($servers as $server)+ <option value="{{ $server->uuid }}">{{ $server->name }}</option>+ @endforeach+ </select>+ <x-inputs.button type="submit">Run</x-inputs.button>+ </form>+ <livewire:activity-monitor /></div>diff --git a/routes/web.php b/routes/web.phpindex ec3e7d7cd1..e47acfaf12 100644--- a/routes/web.php+++ b/routes/web.php@@ -60,9 +60,9 @@ Route::middleware(['auth'])->group(function () {return view('update');})->name('update');- Route::get('/demo', function () {- return view('demo');- })->name('demo');+ Route::get('/command-center', function () {+ return view('command-center');+ })->name('command-center');});Route::middleware(['auth'])->group(function () {