From c8ba98b93d16cdb74f0e1006768b5aac4a07911a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 13:14:05 +0200 Subject: [PATCH 1/9] fix: try to use old docker-compose --- app/Actions/Proxy/CheckConfiguration.php | 5 ++++- app/Actions/Proxy/StartProxy.php | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Actions/Proxy/CheckConfiguration.php b/app/Actions/Proxy/CheckConfiguration.php index 1526c9728..e244296c5 100644 --- a/app/Actions/Proxy/CheckConfiguration.php +++ b/app/Actions/Proxy/CheckConfiguration.php @@ -16,9 +16,12 @@ class CheckConfiguration "cat $proxy_path/docker-compose.yml", ], $server, false); - if ($reset || is_null($proxy_configuration)) { + if ($reset || !$proxy_configuration || is_null($proxy_configuration)) { $proxy_configuration = Str::of(generate_default_proxy_configuration($server))->trim()->value; } + if (!$proxy_configuration || is_null($proxy_configuration)) { + throw new \Exception("Could not generate proxy configuration"); + } return $proxy_configuration; } } diff --git a/app/Actions/Proxy/StartProxy.php b/app/Actions/Proxy/StartProxy.php index 7af5aa019..944480ef2 100644 --- a/app/Actions/Proxy/StartProxy.php +++ b/app/Actions/Proxy/StartProxy.php @@ -51,9 +51,9 @@ class StartProxy "cd $proxy_path", "echo '####### Creating Docker Compose file...'", "echo '####### Pulling docker image...'", - 'docker compose pull', + 'docker compose pull || docker-compose pull', "echo '####### Stopping existing coolify-proxy...'", - "docker compose down -v --remove-orphans > /dev/null 2>&1 || true", + "docker compose down -v --remove-orphans > /dev/null 2>&1 || docker-compose down -v --remove-orphans > /dev/null 2>&1 || true", "command -v fuser >/dev/null || command -v lsof >/dev/null || echo '####### Could not kill existing processes listening on port 80 & 443. Please stop the process holding these ports...'", "command -v lsof >/dev/null && lsof -nt -i:80 | xargs -r kill -9 || true", "command -v lsof >/dev/null && lsof -nt -i:443 | xargs -r kill -9 || true", @@ -63,7 +63,7 @@ class StartProxy "systemctl disable apache2 > /dev/null 2>&1 || true", "systemctl disable apache > /dev/null 2>&1 || true", "echo '####### Starting coolify-proxy...'", - 'docker compose up -d --remove-orphans', + 'docker compose up -d --remove-orphans || docker-compose up -d --remove-orphans', "echo '####### Proxy installed successfully...'" ]; if (!$async) { From b9b95826016e53b91a21db2d211bcd3d92b71595 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 13:14:48 +0200 Subject: [PATCH 2/9] 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 45b51b89b..82a9d4d43 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // 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.42', + 'release' => '4.0.0-beta.43', // 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 270d2ee5f..9a953c5c7 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Mon, 18 Sep 2023 13:42:35 +0200 Subject: [PATCH 3/9] pricing change --- .../views/components/pricing-plans.blade.php | 447 ++++++++---------- .../subscription/pricing-plans.blade.php | 17 +- 2 files changed, 218 insertions(+), 246 deletions(-) diff --git a/resources/views/components/pricing-plans.blade.php b/resources/views/components/pricing-plans.blade.php index f05339cd4..36e54bf92 100644 --- a/resources/views/components/pricing-plans.blade.php +++ b/resources/views/components/pricing-plans.blade.php @@ -1,7 +1,7 @@ @props([ 'showSubscribeButtons' => true, ]) -
+
{{ config('constants.limits.trial_period') }} days trial included on all plans, without credit card details.
-
Save 1 month annually with the yearly plans. +
Save 10% annually with the yearly plans.
+
+

Unlimited Trial + Get Started +

+

Start self-hosting without limits with + our + OSS version. Same features as the paid version, but you have to manage by yourself.

+
-
-

Unlimited Trial

-

- - Free - - - Still Free - -

- - billed monthly - - - billed annually - - Get - Started -

Start self-hosting without limits with our - OSS - version.

-
    -
  • - - You manage everything -
  • -
  • - - Community Support -
  • -
  • - - - - - - - + All upcoming features -
  • -
-
+ class="grid max-w-sm grid-cols-1 -mt-16 divide-y divide-coolgray-500 isolate gap-y-16 sm:mx-auto lg:-mx-8 lg:mt-0 lg:max-w-none lg:grid-cols-3 lg:divide-x lg:divide-y-0 xl:-mx-4"> +

Basic

$5 - /month + /month + VAT $4 - /month + /month + VAT

@@ -139,8 +95,8 @@
  • - + @@ -154,12 +110,12 @@

    Pro

    - $29 - /month + $30 + /month + VAT - $26 - /month + $27 + /month + VAT

    @@ -192,7 +148,7 @@ d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /> - Basic Support + Included Email System
  • - Included Email System + Email Support
  • Ultimate

    - $69 - /month + $? + /month + VAT - $63 - /month + $? + /month + VAT

    @@ -250,17 +206,9 @@ d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /> - 25 servers -
  • -
  • - - Priority Support + ? servers
  • +
  • Included Email System
  • +
  • + + Priority (Email/Chat) Support +
  • @@ -285,176 +242,186 @@
  • -
    Need unlimited servers or official support for your Coolify instance? Contact us. -
    -
    -
    -
    Included in all plans
    -
    -
    -
    -
    - - - +
    +
    Need offical support for + your self-hosted instance? + + Contact Us +
    -
    Bring Your Own Servers
    -
    -
    - Bring your own server from any cloud providers, or even your own server at home! All you need is SSH - access. You will have full control over your server, and you can even use it for other purposes.
    -
    -
    -
    - - - - - - - - +
    Included in all plans
    +
    +
    +
    +
    + + + +
    +
    Bring Your Own Servers
    -
    Server Automations
    -
    -
    - Once you connected your server, Coolify will start managing it and do a - lot of adminstrative tasks for you. You can also write your own scripts to - automate your server*. -
    -
    -
    -
    -
    - - - - - - +
    + Bring your own server from any cloud providers, or even your own server at home! All you need is SSH + access. You will have full control over your server, and you can even use it for other purposes.
    -
    No Vendor Lock-in
    -
    - You own your own data. All configurations saved on your own servers, so if - you decide to stop using Coolify, you can still continue to manage your - deployed resources. +
    +
    +
    + + + + + + + + +
    +
    Server Automations
    +
    +
    + Once you connected your server, Coolify will start managing it and do a + lot of adminstrative tasks for you. You can also write your own scripts to + automate your server*. +
    +
    +
    +
    +
    + + + + + + +
    +
    No Vendor Lock-in
    +
    +
    + You own your own data. All configurations saved on your own servers, so if + you decide to stop using Coolify, you can still continue to manage your + deployed resources. +
    -
    -
    -
    -
    - - - - - - - - +
    +
    +
    + + + + + + + + +
    +
    Monitoring
    +
    +
    + Coolify will automatically monitor your configured servers and deployed + resources. Notifies you if something goes wrong on your favourite + channels, like Discord, Telegram, via Email and more...
    -
    Monitoring
    -
    - Coolify will automatically monitor your configured servers and deployed - resources. Notifies you if something goes wrong on your favourite - channels, like Discord, Telegram, via Email and more... +
    +
    +
    + + + + + + +
    +
    Automatic Backups
    +
    +
    + We automatically backup your databases to any S3 compatible solution. If + something goes wrong, you can easily restore your data with a few clicks. +
    +
    +
    +
    +
    + + + + + +
    +
    Powerful API
    +
    +
    + Programatically deploy, query, and manage your servers & resources. + Integrate to your CI/CD pipelines, or build your own custom integrations. * +
    +
    +
    +
    +
    + + + + + + + +
    +
    Push to Deploy
    +
    +
    + Git integration is default today. We support hosted (github.com, + gitlab.com*) or self-hosted* + (Github Enterprise, Gitlab) Git repositories. +
    +
    +
    +
    +
    + + + +
    +
    Pull Request Deployments
    +
    +
    + Automagically deploy new commits and pull requests separately to quickly + review contributions and speed up your teamwork! +
    -
    -
    -
    - - - - - - -
    -
    Automatic Backups
    -
    -
    - We automatically backup your databases to any S3 compatible solution. If - something goes wrong, you can easily restore your data with a few clicks. -
    -
    -
    -
    -
    - - - - - -
    -
    Powerful API
    -
    -
    - Programatically deploy, query, and manage your servers & resources. - Integrate to your CI/CD pipelines, or build your own custom integrations. * -
    -
    -
    -
    -
    - - - - - - - -
    -
    Push to Deploy
    -
    -
    - Git integration is default today. We support hosted (github.com, - gitlab.com*) or self-hosted* - (Github Enterprise, Gitlab) Git repositories. -
    -
    -
    -
    -
    - - - -
    -
    Pull Request Deployments
    -
    -
    - Automagically deploy new commits and pull requests separately to quickly - review contributions and speed up your teamwork! -
    +
    + * Some features are work in progress and will be available soon.
    -
    - * Some features are work in progress and will be available soon. -
    -
    -@isset($other) - {{ $other }} -@endisset + @isset($other) + {{ $other }} + @endisset diff --git a/resources/views/livewire/subscription/pricing-plans.blade.php b/resources/views/livewire/subscription/pricing-plans.blade.php index b21095116..86fca8658 100644 --- a/resources/views/livewire/subscription/pricing-plans.blade.php +++ b/resources/views/livewire/subscription/pricing-plans.blade.php @@ -2,29 +2,34 @@ @if (config('subscription.provider') === 'stripe') {{$isTrial ? 'Start Trial' : 'Subscribe' }} + class="w-full h-10 buyme" wire:click="subscribeStripe('basic-monthly')"> + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} {{$isTrial ? 'Start Trial' : 'Subscribe' }} + class="w-full h-10 buyme" wire:click="subscribeStripe('basic-yearly')"> + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} {{$isTrial ? 'Start Trial' : 'Subscribe' }} + class="w-full h-10 buyme" wire:click="subscribeStripe('pro-monthly')"> + {{ $isTrial ? 'Start Trial' : 'Subscribe' }} {{$isTrial ? 'Start Trial' : 'Subscribe' }} + wire:click="subscribeStripe('pro-yearly')"> {{ $isTrial ? 'Start Trial' : 'Subscribe' }} {{$isTrial ? 'Start Trial' : 'Subscribe' }} + class="w-full h-10 buyme"> + Contact Us {{$isTrial ? 'Start Trial' : 'Subscribe' }} + class="w-full h-10 buyme"> + Contact Us @endif From 9cba0a6df33387ea534ecf1c3c96ad3af518fd18 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 14:41:31 +0200 Subject: [PATCH 4/9] fix: boarding again --- app/Actions/Server/InstallDocker.php | 5 +--- app/Data/CoolifyTaskArgs.php | 5 +++- app/Http/Livewire/Boarding/Index.php | 23 ++++++++++--------- bootstrap/helpers/remoteProcess.php | 6 +++-- bootstrap/helpers/subscriptions.php | 1 + resources/views/layouts/boarding.blade.php | 20 ++++++++-------- .../views/livewire/boarding/index.blade.php | 17 +++++++++++--- 7 files changed, 46 insertions(+), 31 deletions(-) diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index 39d0718db..2fb12d34c 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -7,7 +7,7 @@ use App\Models\StandaloneDocker; class InstallDocker { - public function __invoke(Server $server, bool $instant = false) + public function __invoke(Server $server) { $dockerVersion = '24.0'; $config = base64_encode('{ @@ -55,9 +55,6 @@ class InstallDocker "echo '####### Done!'" ]; } - if ($instant) { - return instant_remote_process($command, $server); - } return remote_process($command, $server); } } diff --git a/app/Data/CoolifyTaskArgs.php b/app/Data/CoolifyTaskArgs.php index 07d7c0c81..f73fd6318 100644 --- a/app/Data/CoolifyTaskArgs.php +++ b/app/Data/CoolifyTaskArgs.php @@ -17,8 +17,11 @@ class CoolifyTaskArgs extends Data public string $type, public ?string $type_uuid = null, public ?Model $model = null, - public string $status = ProcessStatus::QUEUED->value, + public ?string $status = null , public bool $ignore_errors = false, ) { + if(is_null($status)){ + $this->status = ProcessStatus::QUEUED->value; + } } } diff --git a/app/Http/Livewire/Boarding/Index.php b/app/Http/Livewire/Boarding/Index.php index fc1784383..7c42df536 100644 --- a/app/Http/Livewire/Boarding/Index.php +++ b/app/Http/Livewire/Boarding/Index.php @@ -9,7 +9,6 @@ use App\Models\Server; use App\Models\Team; use Illuminate\Support\Collection; use Livewire\Component; -use Visus\Cuid2\Cuid2; class Index extends Component { @@ -40,8 +39,8 @@ class Index extends Component public bool $dockerInstallationStarted = false; - public string $localhostPublicKey; - public bool $localhostReachable = true; + public string $serverPublicKey; + public bool $serverReachable = true; public function mount() { @@ -98,7 +97,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== if (!$this->createdServer) { return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.'); } - $this->localhostPublicKey = $this->createdServer->privateKey->publicKey(); + $this->serverPublicKey = $this->createdServer->privateKey->publicKey(); return $this->validateServer('localhost'); } elseif ($this->selectedServerType === 'remote') { $this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get(); @@ -123,6 +122,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== return; } $this->selectedExistingPrivateKey = $this->createdServer->privateKey->id; + $this->serverPublicKey = $this->createdServer->privateKey->publicKey(); $this->validateServer(); } public function getProxyType() @@ -201,11 +201,11 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== instant_remote_process(['uptime'], $this->createdServer, true); - $this->createdServer->settings->update([ + $this->createdServer->settings()->update([ 'is_reachable' => true, ]); } catch (\Throwable $e) { - $this->localhostReachable = false; + $this->serverReachable = false; return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this); } @@ -216,8 +216,12 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->currentState = 'install-docker'; throw new \Exception('Docker version is not supported or not installed.'); } - $this->dockerInstalledOrSkipped(); + $this->createdServer->settings()->update([ + 'is_usable' => true, + ]); + $this->getProxyType(); } catch (\Throwable $e) { + $this->dockerInstallationStarted = false; return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this); } } @@ -229,10 +233,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== } public function dockerInstalledOrSkipped() { - $this->createdServer->settings->update([ - 'is_usable' => true, - ]); - $this->getProxyType(); + $this->validateServer(); } public function selectProxy(string|null $proxyType = null) { diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 5982b46d8..7bf194711 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -18,12 +18,14 @@ use Spatie\Activitylog\Contracts\Activity; function remote_process( array $command, Server $server, - string $type = ActivityTypes::INLINE->value, + ?string $type = null, ?string $type_uuid = null, ?Model $model = null, bool $ignore_errors = false, ): Activity { - + if (is_null($type)) { + $type = ActivityTypes::INLINE->value; + } $command_string = implode("\n", $command); if (auth()->user()) { $teams = auth()->user()->teams->pluck('id'); diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php index ac41b1a1d..9ea76ec9b 100644 --- a/bootstrap/helpers/subscriptions.php +++ b/bootstrap/helpers/subscriptions.php @@ -138,5 +138,6 @@ function allowedPathsForBoardingAccounts() ...allowedPathsForUnsubscribedAccounts(), 'boarding', 'livewire/message/boarding.index', + 'livewire/message/activity-monitor' ]; } diff --git a/resources/views/layouts/boarding.blade.php b/resources/views/layouts/boarding.blade.php index 39b1ae252..fe48fc29b 100644 --- a/resources/views/layouts/boarding.blade.php +++ b/resources/views/layouts/boarding.blade.php @@ -1,17 +1,17 @@ @extends('layouts.base') @section('body') + + + + + + + Close + + +
    - - - - - - - Close - - - {{ $slot }}
    diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index b86320612..37ed1cfd8 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -50,13 +50,13 @@ Remote Server - @if (!$localhostReachable) + @if (!$serverReachable) Localhost is not reachable with the following public key.

    Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for user 'root' or skip the boarding process and add a new private key manually to Coolify and to the server. - + Check again @@ -130,6 +130,17 @@ Use this Server
    + @if (!$serverReachable) + This server is not reachable with the following public key. +

    + Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for user + 'root' or skip the boarding process and add a new private key manually to Coolify and to the + server. + + Check again + + @endif

    Private Keys are used to connect to a remote server through a secure shell, called SSH.

    @@ -214,10 +225,10 @@ Could not find Docker Engine on your server. Do you want me to install it for you? + @if ($dockerInstallationStarted) Let's do it! - @if ($dockerInstallationStarted) Next @endif From 5f7a97c31f5840f93cbccd7dace909c86434ec85 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 15:04:50 +0200 Subject: [PATCH 5/9] debug job --- app/Jobs/ContainerStatusJob.php | 88 ------------------- app/Notifications/Channels/EmailChannel.php | 2 + .../Container/ContainerRestarted.php | 2 +- 3 files changed, 3 insertions(+), 89 deletions(-) diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index b7c76363c..22f0e2f10 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -198,94 +198,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted $url = base_url() . '/project/' . $project->uuid . "/" . $environment->name . "/database/" . $database->uuid; $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); } - - - - - - - - - - - - - return; - foreach ($applications as $application) { - $uuid = data_get($application, 'uuid'); - $id = data_get($application, 'id'); - $foundContainer = $containers->filter(function ($value, $key) use ($id, $uuid) { - $labels = data_get($value, 'Config.Labels'); - $labels = Arr::undot(format_docker_labels_to_json($labels)); - $labelId = data_get($labels, 'coolify.applicationId'); - if ($labelId == $id) { - return $value; - } - $isPR = Str::startsWith(data_get($value, 'Name'), "/$uuid"); - $isPR = Str::contains(data_get($value, 'Name'), "-pr-"); - if ($isPR) { - return false; - } - return $value; - })->first(); - if ($foundContainer) { - $containerStatus = data_get($foundContainer, 'State.Status'); - $databaseStatus = data_get($application, 'status'); - if ($containerStatus !== $databaseStatus) { - $application->update(['status' => $containerStatus]); - } - } else { - $databaseStatus = data_get($application, 'status'); - if ($databaseStatus !== 'exited') { - $application->update(['status' => 'exited']); - $name = data_get($application, 'name'); - $fqdn = data_get($application, 'fqdn'); - $containerName = $name ? "$name ($fqdn)" : $fqdn; - $project = data_get($application, 'environment.project'); - $environment = data_get($application, 'environment'); - $url = base_url() . '/project/' . $project->uuid . "/" . $environment->name . "/application/" . $application->uuid; - $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); - } - } - $previews = $application->previews; - foreach ($previews as $preview) { - $foundContainer = $containers->filter(function ($value, $key) use ($id, $uuid, $preview) { - $labels = data_get($value, 'Config.Labels'); - $labels = Arr::undot(format_docker_labels_to_json($labels)); - $labelId = data_get($labels, 'coolify.applicationId'); - if ($labelId == "$id-pr-{$preview->id}") { - return $value; - } - return Str::startsWith(data_get($value, 'Name'), "/$uuid-pr-{$preview->id}"); - })->first(); - } - } - foreach ($databases as $database) { - $uuid = data_get($database, 'uuid'); - $foundContainer = $containers->filter(function ($value, $key) use ($uuid) { - return Str::startsWith(data_get($value, 'Name'), "/$uuid"); - })->first(); - - if ($foundContainer) { - $containerStatus = data_get($foundContainer, 'State.Status'); - $databaseStatus = data_get($database, 'status'); - if ($containerStatus !== $databaseStatus) { - $database->update(['status' => $containerStatus]); - } - } else { - $databaseStatus = data_get($database, 'status'); - if ($databaseStatus !== 'exited') { - $database->update(['status' => 'exited']); - $name = data_get($database, 'name'); - $containerName = $name; - $project = data_get($database, 'environment.project'); - $environment = data_get($database, 'environment'); - $url = base_url() . '/project/' . $project->uuid . "/" . $environment->name . "/database/" . $database->uuid; - $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); - } - } - } - // TODO Monitor other containers not managed by Coolify } catch (\Throwable $e) { send_internal_notification('ContainerStatusJob failed with: ' . $e->getMessage()); ray($e->getMessage()); diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.php index e0f9edac0..8fcf87ef0 100644 --- a/app/Notifications/Channels/EmailChannel.php +++ b/app/Notifications/Channels/EmailChannel.php @@ -6,6 +6,7 @@ use Exception; use Illuminate\Mail\Message; use Illuminate\Notifications\Notification; use Illuminate\Support\Facades\Mail; +use Log; class EmailChannel { @@ -19,6 +20,7 @@ class EmailChannel } $mailMessage = $notification->toMail($notifiable); + Log::info("Sending email to: " . implode(', ', $recepients) . " with subject: {$mailMessage->subject}"); Mail::send( [], [], diff --git a/app/Notifications/Container/ContainerRestarted.php b/app/Notifications/Container/ContainerRestarted.php index 480fe2cb0..25fd08ff8 100644 --- a/app/Notifications/Container/ContainerRestarted.php +++ b/app/Notifications/Container/ContainerRestarted.php @@ -12,7 +12,7 @@ class ContainerRestarted extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public function __construct(public string $name, public Server $server, public ?string $url = null) From 3eb1a1f48ca0668a269f84a97e325f68a14e9034 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 15:06:37 +0200 Subject: [PATCH 6/9] debug with ray --- app/Notifications/Channels/EmailChannel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.php index 8fcf87ef0..1d04c07d3 100644 --- a/app/Notifications/Channels/EmailChannel.php +++ b/app/Notifications/Channels/EmailChannel.php @@ -20,7 +20,7 @@ class EmailChannel } $mailMessage = $notification->toMail($notifiable); - Log::info("Sending email to: " . implode(', ', $recepients) . " with subject: {$mailMessage->subject}"); + ray("Sending email to: " . implode(', ', $recepients) . " with subject: {$mailMessage->subject}"); Mail::send( [], [], From 1452cdf5ad830ee90eba7c92428e59e3489879b3 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 15:19:27 +0200 Subject: [PATCH 7/9] fix: send internal notifications of email errors --- app/Http/Livewire/Boarding/Index.php | 8 ----- app/Jobs/ContainerStatusJob.php | 1 - .../Application/DeploymentFailed.php | 2 +- .../Application/DeploymentSuccess.php | 2 +- .../Application/StatusChanged.php | 2 +- app/Notifications/Channels/EmailChannel.php | 36 +++++++++++-------- app/Notifications/Database/BackupFailed.php | 4 +-- app/Notifications/Database/BackupSuccess.php | 4 +-- 8 files changed, 26 insertions(+), 33 deletions(-) diff --git a/app/Http/Livewire/Boarding/Index.php b/app/Http/Livewire/Boarding/Index.php index 7c42df536..c1ec202cf 100644 --- a/app/Http/Livewire/Boarding/Index.php +++ b/app/Http/Livewire/Boarding/Index.php @@ -69,14 +69,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== public function restartBoarding() { - // if ($this->selectedServerType !== 'localhost') { - // if ($this->createdServer) { - // $this->createdServer->delete(); - // } - // if ($this->createdPrivateKey) { - // $this->createdPrivateKey->delete(); - // } - // } return redirect()->route('boarding'); } public function skipBoarding() diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 22f0e2f10..527dcad67 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -86,7 +86,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted $this->server->team->notify(new ContainerRestarted('coolify-proxy', $this->server)); } } else { - ray($foundProxyContainer); $this->server->proxy->status = data_get($foundProxyContainer, 'State.Status'); $this->server->save(); } diff --git a/app/Notifications/Application/DeploymentFailed.php b/app/Notifications/Application/DeploymentFailed.php index efac09097..f97fbc77e 100644 --- a/app/Notifications/Application/DeploymentFailed.php +++ b/app/Notifications/Application/DeploymentFailed.php @@ -14,7 +14,7 @@ class DeploymentFailed extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public Application $application; public ?ApplicationPreview $preview = null; diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.php index 3b2d6e17f..053ae7a2b 100644 --- a/app/Notifications/Application/DeploymentSuccess.php +++ b/app/Notifications/Application/DeploymentSuccess.php @@ -14,7 +14,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public Application $application; public ApplicationPreview|null $preview = null; diff --git a/app/Notifications/Application/StatusChanged.php b/app/Notifications/Application/StatusChanged.php index 90ac92304..064c347d0 100644 --- a/app/Notifications/Application/StatusChanged.php +++ b/app/Notifications/Application/StatusChanged.php @@ -13,7 +13,7 @@ class StatusChanged extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public Application $application; public string $application_name; diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.php index 1d04c07d3..c84ea63e4 100644 --- a/app/Notifications/Channels/EmailChannel.php +++ b/app/Notifications/Channels/EmailChannel.php @@ -12,23 +12,29 @@ class EmailChannel { public function send(SendsEmail $notifiable, Notification $notification): void { - $this->bootConfigs($notifiable); - $recepients = $notifiable->getRecepients($notification); + try { + $this->bootConfigs($notifiable); + $recepients = $notifiable->getRecepients($notification); + ray($recepients); + if (count($recepients) === 0) { + throw new Exception('No email recipients found'); + } - if (count($recepients) === 0) { - throw new Exception('No email recipients found'); + $mailMessage = $notification->toMail($notifiable); + throw new Exception('EmailChannel is disabled'); + Mail::send( + [], + [], + fn (Message $message) => $message + ->to($recepients) + ->subject($mailMessage->subject) + ->html((string)$mailMessage->render()) + ); + } catch (Exception $e) { + ray($e->getMessage()); + send_internal_notification("EmailChannel error: {$e->getMessage()}. Failed to send email to: " . implode(', ', $recepients) . " with subject: {$mailMessage->subject}"); + throw $e; } - - $mailMessage = $notification->toMail($notifiable); - ray("Sending email to: " . implode(', ', $recepients) . " with subject: {$mailMessage->subject}"); - Mail::send( - [], - [], - fn (Message $message) => $message - ->to($recepients) - ->subject($mailMessage->subject) - ->html((string)$mailMessage->render()) - ); } private function bootConfigs($notifiable): void diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.php index 960232f9c..482b27977 100644 --- a/app/Notifications/Database/BackupFailed.php +++ b/app/Notifications/Database/BackupFailed.php @@ -3,8 +3,6 @@ namespace App\Notifications\Database; use App\Models\ScheduledDatabaseBackup; -use App\Notifications\Channels\DiscordChannel; -use App\Notifications\Channels\EmailChannel; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -14,7 +12,7 @@ class BackupFailed extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public string $name; public string $frequency; diff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.php index bac96ae35..0378baf96 100644 --- a/app/Notifications/Database/BackupSuccess.php +++ b/app/Notifications/Database/BackupSuccess.php @@ -3,8 +3,6 @@ namespace App\Notifications\Database; use App\Models\ScheduledDatabaseBackup; -use App\Notifications\Channels\DiscordChannel; -use App\Notifications\Channels\EmailChannel; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Notifications\Messages\MailMessage; @@ -14,7 +12,7 @@ class BackupSuccess extends Notification implements ShouldQueue { use Queueable; - public $tries = 5; + public $tries = 1; public string $name; public string $frequency; From ab5929cc694f8c7ab1c0299b1ca79146ccf15a28 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 18 Sep 2023 15:20:48 +0200 Subject: [PATCH 8/9] typo --- resources/views/components/pricing-plans.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/components/pricing-plans.blade.php b/resources/views/components/pricing-plans.blade.php index 36e54bf92..9b1070e2d 100644 --- a/resources/views/components/pricing-plans.blade.php +++ b/resources/views/components/pricing-plans.blade.php @@ -243,7 +243,7 @@