From 07750745097cf55a6391cc608d64b06ec0d81d73 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 10 Oct 2023 14:34:38 +0200 Subject: [PATCH 01/10] version++ --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index e601b9e8c..e5bda8c43 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.73', + 'release' => '4.0.0-beta.74', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 8d6fa9270..37fb394e4 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Tue, 10 Oct 2023 15:36:06 +0200 Subject: [PATCH 02/10] cleanup --- app/Console/Kernel.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d6ea360ae..52bf06ed9 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -32,7 +32,6 @@ protected function schedule(Schedule $schedule): void $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->job(new CleanupInstanceStuffsJob)->everyTwoMinutes()->onOneServer(); $schedule->job(new CheckResaleLicenseJob)->hourly()->onOneServer(); - // $schedule->job(new DockerCleanupJob)->everyTenMinutes()->onOneServer(); $this->instance_auto_update($schedule); $this->check_scheduled_backups($schedule); $this->check_resources($schedule); From 8082dc1a0158d87e57a716181b0bd2a8366cc201 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 09:23:31 +0200 Subject: [PATCH 03/10] fix: use port exposed for reverse proxy --- app/Jobs/ApplicationDeploymentJob.php | 2 +- bootstrap/helpers/docker.php | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index f4b839ec3..33324620a 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -620,7 +620,7 @@ private function generate_compose_file() 'container_name' => $this->container_name, 'restart' => RESTART_MODE, 'environment' => $environment_variables, - 'labels' => generateLabelsApplication($this->application, $this->preview), + 'labels' => generateLabelsApplication($this->application, $this->preview, $ports), 'expose' => $ports, 'networks' => [ $this->destination->network, diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index 2b779480f..adf1761f1 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -147,7 +147,7 @@ function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'applica } return $labels; } -function fqdnLabelsForTraefik(Collection $domains, bool $is_force_https_enabled) +function fqdnLabelsForTraefik(Collection $domains, bool $is_force_https_enabled, $onlyPort = null) { $labels = collect([]); $labels->push('traefik.enable=true'); @@ -158,7 +158,9 @@ function fqdnLabelsForTraefik(Collection $domains, bool $is_force_https_enabled) $path = $url->getPath(); $schema = $url->getScheme(); $port = $url->getPort(); - + if (is_null($port) && !is_null($onlyPort)) { + $port = $onlyPort; + } $http_label = "{$uuid}-http"; $https_label = "{$uuid}-https"; @@ -203,9 +205,12 @@ function fqdnLabelsForTraefik(Collection $domains, bool $is_force_https_enabled) return $labels; } -function generateLabelsApplication(Application $application, ?ApplicationPreview $preview = null): array +function generateLabelsApplication(Application $application, ?ApplicationPreview $preview = null, $ports): array { - + $onlyPort = null; + if (count($ports) === 1) { + $onlyPort = $ports[0]; + } $pull_request_id = data_get($preview, 'pull_request_id', 0); $container_name = generateApplicationContainerName($application, $pull_request_id); $appId = $application->id; @@ -221,7 +226,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview $domains = Str::of(data_get($application, 'fqdn'))->explode(','); } // Add Traefik labels no matter which proxy is selected - $labels = $labels->merge(fqdnLabelsForTraefik($domains, $application->settings->is_force_https_enabled)); + $labels = $labels->merge(fqdnLabelsForTraefik($domains, $application->settings->is_force_https_enabled,$onlyPort)); } return $labels->all(); } From 9f8caac91c2cf45931d36b778b890d52fc9f5c37 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 09:31:30 +0200 Subject: [PATCH 04/10] dev: coolify proxy access logs exposed in dev --- bootstrap/helpers/proxy.php | 2 ++ docker-compose.dev.yml | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php index 86034282e..abada1bda 100644 --- a/bootstrap/helpers/proxy.php +++ b/bootstrap/helpers/proxy.php @@ -102,6 +102,8 @@ function generate_default_proxy_configuration(Server $server) ]; if (isDev()) { $config['services']['traefik']['command'][] = "--log.level=debug"; + $config['services']['traefik']['command'][] = "--accesslog.filepath=/traefik/access.log"; + $config['services']['traefik']['command'][] = "--accesslog.bufferingsize=100"; } $config = Yaml::dump($config, 4, 2); SaveConfiguration::run($server, $config); diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 0d78d257b..0bf3e8828 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -34,14 +34,16 @@ services: POSTGRES_DB: "${DB_DATABASE:-coolify}" POSTGRES_HOST_AUTH_METHOD: "trust" volumes: - - coolify-pg-data-dev:/var/lib/postgresql/data + - ./_data/coolify/_volumes/database/:/var/lib/postgresql/data + # - coolify-pg-data-dev:/var/lib/postgresql/data redis: ports: - "${FORWARD_REDIS_PORT:-6379}:6379" env_file: - .env volumes: - - coolify-redis-data-dev:/data + - ./_data/coolify/_volumes/redis/:/data + # - coolify-redis-data-dev:/data vite: image: node:19 working_dir: /var/www/html @@ -56,7 +58,8 @@ services: volumes: - /:/host - /var/run/docker.sock:/var/run/docker.sock - - coolify-data-dev:/data/coolify + - ./_data/coolify/:/data/coolify + # - coolify-data-dev:/data/coolify mailpit: image: "axllent/mailpit:latest" container_name: coolify-mail @@ -76,7 +79,8 @@ services: MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY:-minioadmin}" MINIO_SECRET_KEY: "${MINIO_SECRET_KEY:-minioadmin}" volumes: - - coolify-minio-data-dev:/data + - ./_data/coolify/_volumes/minio/:/data + # - coolify-minio-data-dev:/data networks: - coolify From 68091b44fc31354e97707bf720ba5fdde2d540f8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 09:54:01 +0200 Subject: [PATCH 05/10] fix: contact link --- README.md | 2 +- config/coolify.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0c091c41..8d5ea5a74 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ # Installation ## Support -Contact us [here](https://coolify.io/contact). +Contact us [here](https://coolify.io/docs/contact). ## Recognitions diff --git a/config/coolify.php b/config/coolify.php index 5209958b5..05917d17a 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -1,7 +1,7 @@ 'https://coolify.io/contact', + 'docs' => 'https://coolify.io/docs/contact', 'self_hosted' => env('SELF_HOSTED', true), 'waitlist' => env('WAITLIST', false), 'license_url' => 'https://licenses.coollabs.io', From a4f1fcba5820f891cac23cf8d3ae5915ffc70477 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 09:55:05 +0200 Subject: [PATCH 06/10] move subscription to livewire + show manage subscription button for people already subscribed once --- app/Http/Controllers/Controller.php | 9 ---- app/Http/Livewire/Subscription/Show.php | 30 ++++++++++++ bootstrap/helpers/subscriptions.php | 5 +- .../livewire/subscription/show.blade.php | 49 +++++++++++++++++++ resources/views/subscription/index.blade.php | 46 ----------------- routes/web.php | 3 +- 6 files changed, 85 insertions(+), 57 deletions(-) create mode 100644 app/Http/Livewire/Subscription/Show.php create mode 100644 resources/views/livewire/subscription/show.blade.php delete mode 100644 resources/views/subscription/index.blade.php diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 0f4934846..a2978e2ee 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -46,15 +46,6 @@ public function link() } return redirect()->route('login')->with('error', 'Invalid credentials.'); } - public function subscription() - { - if (!isCloud()) { - abort(404); - } - return view('subscription.index', [ - 'settings' => InstanceSettings::get(), - ]); - } public function license() { diff --git a/app/Http/Livewire/Subscription/Show.php b/app/Http/Livewire/Subscription/Show.php new file mode 100644 index 000000000..ff028f68f --- /dev/null +++ b/app/Http/Livewire/Subscription/Show.php @@ -0,0 +1,30 @@ +settings = InstanceSettings::get(); + $this->alreadySubscribed = currentTeam()->subscription()->exists(); + } + public function stripeCustomerPortal() { + $session = getStripeCustomerPortalSession(currentTeam()); + if (is_null($session)) { + return; + } + return redirect($session->url); + } + public function render() + { + return view('livewire.subscription.show')->layout('layouts.subscription'); + } +} diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index 3369776f0..130654db5 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -110,7 +110,10 @@ function getStripeCustomerPortalSession(Team $team) { Stripe::setApiKey(config('subscription.stripe_api_key')); $return_url = route('team.index'); - $stripe_customer_id = $team->subscription->stripe_customer_id; + $stripe_customer_id = data_get($team,'subscription.stripe_customer_id'); + if (!$stripe_customer_id) { + return null; + } $session = \Stripe\BillingPortal\Session::create([ 'customer' => $stripe_customer_id, 'return_url' => $return_url, diff --git a/resources/views/livewire/subscription/show.blade.php b/resources/views/livewire/subscription/show.blade.php new file mode 100644 index 000000000..a0a096a91 --- /dev/null +++ b/resources/views/livewire/subscription/show.blade.php @@ -0,0 +1,49 @@ +@if ($settings->is_resale_license_active) + @if (auth()->user()->isAdminFromSession()) +
+
+
+

Subscription

+ + @if (subscriptionProvider() === 'stripe' && $alreadySubscribed) + Manage My Subscription + @endif +
+
+ Currently active team: {{ session('currentTeam.name') }} +
+ @if (request()->query->get('cancelled')) +
+ + + + Something went wrong with your subscription. Please try again or contact + support. +
+ @endif + + @if (config('subscription.provider') !== null) + + @endif +
+
+ @else +
+
+

Subscription

+ +
+
+ Currently active team: {{ session('currentTeam.name') }} +
+
You are not an admin or have been removed from this team. If this does not make sense, please contact + us.
+
+ @endif +@else +
Resale license is not active. Please contact your instance admin.
+@endif diff --git a/resources/views/subscription/index.blade.php b/resources/views/subscription/index.blade.php deleted file mode 100644 index d36f26c81..000000000 --- a/resources/views/subscription/index.blade.php +++ /dev/null @@ -1,46 +0,0 @@ - - @if ($settings->is_resale_license_active) - @if (auth()->user()->isAdminFromSession()) -
-
-
-

Subscription

- -
-
- Currently active team: {{ session('currentTeam.name') }} -
- @if (request()->query->get('cancelled')) -
- - - - Something went wrong with your subscription. Please try again or contact - support. -
- @endif - @if (config('subscription.provider') !== null) - - @endif -
-
- @else -
-
-

Subscription

- -
-
- Currently active team: {{ session('currentTeam.name') }} -
-
You are not an admin or have been removed from this team. If this does not make sense, please contact us.
-
- @endif - @else -
Resale license is not active. Please contact your instance admin.
- @endif -
diff --git a/routes/web.php b/routes/web.php index 89b37fdce..8fde48405 100644 --- a/routes/web.php +++ b/routes/web.php @@ -18,6 +18,7 @@ use App\Http\Livewire\Server\PrivateKey\Show as PrivateKeyShow; use App\Http\Livewire\Server\Proxy\Show as ProxyShow; use App\Http\Livewire\Server\Show; +use App\Http\Livewire\Subscription\Show as SubscriptionShow; use App\Http\Livewire\Waitlist\Index as WaitlistIndex; use App\Models\GithubApp; use App\Models\GitlabApp; @@ -133,7 +134,7 @@ Route::middleware(['throttle:force-password-reset'])->group(function () { Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset'); }); - Route::get('/subscription', [Controller::class, 'subscription'])->name('subscription.index'); + Route::get('/subscription', SubscriptionShow::class)->name('subscription.index'); // Route::get('/help', Help::class)->name('help'); Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration'); Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license'); From f943fdc5bed4ae4b122d0e03572a09f6337794ff Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 09:57:35 +0200 Subject: [PATCH 07/10] fix: use only ip addresses for servers --- app/Http/Livewire/Boarding/Index.php | 2 +- app/Http/Livewire/Server/New/ByIp.php | 16 ++++++++-------- .../views/livewire/boarding/index.blade.php | 2 +- .../views/livewire/server/new/by-ip.blade.php | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/Http/Livewire/Boarding/Index.php b/app/Http/Livewire/Boarding/Index.php index c8a53d26e..53065918a 100644 --- a/app/Http/Livewire/Boarding/Index.php +++ b/app/Http/Livewire/Boarding/Index.php @@ -164,7 +164,7 @@ public function saveServer() { $this->validate([ 'remoteServerName' => 'required', - 'remoteServerHost' => 'required', + 'remoteServerHost' => 'required|ip', 'remoteServerPort' => 'required|integer', 'remoteServerUser' => 'required', ]); diff --git a/app/Http/Livewire/Server/New/ByIp.php b/app/Http/Livewire/Server/New/ByIp.php index f5c8529de..ec4827af7 100644 --- a/app/Http/Livewire/Server/New/ByIp.php +++ b/app/Http/Livewire/Server/New/ByIp.php @@ -11,13 +11,13 @@ class ByIp extends Component { public $private_keys; public $limit_reached; - public int|null $private_key_id = null; + public ?int $private_key_id = null; public $new_private_key_name; public $new_private_key_description; public $new_private_key_value; public string $name; - public string|null $description = null; + public ?string $description = null; public string $ip; public string $user = 'root'; public int $port = 22; @@ -26,16 +26,16 @@ class ByIp extends Component protected $rules = [ 'name' => 'required|string', 'description' => 'nullable|string', - 'ip' => 'required', + 'ip' => 'required|ip', 'user' => 'required|string', 'port' => 'required|integer', ]; protected $validationAttributes = [ - 'name' => 'name', - 'description' => 'description', - 'ip' => 'ip', - 'user' => 'user', - 'port' => 'port', + 'name' => 'Name', + 'description' => 'Description', + 'ip' => 'IP Address', + 'user' => 'User', + 'port' => 'Port', ]; public function mount() diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index 37ed1cfd8..d9a852067 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -200,7 +200,7 @@ label="Description" id="remoteServerDescription" />
- diff --git a/resources/views/livewire/server/new/by-ip.blade.php b/resources/views/livewire/server/new/by-ip.blade.php index 2c84e6cf3..0a80b14a4 100644 --- a/resources/views/livewire/server/new/by-ip.blade.php +++ b/resources/views/livewire/server/new/by-ip.blade.php @@ -11,8 +11,8 @@
- + helper="An IP Address (127.0.0.1). No domain names." /> +
From f001e9bc3469332ab3d711fc52d11c7de0dfc513 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 10:08:37 +0200 Subject: [PATCH 08/10] improve dashboard --- app/Http/Livewire/Dashboard.php | 10 +------ resources/views/livewire/dashboard.blade.php | 26 ++++--------------- .../livewire/project/service/index.blade.php | 8 +++--- routes/web.php | 1 - 4 files changed, 10 insertions(+), 35 deletions(-) diff --git a/app/Http/Livewire/Dashboard.php b/app/Http/Livewire/Dashboard.php index d411312d5..723b00f7f 100644 --- a/app/Http/Livewire/Dashboard.php +++ b/app/Http/Livewire/Dashboard.php @@ -11,19 +11,11 @@ class Dashboard extends Component { public $projects = []; public $servers = []; - public int $s3s = 0; - public int $resources = 0; public function mount() { $this->servers = Server::ownedByCurrentTeam()->get(); - $this->s3s = S3Storage::ownedByCurrentTeam()->get()->count(); - $projects = Project::ownedByCurrentTeam()->get(); - foreach ($projects as $project) { - $this->resources += $project->applications->count(); - $this->resources += $project->postgresqls->count(); - } - $this->projects = $projects; + $this->projects = Project::ownedByCurrentTeam()->get(); } // public function getIptables() // { diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php index c0d4a3575..934923ce9 100644 --- a/resources/views/livewire/dashboard.blade.php +++ b/resources/views/livewire/dashboard.blade.php @@ -14,27 +14,7 @@ Your subscription has been activated! Welcome onboard! @endif -
-
-
Servers
-
{{ $servers->count() }}
-
-
-
Projects
-
{{ $projects->count() }}
-
- -
-
Resources
-
{{ $resources }}
-
Applications, databases, etc...
-
-
-
S3 Storages
-
{{ $s3s }}
-
-

Projects

@if ($projects->count() === 1) @@ -60,6 +40,10 @@ {{ $project->description }} @endif + + + New Resource + @endforeach + {{-- Get IPTABLES --}} diff --git a/resources/views/livewire/project/service/index.blade.php b/resources/views/livewire/project/service/index.blade.php index c5f16c727..0122e5569 100644 --- a/resources/views/livewire/project/service/index.blade.php +++ b/resources/views/livewire/project/service/index.blade.php @@ -65,8 +65,8 @@ @endif
{{ $application->status }}
- Logs + Logs @endforeach @foreach ($databases as $database) @@ -94,8 +94,8 @@ @endif
{{ $database->status }}
- Logs + Logs @endforeach diff --git a/routes/web.php b/routes/web.php index 8fde48405..7be6c8ac8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -135,7 +135,6 @@ Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset'); }); Route::get('/subscription', SubscriptionShow::class)->name('subscription.index'); - // Route::get('/help', Help::class)->name('help'); Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration'); Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license'); Route::get('/profile', fn () => view('profile', ['request' => request()]))->name('profile'); From 2552cb2208d9eeffb4e8598188e2a26dbf7ca1ea Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 10:19:03 +0200 Subject: [PATCH 09/10] ui: able to select environment on new resource --- app/Http/Livewire/Project/New/Select.php | 16 +++++++++++++--- .../views/livewire/project/new/select.blade.php | 11 ++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/Http/Livewire/Project/New/Select.php b/app/Http/Livewire/Project/New/Select.php index 4a40c6b35..8f1271c35 100644 --- a/app/Http/Livewire/Project/New/Select.php +++ b/app/Http/Livewire/Project/New/Select.php @@ -2,12 +2,11 @@ namespace App\Http\Livewire\Project\New; +use App\Models\Project; use App\Models\Server; use Countable; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; -use Illuminate\Support\Facades\File; -use Illuminate\Support\Facades\Http; use Livewire\Component; class Select extends Component @@ -24,7 +23,8 @@ class Select extends Component public Collection|array $services = []; public bool $loadingServices = true; public bool $loading = false; - + public $environments = []; + public ?string $selectedEnvironment = null; public ?string $existingPostgresqlUrl = null; protected $queryString = [ @@ -37,8 +37,18 @@ public function mount() if (isDev()) { $this->existingPostgresqlUrl = 'postgres://coolify:password@coolify-db:5432'; } + $projectUuid = data_get($this->parameters, 'project_uuid'); + $this->environments = Project::whereUuid($projectUuid)->first()->environments; + $this->selectedEnvironment = data_get($this->parameters, 'environment_name'); } + public function updatedSelectedEnvironment() + { + return redirect()->route('project.resources.new', [ + 'project_uuid' => $this->parameters['project_uuid'], + 'environment_name' => $this->selectedEnvironment, + ]); + } // public function addExistingPostgresql() // { // try { diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php index 4e96cdf76..a7693de0d 100644 --- a/resources/views/livewire/project/new/select.blade.php +++ b/resources/views/livewire/project/new/select.blade.php @@ -1,5 +1,14 @@
-

New Resource

+
+

New Resource

+
+ + @foreach ($environments as $environment) + + @endforeach + +
+
Deploy resources, like Applications, Databases, Services...
@if ($current_step === 'type') From 5541c135df734e5ad293ececa4e899416b1c33a4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 11 Oct 2023 11:00:40 +0200 Subject: [PATCH 10/10] feat: proxy logs on the ui --- app/Http/Livewire/Server/Proxy/Logs.php | 28 ++++ app/Http/Livewire/Server/Proxy/Show.php | 5 + app/View/Components/Server/Sidebar.php | 27 ++++ .../views/components/server/sidebar.blade.php | 20 +++ .../views/livewire/server/proxy.blade.php | 130 +++++++++--------- .../livewire/server/proxy/logs.blade.php | 9 ++ .../livewire/server/proxy/show.blade.php | 7 +- routes/web.php | 3 +- 8 files changed, 160 insertions(+), 69 deletions(-) create mode 100644 app/Http/Livewire/Server/Proxy/Logs.php create mode 100644 app/View/Components/Server/Sidebar.php create mode 100644 resources/views/components/server/sidebar.blade.php create mode 100644 resources/views/livewire/server/proxy/logs.blade.php diff --git a/app/Http/Livewire/Server/Proxy/Logs.php b/app/Http/Livewire/Server/Proxy/Logs.php new file mode 100644 index 000000000..cb8c245a6 --- /dev/null +++ b/app/Http/Livewire/Server/Proxy/Logs.php @@ -0,0 +1,28 @@ +parameters = get_route_parameters(); + try { + $this->server = Server::ownedByCurrentTeam(['name', 'proxy'])->whereUuid(request()->server_uuid)->first(); + if (is_null($this->server)) { + return redirect()->route('server.all'); + } + } catch (\Throwable $e) { + return handleError($e, $this); + } + } + public function render() + { + return view('livewire.server.proxy.logs'); + } +} diff --git a/app/Http/Livewire/Server/Proxy/Show.php b/app/Http/Livewire/Server/Proxy/Show.php index daadf0ede..26ea54e49 100644 --- a/app/Http/Livewire/Server/Proxy/Show.php +++ b/app/Http/Livewire/Server/Proxy/Show.php @@ -9,6 +9,11 @@ class Show extends Component { public ?Server $server = null; public $parameters = []; + protected $listeners = ['proxyStatusUpdated']; + public function proxyStatusUpdated() + { + $this->server->refresh(); + } public function mount() { $this->parameters = get_route_parameters(); diff --git a/app/View/Components/Server/Sidebar.php b/app/View/Components/Server/Sidebar.php new file mode 100644 index 000000000..f968b6d0c --- /dev/null +++ b/app/View/Components/Server/Sidebar.php @@ -0,0 +1,27 @@ + + @if ($server->isFunctional()) +
+
+ + + + @if (data_get($server, 'proxy.type') !== 'NONE') + + + + @endif +
+
+ @else +
Server is not validated. Validate first.
+ @endif +
diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.php index f0bf00874..3c35488e2 100644 --- a/resources/views/livewire/server/proxy.blade.php +++ b/resources/views/livewire/server/proxy.blade.php @@ -1,75 +1,71 @@
- @if ($server->isFunctional()) - @if (data_get($server, 'proxy.type')) -
- @if ($selectedProxy === 'TRAEFIK_V2') -
-
-

Proxy

- Save - @if ($server->proxy->status === 'exited') - Switch Proxy - @endif + @if (data_get($server, 'proxy.type')) +
+ @if ($selectedProxy === 'TRAEFIK_V2') + +
+

Configuration

+ Save + @if ($server->proxy->status === 'exited') + Switch Proxy + @endif +
+
Traefik v2
+ @if ( + $server->proxy->last_applied_settings && + $server->proxy->last_saved_settings !== $server->proxy->last_applied_settings) +
Configuration out of sync. Restart the proxy to apply the new + configurations.
-
Traefik v2
- @if ( - $server->proxy->last_applied_settings && - $server->proxy->last_saved_settings !== $server->proxy->last_applied_settings) -
Configuration out of sync. Restart the proxy to apply the new - configurations. + @endif + +
+ +
+
+ @if ($proxy_settings) +
+ + + Reset configuration to default +
@endif - -
- -
-
- @if ($proxy_settings) -
- - - Reset configuration to default - -
- @endif -
- - @elseif($selectedProxy === 'NONE') -
-

Proxy

- Switch Proxy -
-
None
- @else -
-

Proxy

- Switch Proxy -
- @endif - @else -
-

Proxy

-
Select a proxy you would like to use on this server.
-
- - Custom (None) - - - Traefik - v2 - - - Nginx - - - Caddy -
+ + @elseif($selectedProxy === 'NONE') +
+

Configuration

+ Switch Proxy
- @endif - @else -
Server is not validated. Validate first.
+
Custom (None) Proxy Selected
+ @else +
+

Configuration

+ Switch Proxy +
+ @endif + @else +
+

Configuration

+
Select a proxy you would like to use on this server.
+
+ + Custom (None) + + + Traefik + v2 + + + Nginx + + + Caddy + +
+
@endif
diff --git a/resources/views/livewire/server/proxy/logs.blade.php b/resources/views/livewire/server/proxy/logs.blade.php new file mode 100644 index 000000000..58e718424 --- /dev/null +++ b/resources/views/livewire/server/proxy/logs.blade.php @@ -0,0 +1,9 @@ +
+ +
+ +
+ +
+
+
diff --git a/resources/views/livewire/server/proxy/show.blade.php b/resources/views/livewire/server/proxy/show.blade.php index 6a5018d0b..33b30448e 100644 --- a/resources/views/livewire/server/proxy/show.blade.php +++ b/resources/views/livewire/server/proxy/show.blade.php @@ -1,4 +1,9 @@
- +
+ +
+ +
+
diff --git a/routes/web.php b/routes/web.php index 7be6c8ac8..1a9d5851c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,7 +5,6 @@ use App\Http\Controllers\DatabaseController; use App\Http\Controllers\MagicController; use App\Http\Controllers\ProjectController; -use App\Http\Controllers\ServerController; use App\Http\Livewire\Boarding\Index as BoardingIndex; use App\Http\Livewire\Project\Service\Index as ServiceIndex; use App\Http\Livewire\Project\Service\Show as ServiceShow; @@ -17,6 +16,7 @@ use App\Http\Livewire\Server\Destination\Show as DestinationShow; use App\Http\Livewire\Server\PrivateKey\Show as PrivateKeyShow; use App\Http\Livewire\Server\Proxy\Show as ProxyShow; +use App\Http\Livewire\Server\Proxy\Logs as ProxyLogs; use App\Http\Livewire\Server\Show; use App\Http\Livewire\Subscription\Show as SubscriptionShow; use App\Http\Livewire\Waitlist\Index as WaitlistIndex; @@ -123,6 +123,7 @@ Route::get('/server/new', Create::class)->name('server.create'); Route::get('/server/{server_uuid}', Show::class)->name('server.show'); Route::get('/server/{server_uuid}/proxy', ProxyShow::class)->name('server.proxy'); + Route::get('/server/{server_uuid}/proxy/logs', ProxyLogs::class)->name('server.proxy.logs'); Route::get('/server/{server_uuid}/private-key', PrivateKeyShow::class)->name('server.private-key'); Route::get('/server/{server_uuid}/destinations', DestinationShow::class)->name('server.destinations'); });