diff --git a/app/Http/Livewire/PrivateKey/Change.php b/app/Http/Livewire/PrivateKey/Change.php
new file mode 100644
index 000000000..a070e600b
--- /dev/null
+++ b/app/Http/Livewire/PrivateKey/Change.php
@@ -0,0 +1,41 @@
+ 'required|string',
+ 'private_key.description' => 'nullable|string',
+ 'private_key.private_key' => 'required|string'
+ ];
+ public function mount()
+ {
+ $this->private_key = PrivateKey::where('uuid', $this->private_key_uuid)->first();
+ }
+ public function delete($private_key_uuid)
+ {
+ PrivateKey::where('uuid', $private_key_uuid)->delete();
+ session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
+ redirect()->route('dashboard');
+ }
+ public function changePrivateKey()
+ {
+ try {
+ $this->private_key->private_key = trim($this->private_key->private_key);
+ if (!str_ends_with($this->private_key->private_key, "\n")) {
+ $this->private_key->private_key .= "\n";
+ }
+ $this->private_key->save();
+ session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
+ } catch (\Exception $e) {
+ $this->addError('private_key_value', $e->getMessage());
+ }
+ }
+}
diff --git a/app/Http/Livewire/PrivateKey/Create.php b/app/Http/Livewire/PrivateKey/Create.php
new file mode 100644
index 000000000..ee73827ea
--- /dev/null
+++ b/app/Http/Livewire/PrivateKey/Create.php
@@ -0,0 +1,28 @@
+private_key_value = trim($this->private_key_value);
+ if (!str_ends_with($this->private_key_value, "\n")) {
+ $this->private_key_value .= "\n";
+ }
+ $new_private_key = PrivateKey::create([
+ 'name' => $this->private_key_name,
+ 'description' => $this->private_key_description,
+ 'private_key' => $this->private_key_value,
+ 'team_id' => session('currentTeam')->id
+ ]);
+ session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
+ redirect()->route('private-key.show', $new_private_key->uuid);
+ }
+}
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.php
index b676b463c..bd7f18a41 100644
--- a/app/Http/Livewire/Project/New/PublicGitRepository.php
+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php
@@ -45,11 +45,11 @@ public function mount()
$this->parameters = Route::current()->parameters();
$this->servers = session('currentTeam')->load(['servers'])->servers;
}
- public function chooseServer($server_id)
+ public function chooseServer($server)
{
- $this->chosenServer = $server_id;
- $this->standalone_docker = StandaloneDocker::where('server_id', $server_id)->get();
- $this->swarm_docker = SwarmDocker::where('server_id', $server_id)->get();
+ $this->chosenServer = $server;
+ $this->standalone_docker = StandaloneDocker::where('server_id', $server['id'])->get();
+ $this->swarm_docker = SwarmDocker::where('server_id', $server['id'])->get();
}
public function setDestination($destination_uuid, $destination_type)
{
diff --git a/app/Http/Livewire/Server/New/ByIp.php b/app/Http/Livewire/Server/New/ByIp.php
index e5fdafa98..baf638a2f 100644
--- a/app/Http/Livewire/Server/New/ByIp.php
+++ b/app/Http/Livewire/Server/New/ByIp.php
@@ -15,7 +15,7 @@ class ByIp extends Component
public $new_private_key_value;
public string $name;
- public string $description;
+ public string|null $description = null;
public string $ip;
public string $user = 'root';
public int $port = 22;
@@ -29,20 +29,6 @@ public function setPrivateKey($private_key_id)
{
$this->private_key_id = $private_key_id;
}
- public function addPrivateKey()
- {
- $this->new_private_key_value = trim($this->new_private_key_value);
- if (!str_ends_with($this->new_private_key_value, "\n")) {
- $this->new_private_key_value .= "\n";
- }
- PrivateKey::create([
- 'name' => $this->new_private_key_name,
- 'description' => $this->new_private_key_description,
- 'private_key' => $this->new_private_key_value,
- 'team_id' => session('currentTeam')->id
- ]);
- session('currentTeam')->privateKeys = $this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
- }
public function submit()
{
if (!$this->private_key_id) {
diff --git a/app/Http/Livewire/Server/PrivateKey.php b/app/Http/Livewire/Server/PrivateKey.php
new file mode 100644
index 000000000..6e57f4ad2
--- /dev/null
+++ b/app/Http/Livewire/Server/PrivateKey.php
@@ -0,0 +1,26 @@
+parameters['server_uuid'])->update([
+ 'private_key_id' => $private_key_id
+ ]);
+ return redirect()->route('server.show', $this->parameters['server_uuid']);
+ }
+ public function mount()
+ {
+ $this->parameters = Route::current()->parameters();
+ $this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get();
+ }
+}
diff --git a/app/Jobs/DeployApplicationJob.php b/app/Jobs/DeployApplicationJob.php
index 501f45039..5eb1f5f75 100644
--- a/app/Jobs/DeployApplicationJob.php
+++ b/app/Jobs/DeployApplicationJob.php
@@ -222,10 +222,10 @@ public function handle(): void
Storage::disk('deployments')->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose);
} catch (\Exception $e) {
$this->executeNow([
- "echo 'Oops something is not okay, are you okay? 😢'",
+ "echo '\nOops something is not okay, are you okay? 😢'",
"echo '\n\n{$e->getMessage()}'",
]);
- throw new \Exception('Deployment finished');
+ $this->fail($e->getMessage());
} finally {
$this->executeNow(["docker rm -f {$this->deployment_uuid} >/dev/null 2>&1"], hideFromOutput: true);
dispatch(new ContainerStatusJob($this->application_uuid));
diff --git a/app/Models/Team.php b/app/Models/Team.php
index 4c9938c5b..aaadcbb5a 100644
--- a/app/Models/Team.php
+++ b/app/Models/Team.php
@@ -24,4 +24,8 @@ public function applications()
{
return $this->hasManyThrough(Application::class, Project::class);
}
+ public function privateKeys()
+ {
+ return $this->hasMany(PrivateKey::class);
+ }
}
diff --git a/app/View/Components/FormInput.php b/app/View/Components/FormInput.php
deleted file mode 100644
index efe511b6a..000000000
--- a/app/View/Components/FormInput.php
+++ /dev/null
@@ -1,33 +0,0 @@
-makeDirectory('.ssh');
@@ -79,6 +79,7 @@ function generateSshCommand(string $private_key_location, string $server_ip, str
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
. '-o PasswordAuthentication=no '
. '-o ConnectTimeout=3600 '
+ . '-o ServerAliveInterval=60 '
. '-o RequestTTY=no '
. '-o LogLevel=ERROR '
. "-p {$port} "
diff --git a/config/coolify.php b/config/coolify.php
index 1420b5115..d7ca6c64c 100644
--- a/config/coolify.php
+++ b/config/coolify.php
@@ -1,7 +1,7 @@
'4.0.0-nightly.1',
+ 'version' => '4.0.0-nightly.2',
'project_path_on_host' => env('PROJECT_PATH_ON_HOST', '/var/www/html')
];
diff --git a/resources/css/app.css b/resources/css/app.css
index dc83d5cf5..93d5c4896 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -1,3 +1,16 @@
/* @tailwind base; */
@tailwind components;
@tailwind utilities;
+
+body {
+ @apply bg-neutral-900 text-white font-sans;
+}
+a, a:visited {
+ @apply text-neutral-300 hover:text-purple-500;
+}
+input, select, textarea {
+ @apply border-none p-2 bg-neutral-800 text-white disabled:text-neutral-600;
+}
+button {
+ @apply border-none px-2 p-1 cursor-pointer;
+}
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
index bbd76134c..830296458 100644
--- a/resources/views/auth/login.blade.php
+++ b/resources/views/auth/login.blade.php
@@ -12,7 +12,7 @@
-
+
No projects found.
@endforelse -No servers found.
@endforelse -No destinations found.
+ @endforelse +No servers found.
@endforelse diff --git a/resources/views/destination/new.blade.php b/resources/views/destination/new.blade.php index a3be8a53b..55bb270e2 100644 --- a/resources/views/destination/new.blade.php +++ b/resources/views/destination/new.blade.php @@ -1,4 +1,4 @@Source Name: {{ data_get($application,'source.name') }}
-Is Public Source: {{ data_get($application,'source.is_public') }}
+Source Name: {{ data_get($application, 'source.name') }}
+Is Public Source: {{ data_get($application, 'source.is_public') }}
Did you forget to add a destination on the server?
@endforelse + @isset($chosenServer) -{{ \App\Actions\CoolifyTask\RunRemoteProcess::decodeOutput($activity) }}+
{{ \App\Actions\CoolifyTask\RunRemoteProcess::decodeOutput($activity) }}@endisset
No private keys found
+ @endforelse +{{ $server->privateKey->name }}
+Network: {{ data_get($docker, 'network') }}
diff --git a/routes/web.php b/routes/web.php index 02ad666e9..a1f219090 100644 --- a/routes/web.php +++ b/routes/web.php @@ -4,6 +4,7 @@ use App\Http\Controllers\HomeController; use App\Http\Controllers\ProjectController; use App\Models\InstanceSettings; +use App\Models\PrivateKey; use App\Models\StandaloneDocker; use App\Models\SwarmDocker; use App\Http\Controllers\ServerController; @@ -29,10 +30,13 @@ $destinations = $servers->map(function ($server) { return $server->standaloneDockers->merge($server->swarmDockers); })->flatten(); + $private_keys = session('currentTeam')->load(['privateKeys'])->privateKeys; + return view('dashboard', [ 'servers' => $servers->sortBy('name'), 'projects' => $projects->sortBy('name'), 'destinations' => $destinations->sortBy('name'), + 'private_keys' => $private_keys->sortBy('name'), ]); })->name('dashboard'); Route::get('/project/{project_uuid}', [ProjectController::class, 'environments'])->name('project.environments'); @@ -70,6 +74,15 @@ })->name('demo'); }); +Route::middleware(['auth'])->group(function () { + Route::get('/private-key/new', fn () => view('private-key.new'))->name('private-key.new'); + Route::get('/private-key/{private_key_uuid}', function () { + $private_key = PrivateKey::where('uuid', request()->private_key_uuid)->first(); + return view('private-key.show', [ + 'private_key' => $private_key, + ]); + })->name('private-key.show'); +}); Route::middleware(['auth'])->group(function () { Route::get('/server/new', fn () => view('server.new'))->name('server.new'); Route::get('/server/{server_uuid}', function () { @@ -81,10 +94,22 @@ 'server' => $server, ]); })->name('server.show'); + Route::get('/server/{server_uuid}/private-key', function () { + return view('server.private-key'); + })->name('server.private-key'); }); Route::middleware(['auth'])->group(function () { - Route::get('/destination/new', fn () => view('destination.new'))->name('destination.new'); + Route::get('/destination/new', function () { + $query_params = request()->query(); + $server_id = null; + if (isset($query_params['server_id'])) { + $server_id = $query_params['server_id']; + } + return view('destination.new', [ + 'server_id' => $server_id, + ]); + })->name('destination.new'); Route::get('/destination/{destination_uuid}', function () { $standalone_dockers = StandaloneDocker::where('uuid', request()->destination_uuid)->first(); $swarm_dockers = SwarmDocker::where('uuid', request()->destination_uuid)->first();