Skip to content

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.

wip

Joao Patricio931664c0c0f8
diff --git a/app/Actions/Proxy/InstallProxy.php b/app/Actions/Proxy/InstallProxy.php
index 84429c7cf9..42864b4156 100644
--- a/app/Actions/Proxy/InstallProxy.php
+++ b/app/Actions/Proxy/InstallProxy.php
@@ -3,12 +3,14 @@
namespace App\Actions\Proxy;
use App\Enums\ActivityTypes;
+use App\Enums\ProxyTypes;
use App\Models\Server;
+use Spatie\Activitylog\Models\Activity;
use Symfony\Component\Yaml\Yaml;
class InstallProxy
{
- public function __invoke(Server $server)
+ public function __invoke(Server $server): Activity
{
$docker_compose_yml_base64 = base64_encode(
$this->getDockerComposeContents()
@@ -30,6 +32,10 @@ class InstallProxy
'docker ps',
], $server, ActivityTypes::INLINE->value);
+ // Persist to Database
+ $server->extra_attributes->proxy = ProxyTypes::TRAEFIK_V2->value;
+ $server->save();
+
return $activity;
}
@@ -47,8 +53,6 @@ class InstallProxy
? config('proxy.project_path_on_host') . '/_testing_hosts/host_2_proxy'
: '.';
- ray($cwd);
-
return [
"version" => "3.7",
"networks" => [
diff --git a/app/Http/Livewire/Server/Proxy.php b/app/Http/Livewire/Server/Proxy.php
index bc42982878..a44bb9e6d6 100644
--- a/app/Http/Livewire/Server/Proxy.php
+++ b/app/Http/Livewire/Server/Proxy.php
@@ -13,6 +13,11 @@ class Proxy extends Component
protected string $selectedProxy = '';
+ public $is_proxy_installed;
+
+ public $is_check_proxy_complete = false;
+ public $is_proxy_settings_in_sync = false;
+
public function mount(Server $server)
{
$this->server = $server;
@@ -25,6 +30,14 @@ class Proxy extends Component
$this->emit('newMonitorActivity', $activity->id);
}
+ public function checkProxySettingsInSync()
+ {
+
+
+ $this->is_check_proxy_complete = true;
+ $this->is_proxy_settings_in_sync = true;
+ }
+
public function render()
{
return view('livewire.server.proxy');
diff --git a/docker/dev-ssu/Dockerfile b/docker/dev-ssu/Dockerfile
index c90e53d081..e8724828e5 100644
--- a/docker/dev-ssu/Dockerfile
+++ b/docker/dev-ssu/Dockerfile
@@ -5,4 +5,9 @@ RUN apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
+RUN echo "alias ll='ls -al'" >> /etc/bash.bashrc
+RUN echo "alias a='php artisan'" >> /etc/bash.bashrc
+RUN echo "alias mfs='php artisan migrate:fresh --seed'" >> /etc/bash.bashrc
+RUN echo "alias cda='composer dump-autoload'" >> /etc/bash.bashrc
+
# COPY --chmod=755 docker/dev-ssu/etc/s6-overlay/ /etc/s6-overlay/
diff --git a/resources/views/livewire/server/_proxy/loading.blade.php b/resources/views/livewire/server/_proxy/loading.blade.php
new file mode 100644
index 0000000000..cfab2d8db9
--- /dev/null
+++ b/resources/views/livewire/server/_proxy/loading.blade.php
@@ -0,0 +1,12 @@
+<div class="absolute w-full h-full bg-sky-600 rounded-lg">
+ <div class="w-full mt-32 text-center animate-pulse">
+ Loading
+ </div>
+ <div class="mt-20 w-full flex justify-center">
+ <span class="relative flex h-28 w-28">
+ <span
+ class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span>
+ <span class="relative inline-flex rounded-full h-28 w-28 bg-sky-500"></span>
+ </span>
+ </div>
+</div>
diff --git a/resources/views/livewire/server/_proxy/options.blade.php b/resources/views/livewire/server/_proxy/options.blade.php
new file mode 100644
index 0000000000..e6610bc272
--- /dev/null
+++ b/resources/views/livewire/server/_proxy/options.blade.php
@@ -0,0 +1,48 @@
+
+<div class="mt-4">
+ <label>
+ <div>Edit config file</div>
+ <textarea cols="45" rows="25"></textarea>
+ </label>
+</div>
+
+<div class="mt-4">
+ <label>
+ Enable dashboard?
+ <input type="checkbox" />
+ (auto-save)
+ </label>
+</div>
+
+<div class="mt-4">
+ <a href="#">Visit Dashboard</a>
+</div>
+
+<div class="mt-4">
+ <label>
+ <div>Setup hostname for Dashboard</div>
+ <div class="mt-2"></div>
+ <label>
+ <div>Hostname <span class="text-xs"> Eg: dashboard.example.com </span></div>
+ <input type="text" />
+ </label>
+ <button>Update</button>
+ </label>
+</div>
+
+<div class="mt-4">
+ <label>
+ <div>Dashboard credentials</div>
+ <div class="mt-2"></div>
+ <label>
+ Username
+ <input type="text" />
+ </label>
+ <label>
+ Password
+ <input type="password" />
+ </label>
+ <button>Update</button>
+ </label>
+</div>
+
diff --git a/resources/views/livewire/server/_proxy/problems.blade.php b/resources/views/livewire/server/_proxy/problems.blade.php
new file mode 100644
index 0000000000..541d15e6a3
--- /dev/null
+++ b/resources/views/livewire/server/_proxy/problems.blade.php
@@ -0,0 +1,5 @@
+<div class="absolute w-full h-full bg-orange-700 rounded-lg">
+ <div class="w-full mt-32 text-center animate-pulse">
+ Problems!
+ </div>
+</div>
diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.php
index 91832611c7..6feb45043d 100644
--- a/resources/views/livewire/server/proxy.blade.php
+++ b/resources/views/livewire/server/proxy.blade.php
@@ -2,20 +2,29 @@
<h2> Proxy </h2>
@if($this->server->extra_attributes->proxy)
- <div class="mt-12">
+ <div class="mt-6">
<div>
Proxy type: {{ $this->server->extra_attributes->proxy }}
</div>
- <div class="mt-12"> Features in W11.</div>
- <ul>
- <li>Edit config file</li>
- <li>Enable dashboard (blocking port by firewall)</li>
- <li>Dashboard access - login/password</li>
- <li>Setup host for Traefik Dashboard</li>
- <li>Visit (nav to traefik dashboard)</li>
- </ul>
+
+ <div id="proxy_options" x-init="$wire.checkProxySettingsInSync()" class="relative w-fit">
+
+ {{-- Proxy is being checked against DB information --}}
+ @if(! $this->is_check_proxy_complete)
+ @include('livewire.server._proxy.loading')
+ @endif
+
+ @if($this->is_check_proxy_complete && (! $this->is_proxy_settings_in_sync) )
+ @include('livewire.server._proxy.problems')
+ @endif
+
+ @include('livewire.server._proxy.options')
+ </div>
+
</div>
@else
+ {{-- There is no Proxy installed --}}
+
No proxy installed.
<select wire:model="selectedProxy">
<option value="{{ \App\Enums\ProxyTypes::TRAEFIK_V2 }}">
diff --git a/resources/views/server/show.blade.php b/resources/views/server/show.blade.php
index d8cd68126f..24c70a2ebb 100644
--- a/resources/views/server/show.blade.php
+++ b/resources/views/server/show.blade.php
@@ -14,7 +14,6 @@
<p>Network: {{ data_get($docker, 'network') }}</p>
@endforeach
@endif
- <h1> {{ $server->name }}</h1>
<livewire:server.proxy :server="$server"/>
</x-layout>
diff --git a/scripts/run b/scripts/run
index 6c4cdcb5d3..14154e30fc 100755
--- a/scripts/run
+++ b/scripts/run
@@ -35,6 +35,9 @@ function schedule-run {
function reset-db {
bash vendor/bin/spin exec -u webuser coolify php artisan migrate:fresh --seed
}
+function mfs {
+ reset-db
+}
function coolify {
bash vendor/bin/spin exec -u webuser coolify bash
}