diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php index a85981c6b..78254cc4c 100644 --- a/app/Actions/Server/InstallDocker.php +++ b/app/Actions/Server/InstallDocker.php @@ -40,7 +40,7 @@ public function __invoke(Server $server, Team $team) "echo ####### Restarting Docker Engine...", "systemctl restart docker", "echo ####### Creating default network...", - "docker network create --attachable coolify", + "docker network create --attachable coolify >/dev/null 2>&1 || true", "echo ####### Done!" ], $server); $found = StandaloneDocker::where('server_id', $server->id); diff --git a/app/Console/Commands/TestEmail.php b/app/Console/Commands/TestEmail.php index e876b62a0..435cd59b2 100644 --- a/app/Console/Commands/TestEmail.php +++ b/app/Console/Commands/TestEmail.php @@ -23,6 +23,7 @@ use Str; use function Laravel\Prompts\select; +use function Laravel\Prompts\text; class TestEmail extends Command { @@ -44,9 +45,10 @@ class TestEmail extends Command * Execute the console command. */ private ?MailMessage $mail = null; + private string $email = 'andras.bacsai@protonmail.com'; public function handle() { - $email = select( + $type = select( 'Which Email should be sent?', options: [ 'emails-test' => 'Test', @@ -60,15 +62,15 @@ public function handle() 'waitlist-confirmation' => 'Waitlist Confirmation', ], ); - $type = set_transanctional_email_settings(); - if (!$type) { - throw new Exception('No email settings found.'); - } + $this->email = text('Email Address to send to'); + set_transanctional_email_settings(); + $this->mail = new MailMessage(); $this->mail->subject("Test Email"); - switch ($email) { + switch ($type) { case 'emails-test': $this->mail = (new Test())->toMail(); + $this->sendEmail(); break; case 'application-deployment-success': $application = Application::all()->first(); @@ -172,11 +174,7 @@ private function sendEmail() [], [], fn (Message $message) => $message - ->from( - 'internal@example.com', - 'Test Email', - ) - ->to('test@example.com') + ->to($this->email) ->subject($this->mail->subject) ->html((string)$this->mail->render()) ); diff --git a/app/Http/Livewire/Boarding/Index.php b/app/Http/Livewire/Boarding/Index.php index 35f7fd218..c68cd8a50 100644 --- a/app/Http/Livewire/Boarding/Index.php +++ b/app/Http/Livewire/Boarding/Index.php @@ -6,6 +6,7 @@ use App\Models\PrivateKey; use App\Models\Project; use App\Models\Server; +use App\Models\Team; use Illuminate\Support\Collection; use Livewire\Component; @@ -70,9 +71,10 @@ public function restartBoarding() } public function skipBoarding() { - currentTeam()->update([ + Team::find(currentTeam()->id)->update([ 'show_boarding' => false ]); + ray(currentTeam()); refreshSession(); return redirect()->route('dashboard'); } diff --git a/app/Http/Livewire/Settings/Email.php b/app/Http/Livewire/Settings/Email.php index c0e80f020..878b1133f 100644 --- a/app/Http/Livewire/Settings/Email.php +++ b/app/Http/Livewire/Settings/Email.php @@ -60,7 +60,6 @@ public function submitResend() { $this->validate([ 'settings.resend_api_key' => 'required' ]); - $this->settings->smtp_enabled = false; $this->settings->save(); $this->emit('success', 'Settings saved successfully.'); } catch (\Exception $e) { @@ -68,9 +67,18 @@ public function submitResend() { return general_error_handler($e, $this); } } + public function instantSaveResend() { + try { + $this->settings->smtp_enabled = false; + $this->submitResend(); + } catch (\Exception $e) { + return general_error_handler($e, $this); + } + } public function instantSave() { try { + $this->settings->resend_enabled = false; $this->submit(); } catch (\Exception $e) { return general_error_handler($e, $this); @@ -89,7 +97,6 @@ public function submit() 'settings.smtp_password' => 'nullable', 'settings.smtp_timeout' => 'nullable', ]); - $this->settings->resend_enabled = false; $this->settings->save(); $this->emit('success', 'Settings saved successfully.'); } catch (\Exception $e) { diff --git a/app/Http/Livewire/SwitchTeam.php b/app/Http/Livewire/SwitchTeam.php index 087a7ad84..9a9b4c795 100644 --- a/app/Http/Livewire/SwitchTeam.php +++ b/app/Http/Livewire/SwitchTeam.php @@ -23,7 +23,7 @@ public function switch_to($team_id) if (!$team_to_switch_to) { return; } - session(['currentTeam' => $team_to_switch_to]); + refreshSession($team_to_switch_to); return redirect(request()->header('Referer')); } } diff --git a/app/Http/Middleware/IsBoardingFlow.php b/app/Http/Middleware/IsBoardingFlow.php index 5858fe191..e0542a57a 100644 --- a/app/Http/Middleware/IsBoardingFlow.php +++ b/app/Http/Middleware/IsBoardingFlow.php @@ -15,7 +15,7 @@ class IsBoardingFlow */ public function handle(Request $request, Closure $next): Response { - // ray()->showQueries()->color('orange'); + ray()->showQueries()->color('orange'); if (showBoarding() && !in_array($request->path(), allowedPathsForBoardingAccounts())) { return redirect('boarding'); } diff --git a/app/Models/User.php b/app/Models/User.php index 9050de214..1671db496 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,6 +4,7 @@ use App\Notifications\Channels\SendsEmail; use App\Notifications\TransactionalEmails\ResetPassword as TransactionalEmailsResetPassword; +use Cache; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; @@ -94,7 +95,9 @@ public function isInstanceAdmin() public function currentTeam() { - return Team::find(session('currentTeam')->id); + return Cache::remember('team:' . auth()->user()->id, 3600, function() { + return Team::find(session('currentTeam')->id); + }); } public function otherTeams() diff --git a/app/Notifications/Application/DeploymentFailed.php b/app/Notifications/Application/DeploymentFailed.php index ddbdf1446..ea9e05652 100644 --- a/app/Notifications/Application/DeploymentFailed.php +++ b/app/Notifications/Application/DeploymentFailed.php @@ -16,6 +16,7 @@ class DeploymentFailed extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public Application $application; public string $deployment_uuid; public ?ApplicationPreview $preview = null; diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.php index f46c44c0e..0705e11ae 100644 --- a/app/Notifications/Application/DeploymentSuccess.php +++ b/app/Notifications/Application/DeploymentSuccess.php @@ -16,6 +16,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public Application $application; public string $deployment_uuid; public ApplicationPreview|null $preview = null; diff --git a/app/Notifications/Application/StatusChanged.php b/app/Notifications/Application/StatusChanged.php index 0d01d08ab..11bd9f524 100644 --- a/app/Notifications/Application/StatusChanged.php +++ b/app/Notifications/Application/StatusChanged.php @@ -14,6 +14,7 @@ class StatusChanged extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public $application; public string $application_name; diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.php index 613b0846c..960232f9c 100644 --- a/app/Notifications/Database/BackupFailed.php +++ b/app/Notifications/Database/BackupFailed.php @@ -14,6 +14,7 @@ class BackupFailed extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public string $name; public string $frequency; diff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.php index eb6d07c25..bac96ae35 100644 --- a/app/Notifications/Database/BackupSuccess.php +++ b/app/Notifications/Database/BackupSuccess.php @@ -14,6 +14,7 @@ class BackupSuccess extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public string $name; public string $frequency; diff --git a/app/Notifications/Internal/GeneralNotification.php b/app/Notifications/Internal/GeneralNotification.php index 78a76c059..024175622 100644 --- a/app/Notifications/Internal/GeneralNotification.php +++ b/app/Notifications/Internal/GeneralNotification.php @@ -12,6 +12,7 @@ class GeneralNotification extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public function __construct(public string $message) { } diff --git a/app/Notifications/Server/NotReachable.php b/app/Notifications/Server/NotReachable.php index 083808224..672636c57 100644 --- a/app/Notifications/Server/NotReachable.php +++ b/app/Notifications/Server/NotReachable.php @@ -15,6 +15,7 @@ class NotReachable extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public function __construct(public Server $server) { diff --git a/app/Notifications/Test.php b/app/Notifications/Test.php index 0b47d74b2..fbbd7a1fb 100644 --- a/app/Notifications/Test.php +++ b/app/Notifications/Test.php @@ -14,6 +14,7 @@ class Test extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public function __construct(public string|null $emails = null) { } diff --git a/app/Notifications/TransactionalEmails/InvitationLink.php b/app/Notifications/TransactionalEmails/InvitationLink.php index 96157c7e6..ab7cfb122 100644 --- a/app/Notifications/TransactionalEmails/InvitationLink.php +++ b/app/Notifications/TransactionalEmails/InvitationLink.php @@ -15,6 +15,7 @@ class InvitationLink extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public function via(): array { return [TransactionalEmailChannel::class]; diff --git a/app/Notifications/TransactionalEmails/Test.php b/app/Notifications/TransactionalEmails/Test.php index 3f3a009bb..21cf87470 100644 --- a/app/Notifications/TransactionalEmails/Test.php +++ b/app/Notifications/TransactionalEmails/Test.php @@ -12,6 +12,7 @@ class Test extends Notification implements ShouldQueue { use Queueable; + public $tries = 5; public function __construct(public string $emails) { } diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 161675301..7a8c5429b 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -57,9 +57,15 @@ function showBoarding(): bool { return currentTeam()->show_boarding ?? false; } -function refreshSession(): void +function refreshSession(?Team $team = null): void { - $team = Team::find(currentTeam()->id); + if (!$team) { + $team = Team::find(currentTeam()->id); + } + Cache::forget('team:' . auth()->user()->id); + Cache::remember('team:' . auth()->user()->id, 3600, function() use ($team) { + return $team; + }); session(['currentTeam' => $team]); } function general_error_handler(Throwable | null $err = null, $that = null, $isJson = false, $customErrorMessage = null): mixed diff --git a/config/sentry.php b/config/sentry.php index d8316f2a6..86a4adee0 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -3,11 +3,11 @@ return [ // @see https://docs.sentry.io/product/sentry-basics/dsn-explainer/ - 'dsn' => 'https://abe219b6573947128ecf523c835f5f38@o1082494.ingest.sentry.io/4505347448045568', + 'dsn' => 'https://62de992090e4e0cb28f18231835ea006@o1082494.ingest.sentry.io/4505347448045568', // 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.28', + 'release' => '4.0.0-beta.29', 'server_name' => env('APP_ID', 'coolify'), // 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 6ded6b968..c9f3c92a2 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ @if (data_get($team, 'discord_enabled')) -

Subscribe to events

+

Subscribe to events

+ + @if (isDev()) - +

Test

+
+ +
@endif -

General

- -

Applications

- -

Databases

- +

Container Status Changes

+
+ +
+

Application Deployments

+
+ +
+

Backup Status

+
+ +
@endif diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.php index 1deab9f68..d7acaac1a 100644 --- a/resources/views/livewire/notifications/email-settings.blade.php +++ b/resources/views/livewire/notifications/email-settings.blade.php @@ -21,7 +21,7 @@ Copy from Instance Settings @endif - @if (isEmailEnabled($team) || data_get($team, 'use_instance_email_settings')) + @if (isEmailEnabled($team) && auth()->user()->isAdminFromSession()) Send Test Email @@ -36,12 +36,11 @@ class="text-white normal-case btn btn-xs no-animation btn-primary"> label="Use hosted email service" /> @else -
- -
+
+ +
@endif -

Custom Email Service

@if (!$team->use_instance_email_settings)
@@ -110,19 +109,27 @@ class="text-white normal-case btn btn-xs no-animation btn-primary"> @endif @if (isEmailEnabled($team) || data_get($team, 'use_instance_email_settings')) -

Subscribe to events

+

Subscribe to events

@if (isDev()) - +

Test

+
+ +
@endif -

General

- -

Applications

- -

Databases

- +

Container Status Changes

+
+ +
+

Application Deployments

+
+ +
+

Backup Status

+
+ +
@endif diff --git a/resources/views/livewire/settings/email.blade.php b/resources/views/livewire/settings/email.blade.php index 45ea814c3..0f7fd65bf 100644 --- a/resources/views/livewire/settings/email.blade.php +++ b/resources/views/livewire/settings/email.blade.php @@ -22,12 +22,12 @@ Save - @if ($settings->resend_enabled || $settings->smtp_enabled) - - Send Test Email - - @endif + @if (isEmailEnabled($settings)) + + Send Test Email + + @endif
@@ -67,14 +67,15 @@ class="text-white normal-case btn btn-xs no-animation btn-primary">
Resend
- +
- +
diff --git a/versions.json b/versions.json index d0f176248..6823372c1 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.36" }, "v4": { - "version": "4.0.0-beta.28" + "version": "4.0.0-beta.29" } } }