From 7bfeb6c177d619af7b208da4bfbb2273fbfa2ce6 Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Fri, 7 Jul 2023 21:35:29 +0200
Subject: [PATCH 01/28] feat: notify user of disk cleanup init
---
app/Console/Kernel.php | 4 ++--
app/Jobs/DockerCleanupJob.php | 15 ++++++++++++---
app/Models/Server.php | 6 +++++-
config/version.php | 2 +-
versions.json | 2 +-
5 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 1d20b7606..cbd91f662 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -14,12 +14,12 @@ class Kernel extends ConsoleKernel
{
if (isDev()) {
$schedule->command('horizon:snapshot')->everyMinute();
- // $schedule->job(new DockerCleanupJob)->everyOddHour();
+ $schedule->job(new DockerCleanupJob)->everyOddHour();
// $schedule->job(new InstanceAutoUpdateJob(true))->everyMinute();
} else {
$schedule->command('horizon:snapshot')->everyFiveMinutes();
- $schedule->job(new DockerCleanupJob)->everyTenMinutes();
$schedule->job(new ProxyCheckJob)->everyFiveMinutes();
+ $schedule->job(new DockerCleanupJob)->everyTenMinutes();
$schedule->job(new InstanceAutoUpdateJob)->everyTenMinutes();
}
}
diff --git a/app/Jobs/DockerCleanupJob.php b/app/Jobs/DockerCleanupJob.php
index 117a9bd8a..96b2d668f 100644
--- a/app/Jobs/DockerCleanupJob.php
+++ b/app/Jobs/DockerCleanupJob.php
@@ -36,16 +36,25 @@ class DockerCleanupJob implements ShouldQueue
} else {
$docker_root_filesystem = instant_remote_process(['stat --printf=%m $(docker info --format "{{json .DockerRootDir}}" |sed \'s/"//g\')'], $server);
}
- $disk_usage = json_decode(instant_remote_process(['df -hP | awk \'BEGIN {printf"{\"disks\":["}{if($1=="Filesystem")next;if(a)printf",";printf"{\"mount\":\""$6"\",\"size\":\""$2"\",\"used\":\""$3"\",\"avail\":\""$4"\",\"use%\":\""$5"\"}";a++;}END{print"]}";}\''], $server), true);
- $mount_point = collect(data_get($disk_usage, 'disks'))->where('mount', $docker_root_filesystem)->first();
- if (Str::of(data_get($mount_point, 'use%'))->trim()->replace('%', '')->value() >= $server->settings->cleanup_after_percentage) {
+ $disk_percentage_before = $this->get_disk_usage($server, $docker_root_filesystem);
+ if ($disk_percentage_before >= $server->settings->cleanup_after_percentage) {
instant_remote_process(['docker image prune -af'], $server);
instant_remote_process(['docker container prune -f --filter "label=coolify.managed=true"'], $server);
instant_remote_process(['docker builder prune -af'], $server);
+ $disk_percentage_after = $this->get_disk_usage($server, $docker_root_filesystem);
+ if ($disk_percentage_after < $disk_percentage_before) {
+ ray('Saved ' . ($disk_percentage_before - $disk_percentage_after) . '% disk space on ' . $server->name);
+ }
}
}
} catch (\Exception $e) {
Log::error($e->getMessage());
}
}
+
+ private function get_disk_usage(Server $server, string $docker_root_filesystem) {
+ $disk_usage = json_decode(instant_remote_process(['df -hP | awk \'BEGIN {printf"{\"disks\":["}{if($1=="Filesystem")next;if(a)printf",";printf"{\"mount\":\""$6"\",\"size\":\""$2"\",\"used\":\""$3"\",\"avail\":\""$4"\",\"use%\":\""$5"\"}";a++;}END{print"]}";}\''], $server), true);
+ $mount_point = collect(data_get($disk_usage, 'disks'))->where('mount', $docker_root_filesystem)->first();
+ return Str::of(data_get($mount_point, 'use%'))->trim()->replace('%', '')->value();
+ }
}
\ No newline at end of file
diff --git a/app/Models/Server.php b/app/Models/Server.php
index d3fabe967..0d21e80b0 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -84,6 +84,10 @@ class Server extends BaseModel
{
return "{$this->ip}_{$this->port}_{$this->user}";
}
+ public function team()
+ {
+ return $this->belongsTo(Team::class);
+ }
static public function ownedByCurrentTeam(array $select = ['*'])
{
$selectArray = collect($select)->concat(['id']);
@@ -102,4 +106,4 @@ class Server extends BaseModel
$swarmDocker = collect($server->swarmDockers->all());
return $standaloneDocker->concat($swarmDocker);
}
-}
+}
\ No newline at end of file
diff --git a/config/version.php b/config/version.php
index 3a9c12a30..743126446 100644
--- a/config/version.php
+++ b/config/version.php
@@ -1,3 +1,3 @@
Date: Sun, 9 Jul 2023 15:32:19 +0200
Subject: [PATCH 02/28] fix: nginx try_files
---
app/Jobs/ApplicationDeploymentJob.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 36a08fa03..7289f08a3 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -261,7 +261,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
location / {
root /usr/share/nginx/html;
index index.html;
- try_files \$uri \$uri/index.html \$uri/ /index.html =404;
+ try_files \$uri \$uri.html \$uri/index.html \$uri/ /index.html =404;
}
error_page 500 502 503 504 /50x.html;
@@ -647,4 +647,4 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
);
$this->commit = $this->saved_outputs->get('git_commit_sha');
}
-}
+}
\ No newline at end of file
From 6c955424cde640f2ebe422fff17f87a1c3d49d08 Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Tue, 11 Jul 2023 11:11:51 +0200
Subject: [PATCH 03/28] fix: master is the default, not main
---
.../Project/New/PublicGitRepository.php | 28 +++++++++++++------
bootstrap/helpers/github.php | 3 +-
.../new/public-git-repository.blade.php | 2 +-
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.php
index 9e24ed56d..1b4a3462d 100644
--- a/app/Http/Livewire/Project/New/PublicGitRepository.php
+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php
@@ -8,7 +8,7 @@ use App\Models\GitlabApp;
use App\Models\Project;
use App\Models\StandaloneDocker;
use App\Models\SwarmDocker;
-use Illuminate\Support\Facades\Log;
+use Carbon\Carbon;
use Livewire\Component;
use Spatie\Url\Url;
@@ -26,9 +26,9 @@ class PublicGitRepository extends Component
public string $selected_branch = 'main';
public bool $is_static = false;
public string|null $publish_directory = null;
- public string $git_branch;
+ public string $git_branch = 'main';
public int $rate_limit_remaining = 0;
- public int $rate_limit_reset = 0;
+ public $rate_limit_reset = 0;
private GithubApp|GitlabApp $git_source;
private string $git_host;
@@ -67,6 +67,12 @@ class PublicGitRepository extends Component
}
$this->emit('success', 'Application settings updated!');
}
+ private function get_branch()
+ {
+ ['rate_limit_remaining' => $this->rate_limit_remaining, 'rate_limit_reset' => $this->rate_limit_reset] = git_api(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches/{$this->git_branch}");
+ $this->rate_limit_reset = Carbon::parse((int)$this->rate_limit_reset)->format('Y-M-d H:i:s.u');
+ $this->branch_found = true;
+ }
public function load_branch()
{
$this->branch_found = false;
@@ -74,12 +80,18 @@ class PublicGitRepository extends Component
'repository_url' => 'required|url'
]);
$this->get_git_source();
-
try {
- ['data' => $data, 'rate_limit_remaining' => $this->rate_limit_remaining, 'rate_limit_reset' => $this->rate_limit_reset] = git_api(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches/{$this->git_branch}");
- $this->branch_found = true;
- } catch (\Throwable $e) {
- return general_error_handler(err: $e, that: $this);
+ $this->get_branch();
+ } catch (\Exception $e) {
+ }
+
+ if (!$this->branch_found && $this->git_branch == 'main') {
+ try {
+ $this->git_branch = 'master';
+ $this->get_branch();
+ } catch (\Exception $e) {
+ return general_error_handler(err: $e, that: $this);
+ }
}
}
private function get_git_source()
diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.php
index 4e4fdd7fc..8d18e6290 100644
--- a/bootstrap/helpers/github.php
+++ b/bootstrap/helpers/github.php
@@ -2,6 +2,7 @@
use App\Models\GithubApp;
use App\Models\GitlabApp;
+use Carbon\Carbon;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Http;
use Lcobucci\JWT\Encoding\ChainedFormatter;
@@ -64,7 +65,7 @@ function git_api(GithubApp|GitlabApp $source, string $endpoint, string $method =
}
$json = $response->json();
if ($response->failed() && $throwError) {
- throw new \Exception("Failed to get data from {$source->name} with error:
" . $json['message']);
+ throw new \Exception("Failed to get data from {$source->name} with error:
" . $json['message'] . "
Rate Limit resets at: " . Carbon::parse((int)$response->header('X-RateLimit-Reset'))->format('Y-m-d H:i:s') . 'UTC');
}
return [
'rate_limit_remaining' => $response->header('X-RateLimit-Remaining'),
diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.php
index 63cfc0f54..21af86a2e 100644
--- a/resources/views/livewire/project/new/public-git-repository.blade.php
+++ b/resources/views/livewire/project/new/public-git-repository.blade.php
@@ -14,7 +14,7 @@
@if ($branch_found)
Rate limit remaining: {{ $rate_limit_remaining }}
-
Rate limit reset at: {{ date('Y-m-d H:i:s', substr($rate_limit_reset, 0, 10)) }}
+
Rate limit reset at: {{ $rate_limit_reset }}
From 4c88944286e48f53ac82234e0ff0dd3e66957d89 Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Tue, 11 Jul 2023 11:16:29 +0200
Subject: [PATCH 04/28] fix: no ms in rate limit resets
---
app/Http/Livewire/Project/New/PublicGitRepository.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.php
index 1b4a3462d..8fbaf62fb 100644
--- a/app/Http/Livewire/Project/New/PublicGitRepository.php
+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php
@@ -70,7 +70,7 @@ class PublicGitRepository extends Component
private function get_branch()
{
['rate_limit_remaining' => $this->rate_limit_remaining, 'rate_limit_reset' => $this->rate_limit_reset] = git_api(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches/{$this->git_branch}");
- $this->rate_limit_reset = Carbon::parse((int)$this->rate_limit_reset)->format('Y-M-d H:i:s.u');
+ $this->rate_limit_reset = Carbon::parse((int)$this->rate_limit_reset)->format('Y-M-d H:i:s');
$this->branch_found = true;
}
public function load_branch()
From 3cc1731c1234a0aaf3a3dd0da8b8299eaa5e894f Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Tue, 11 Jul 2023 11:51:06 +0200
Subject: [PATCH 05/28] refactor
---
app/Http/Livewire/Server/Proxy.php | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/app/Http/Livewire/Server/Proxy.php b/app/Http/Livewire/Server/Proxy.php
index 7049cd173..95e3e7e76 100644
--- a/app/Http/Livewire/Server/Proxy.php
+++ b/app/Http/Livewire/Server/Proxy.php
@@ -31,18 +31,6 @@ class Proxy extends Component
$this->server->proxy->type = null;
$this->server->save();
}
- public function installProxy()
- {
- if (
- $this->server->proxy->last_applied_settings &&
- $this->server->proxy->last_saved_settings !== $this->server->proxy->last_applied_settings
- ) {
- $this->saveConfiguration($this->server);
- }
- $activity = resolve(InstallProxy::class)($this->server);
- $this->emit('newMonitorActivity', $activity->id);
- }
-
public function setProxy(string $proxy_type)
{
$this->server->proxy->type = $proxy_type;
@@ -56,6 +44,7 @@ class Proxy extends Component
], $this->server);
$this->server->proxy->status = 'exited';
$this->server->save();
+ $this->server->refresh();
}
public function saveConfiguration()
{
From a0b2868e95101bd7974e8c9e4d4ef75da691d96e Mon Sep 17 00:00:00 2001
From: Andras Bacsai
Date: Thu, 13 Jul 2023 13:16:24 +0200
Subject: [PATCH 06/28] UI stuffs
---
.../Livewire/Project/Application/Danger.php | 3 +
.../Application/EnvironmentVariable/Add.php | 2 +
.../Application/EnvironmentVariable/All.php | 12 +-
.../Application/EnvironmentVariable/Show.php | 4 +-
.../Project/Application/Storages/Show.php | 6 +
app/Http/Livewire/Server/Form.php | 5 +-
app/View/Components/Forms/Button.php | 30 +++
app/View/Components/Forms/Checkbox.php | 34 ++++
app/View/Components/Forms/Input.php | 4 +-
app/View/Components/Forms/Select.php | 38 ++++
app/View/Components/Forms/Textarea.php | 43 ++++
app/View/Components/Modal.php | 33 ++++
package-lock.json | 15 +-
package.json | 2 +-
resources/css/app.css | 21 +-
.../components/applications/actions.blade.php | 16 +-
.../components/applications/links.blade.php | 13 +-
.../views/components/forms/button.blade.php | 54 ++---
.../views/components/forms/checkbox.blade.php | 62 +++---
.../views/components/forms/input.blade.php | 88 ++++-----
.../views/components/forms/select.blade.php | 49 ++---
.../views/components/forms/textarea.blade.php | 19 +-
.../views/components/layout-simple.blade.php | 23 +--
resources/views/components/layout.blade.php | 187 +++++++++---------
resources/views/components/modal.blade.php | 53 +++++
.../views/components/naked-modal.blade.php | 2 +-
.../livewire/private-key/change.blade.php | 2 +-
.../project/application/danger.blade.php | 13 +-
.../environment-variable/add.blade.php | 22 ++-
.../environment-variable/all.blade.php | 36 ++--
.../environment-variable/show.blade.php | 20 +-
.../project/application/previews.blade.php | 2 +-
.../project/application/source.blade.php | 27 ++-
.../application/storages/add.blade.php | 22 ++-
.../application/storages/all.blade.php | 9 +-
.../application/storages/show.blade.php | 12 +-
.../views/livewire/run-command.blade.php | 2 +-
.../views/livewire/server/form.blade.php | 14 +-
.../views/livewire/server/proxy.blade.php | 4 +-
.../livewire/server/proxy/deploy.blade.php | 15 +-
.../livewire/source/github/change.blade.php | 4 +-
.../views/livewire/team/delete.blade.php | 2 +-
tailwind.config.js | 21 +-
43 files changed, 618 insertions(+), 427 deletions(-)
create mode 100644 app/View/Components/Forms/Button.php
create mode 100644 app/View/Components/Forms/Checkbox.php
create mode 100644 app/View/Components/Forms/Select.php
create mode 100644 app/View/Components/Forms/Textarea.php
create mode 100644 app/View/Components/Modal.php
create mode 100644 resources/views/components/modal.blade.php
diff --git a/app/Http/Livewire/Project/Application/Danger.php b/app/Http/Livewire/Project/Application/Danger.php
index 72873665e..4af90927e 100644
--- a/app/Http/Livewire/Project/Application/Danger.php
+++ b/app/Http/Livewire/Project/Application/Danger.php
@@ -4,14 +4,17 @@ namespace App\Http\Livewire\Project\Application;
use App\Models\Application;
use Livewire\Component;
+use Visus\Cuid2\Cuid2;
class Danger extends Component
{
public Application $application;
public array $parameters;
+ public string|null $modalId = null;
public function mount()
{
+ $this->modalId = new Cuid2(7);
$this->parameters = getRouteParameters();
}
public function delete()
diff --git a/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php b/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php
index 9b1b78a00..9b35de54f 100644
--- a/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php
+++ b/app/Http/Livewire/Project/Application/EnvironmentVariable/Add.php
@@ -29,6 +29,7 @@ class Add extends Component
}
public function submit()
{
+ ray('submitting');
$this->validate();
$this->emitUp('submit', [
'key' => $this->key,
@@ -36,6 +37,7 @@ class Add extends Component
'is_build_time' => $this->is_build_time,
'is_preview' => $this->is_preview,
]);
+ $this->clear();
}
public function clear()
{
diff --git a/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php b/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php
index 1dcd605cd..f1ac75917 100644
--- a/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php
+++ b/app/Http/Livewire/Project/Application/EnvironmentVariable/All.php
@@ -5,11 +5,17 @@ namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
use App\Models\Application;
use App\Models\EnvironmentVariable;
use Livewire\Component;
+use Visus\Cuid2\Cuid2;
class All extends Component
{
public Application $application;
+ public string|null $modalId = null;
protected $listeners = ['refreshEnvs', 'submit'];
+ public function mount()
+ {
+ $this->modalId = new Cuid2(7);
+ }
public function refreshEnvs()
{
$this->application->refresh();
@@ -17,6 +23,11 @@ class All extends Component
public function submit($data)
{
try {
+ $found = $this->application->environment_variables()->where('key', $data['key'])->first();
+ if ($found) {
+ $this->emit('error', 'Environment variable already exists.');
+ return;
+ }
EnvironmentVariable::create([
'key' => $data['key'],
'value' => $data['value'],
@@ -27,7 +38,6 @@ class All extends Component
$this->application->refresh();
$this->emit('success', 'Environment variable added successfully.');
- $this->emit('clearAddEnv');
} catch (\Exception $e) {
return general_error_handler(err: $e, that: $this);
}
diff --git a/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php b/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php
index 61ecaf3de..c5260e77c 100644
--- a/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php
+++ b/app/Http/Livewire/Project/Application/EnvironmentVariable/Show.php
@@ -4,12 +4,13 @@ namespace App\Http\Livewire\Project\Application\EnvironmentVariable;
use App\Models\EnvironmentVariable as ModelsEnvironmentVariable;
use Livewire\Component;
+use Visus\Cuid2\Cuid2;
class Show extends Component
{
public $parameters;
public ModelsEnvironmentVariable $env;
-
+ public string|null $modalId = null;
protected $rules = [
'env.key' => 'required|string',
'env.value' => 'required|string',
@@ -22,6 +23,7 @@ class Show extends Component
];
public function mount()
{
+ $this->modalId = new Cuid2(7);
$this->parameters = getRouteParameters();
}
public function submit()
diff --git a/app/Http/Livewire/Project/Application/Storages/Show.php b/app/Http/Livewire/Project/Application/Storages/Show.php
index 41c3c1fb8..ef6042baf 100644
--- a/app/Http/Livewire/Project/Application/Storages/Show.php
+++ b/app/Http/Livewire/Project/Application/Storages/Show.php
@@ -3,10 +3,12 @@
namespace App\Http\Livewire\Project\Application\Storages;
use Livewire\Component;
+use Visus\Cuid2\Cuid2;
class Show extends Component
{
public $storage;
+ public string|null $modalId = null;
protected $rules = [
'storage.name' => 'required|string',
'storage.mount_path' => 'required|string',
@@ -17,6 +19,10 @@ class Show extends Component
'mount_path' => 'mount',
'host_path' => 'host',
];
+ public function mount()
+ {
+ $this->modalId = new Cuid2(7);
+ }
public function submit()
{
$this->validate();
diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php
index fc98c05bf..c7c056665 100644
--- a/app/Http/Livewire/Server/Form.php
+++ b/app/Http/Livewire/Server/Form.php
@@ -5,6 +5,7 @@ namespace App\Http\Livewire\Server;
use App\Actions\Server\InstallDocker;
use App\Models\Server;
use Livewire\Component;
+use Visus\Cuid2\Cuid2;
class Form extends Component
{
@@ -13,6 +14,7 @@ class Form extends Component
public $dockerVersion;
public string|null $wildcard_domain = null;
public int $cleanup_after_percentage;
+ public string|null $modalId = null;
protected $rules = [
'server.name' => 'required|min:6',
@@ -35,6 +37,7 @@ class Form extends Component
];
public function mount()
{
+ $this->modalId = new Cuid2(7);
$this->wildcard_domain = $this->server->settings->wildcard_domain;
$this->cleanup_after_percentage = $this->server->settings->cleanup_after_percentage;
}
@@ -98,4 +101,4 @@ class Form extends Component
$this->server->save();
$this->emit('success', 'Server updated successfully.');
}
-}
\ No newline at end of file
+}
diff --git a/app/View/Components/Forms/Button.php b/app/View/Components/Forms/Button.php
new file mode 100644
index 000000000..8621db72a
--- /dev/null
+++ b/app/View/Components/Forms/Button.php
@@ -0,0 +1,30 @@
+id)) $this->id = new Cuid2(7);
+ if (is_null($this->name)) $this->name = $this->id;
+
+ $this->label = Str::title($this->label);
+ return view('components.forms.select');
+ }
+}
diff --git a/app/View/Components/Forms/Textarea.php b/app/View/Components/Forms/Textarea.php
new file mode 100644
index 000000000..f4d1f0bee
--- /dev/null
+++ b/app/View/Components/Forms/Textarea.php
@@ -0,0 +1,43 @@
+id)) $this->id = new Cuid2(7);
+ if (is_null($this->name)) $this->name = $this->id;
+
+ $this->label = Str::title($this->label);
+ return view('components.forms.textarea');
+ }
+}
diff --git a/app/View/Components/Modal.php b/app/View/Components/Modal.php
new file mode 100644
index 000000000..b317d3c44
--- /dev/null
+++ b/app/View/Components/Modal.php
@@ -0,0 +1,33 @@
+=16.9.0"
+ },
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/daisyui"
- },
- "peerDependencies": {
- "postcss": "^8"
}
},
"node_modules/delayed-stream": {
diff --git a/package.json b/package.json
index 2884c7466..ed81d6a26 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"dependencies": {
"@tailwindcss/typography": "0.5.9",
"alpinejs": "3.12.2",
- "daisyui": "3.0.3",
+ "daisyui": "3.2.1",
"tailwindcss-scrollbar": "0.1.0"
}
}
\ No newline at end of file
diff --git a/resources/css/app.css b/resources/css/app.css
index b788c6e6d..5bca7271f 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -2,19 +2,22 @@
@tailwind components;
@tailwind utilities;
-.scrollbar {
- @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-2;
-}
html {
@apply text-neutral-400;
}
body {
@apply text-sm antialiased scrollbar;
}
+button[isError] {
+ @apply bg-red-600 hover:bg-red-500;
+}
+.scrollbar {
+ @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-2;
+}
.main {
@apply max-w-screen-xl pt-4 pl-24 pr-10 mx-auto;
}
-input {
+/* input {
@apply w-full text-white rounded outline-none input input-sm h-7 placeholder:text-neutral-700 bg-coolgray-200 read-only:bg-coolgray-200/50 read-only:text-opacity-25;
}
input:not(input[type="checkbox"]) {
@@ -22,14 +25,14 @@ input:not(input[type="checkbox"]) {
}
input[type="checkbox"] {
@apply rounded toggle toggle-warning toggle-xs disabled:toggle-warning;
-}
+} */
-textarea {
+/* textarea {
@apply text-xs leading-5 text-white rounded textarea read-only:bg-coolgray-200/50 disabled:border-none read-only:text-opacity-25 placeholder:text-neutral-700 scrollbar bg-coolgray-200;
}
select {
@apply font-normal text-white border-none rounded h-7 select select-xs disabled:bg-coolgray-200 disabled:opacity-50 placeholder:text-neutral-700 bg-coolgray-200;
-}
+} */
.label-text,
label {
@apply text-neutral-400;
@@ -39,12 +42,12 @@ label {
@apply w-4 text-warning;
}
-button[isWarning] {
+/* button[isWarning] {
@apply bg-red-600 hover:bg-red-500;
}
button[isHighlighted] {
@apply text-white btn-primary;
-}
+} */
h1 {
@apply text-3xl font-bold text-white;
}
diff --git a/resources/views/components/applications/actions.blade.php b/resources/views/components/applications/actions.blade.php
index 141a9b151..fe5b235fc 100644
--- a/resources/views/components/applications/actions.blade.php
+++ b/resources/views/components/applications/actions.blade.php
@@ -8,7 +8,7 @@
class="relative text-xs text-white normal-case rounded -ml-44 min-w-max menu bg-coolgray-200">
@if ($application->status === 'running')
-
-
+
-
@@ -49,7 +49,7 @@
@else
-
@@ -60,7 +60,7 @@
-
diff --git a/resources/views/components/applications/links.blade.php b/resources/views/components/applications/links.blade.php
index 4a8e14672..b410cf0e1 100644
--- a/resources/views/components/applications/links.blade.php
+++ b/resources/views/components/applications/links.blade.php
@@ -6,7 +6,8 @@
@livewireScripts
@auth
-
-
-
-
-
-
- {{ $slot }}
-
-
-
+ function revive() {
+ if (checkHealthInterval) return true;
+ console.log('Checking server\'s health...')
+ checkHealthInterval = setInterval(() => {
+ fetch('/api/health')
+ .then(response => {
+ if (response.ok) {
+ Toaster.success('Coolify is back online. Reloading...')
+ if (checkHealthInterval) clearInterval(checkHealthInterval);
+ setTimeout(() => {
+ window.location.reload();
+ }, 5000)
+ } else {
+ console.log('Waiting for server to come back from dead...');
+ }
+ })
+ return;
+ }, 2000);
+ }
+
+ function upgrade() {
+ if (checkIfIamDeadInterval) return true;
+ console.log('Update initiated.')
+ checkIfIamDeadInterval = setInterval(() => {
+ fetch('/api/health')
+ .then(response => {
+ if (response.ok) {
+ console.log('It\'s alive. Waiting for server to be dead...');
+ } else {
+ Toaster.success('Update done, restarting Coolify!')
+ console.log('It\'s dead. Reviving... Standby... Bzz... Bzz...')
+ if (checkIfIamDeadInterval) clearInterval(checkIfIamDeadInterval);
+ revive();
+ }
+ })
+ return;
+ }, 2000);
+ }
+
+ function copyToClipboard(text) {
+ navigator.clipboard.writeText(text);
+ Livewire.emit('message', 'Copied to clipboard.');
+ }
+ Livewire.on('reloadWindow', () => {
+ window.location.reload();
+ })
+ Livewire.on('info', (message) => {
+ if (message) Toaster.info(message)
+ })
+ Livewire.on('error', (message) => {
+ if (message) Toaster.error(message)
+ })
+ Livewire.on('warning', (message) => {
+ if (message) Toaster.warning(message)
+ })
+ Livewire.on('success', (message) => {
+ if (message) Toaster.success(message)
+ })
+
@endauth
@guest
- {{ $slot }}
+ {{ $slot }}
@endguest