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.

update proxy things

Andras Bacsaic1bafccac1e4
diff --git a/.env.production b/.env.production
index 7ea84bd0ed..05e553f394 100644
--- a/.env.production
+++ b/.env.production
@@ -1,3 +1,6 @@
+COOLIFY_DEFAULT_PROXY=traefik
+COOLIFY_DEFAULT_NETWORK=coolify
+
APP_NAME=Coolify
APP_SERVICE=php
APP_ENV=local
diff --git a/app/Actions/Proxy/InstallProxy.php b/app/Actions/Proxy/InstallProxy.php
index 5b61118cdb..42492ba413 100644
--- a/app/Actions/Proxy/InstallProxy.php
+++ b/app/Actions/Proxy/InstallProxy.php
@@ -11,7 +11,6 @@ use Spatie\Url\Url;
class InstallProxy
{
-
public function __invoke(Server $server): Activity
{
$proxy_path = config('coolify.proxy_config_path');
diff --git a/app/Http/Livewire/Project/Application/Danger.php b/app/Http/Livewire/Project/Application/Danger.php
index 0a2f59d348..55eb7e0847 100644
--- a/app/Http/Livewire/Project/Application/Danger.php
+++ b/app/Http/Livewire/Project/Application/Danger.php
@@ -2,8 +2,27 @@
namespace App\Http\Livewire\Project\Application;
+use App\Models\Application;
use Livewire\Component;
class Danger extends Component
{
+ public Application $application;
+ public array $parameters;
+
+ public function mount()
+ {
+ $this->parameters = getParameters();
+ }
+ public function delete()
+ {
+ $destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
+
+ instantRemoteProcess(["docker rm -f {$this->application->uuid}"], $destination->server);
+ $this->application->delete();
+ return redirect()->route('project.resources', [
+ 'project_uuid' => $this->parameters['project_uuid'],
+ 'environment_name' => $this->parameters['environment_name']
+ ]);
+ }
}
diff --git a/app/Http/Livewire/Project/Application/Deploy.php b/app/Http/Livewire/Project/Application/Deploy.php
index 39181ce900..2a655473ec 100644
--- a/app/Http/Livewire/Project/Application/Deploy.php
+++ b/app/Http/Livewire/Project/Application/Deploy.php
@@ -64,15 +64,6 @@ class Deploy extends Component
return $this->redirectToDeployment();
}
- public function delete()
- {
- $this->stop();
- Application::find($this->applicationId)->delete();
- return redirect()->route('project.resources', [
- 'project_uuid' => $this->parameters['project_uuid'],
- 'environment_name' => $this->parameters['environment_name']
- ]);
- }
public function stop()
{
instantRemoteProcess(["docker rm -f {$this->application->uuid}"], $this->destination->server);
diff --git a/app/Jobs/AutoUpdateJob.php b/app/Jobs/AutoUpdateJob.php
index 1da36f365c..dc1927efd5 100644
--- a/app/Jobs/AutoUpdateJob.php
+++ b/app/Jobs/AutoUpdateJob.php
@@ -6,7 +6,6 @@ use App\Enums\ActivityTypes;
use App\Models\InstanceSettings;
use App\Models\Server;
use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
@@ -15,7 +14,7 @@ use Illuminate\Support\Facades\Log;
class AutoUpdateJob implements ShouldQueue
{
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, ShouldBeUnique;
+ use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
@@ -24,8 +23,6 @@ class AutoUpdateJob implements ShouldQueue
{
$instance_settings = InstanceSettings::get();
if (!$instance_settings->is_auto_update_enabled) {
- Log::info('Auto update is disabled');
- dd('Auto update is disabled');
$this->delete();
}
}
@@ -39,11 +36,9 @@ class AutoUpdateJob implements ShouldQueue
$latest_version = getLatestVersionOfCoolify();
$current_version = config('version');
if ($latest_version === $current_version) {
- dd('no update, versions match', $latest_version, $current_version);
return;
}
if (version_compare($latest_version, $current_version, '<')) {
- dd('no update, latest version is lower than current version');
return;
}
@@ -57,7 +52,6 @@ class AutoUpdateJob implements ShouldQueue
remoteProcess([
"sleep 10"
], $server, ActivityTypes::INLINE->value);
- dd('update done');
} else {
$latest_version = getLatestVersionOfCoolify();
$current_version = config('version');
diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php
index 68d5362160..d6e5074b7b 100644
--- a/database/seeders/ProductionSeeder.php
+++ b/database/seeders/ProductionSeeder.php
@@ -2,11 +2,13 @@
namespace Database\Seeders;
+use App\Data\ServerMetadata;
+use App\Enums\ProxyStatus;
+use App\Enums\ProxyTypes;
use App\Models\GithubApp;
use App\Models\GitlabApp;
use App\Models\InstanceSettings;
use App\Models\PrivateKey;
-use App\Models\Project;
use App\Models\Server;
use App\Models\Team;
use Illuminate\Database\Seeder;
@@ -73,20 +75,26 @@ class ProductionSeeder extends Seeder
// TODO: Add a command to generate a new SSH key for the Coolify host machine (localhost).
echo "No SSH key found for the Coolify host machine (localhost).\n";
echo "Please generate one and save it in storage/app/ssh-keys/{$coolify_key_name}\n";
- exit(1);
}
// Add Coolify host (localhost) as Server if it doesn't exist
if (Server::find(0) == null) {
- $server = Server::create([
+ $server_details = [
'id' => 0,
'name' => "localhost",
- 'description' => "This is the local machine",
+ 'description' => "This is the server where Coolify is running on. Don't delete this!",
'user' => 'root',
'ip' => "host.docker.internal",
'team_id' => 0,
- 'private_key_id' => 0,
- ]);
+ 'private_key_id' => 0
+ ];
+ if (env('COOLIFY_DEFAULT_PROXY') == 'traefik') {
+ $server_details['extra_attributes'] = ServerMetadata::from([
+ 'proxy_type' => ProxyTypes::TRAEFIK_V2->value,
+ 'proxy_status' => ProxyStatus::EXITED->value
+ ]);
+ }
+ $server = Server::create($server_details);
$server->settings->is_validated = true;
$server->settings->save();
}
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php
index 8e9a5bdcba..ef70c569b1 100644
--- a/resources/views/livewire/server/form.blade.php
+++ b/resources/views/livewire/server/form.blade.php
@@ -4,9 +4,11 @@
<div class="flex gap-2">
<h2>General</h2>
<x-inputs.button type="submit">Save</x-inputs.button>
- <x-inputs.button isWarning x-on:click.prevent="deleteServer = true">
- Delete
- </x-inputs.button>
+ @if ($server_id !== 0)
+ <x-inputs.button isWarning x-on:click.prevent="deleteServer = true">
+ Delete
+ </x-inputs.button>
+ @endif
</div>
<div class="flex flex-col gap-2 xl:flex-row">
<div class="flex flex-col w-96">