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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
wip
Andras Bacsai9f0ca1cc2e70
diff --git a/app/Data/SmtpConfiguration.php b/app/Data/SmtpConfiguration.phpdeleted file mode 100644index ce290f88cc..0000000000--- a/app/Data/SmtpConfiguration.php+++ /dev/null@@ -1,23 +0,0 @@-<?php--namespace App\Data;--use Spatie\LaravelData\Data;--class SmtpConfiguration extends Data-{- public function __construct(- public bool $smtp_enabled = false,- public string $smtp_host,- public int $smtp_port,- public ?string $smtp_encryption,- public ?string $smtp_username,- public ?string $smtp_password,- public ?int $smtp_timeout,- public string $smtp_from_address,- public string $smtp_from_name,- public ?string $smtp_recipients,- public ?string $smtp_test_recipients,- ) {- }-}diff --git a/app/Http/Livewire/Notifications/DiscordSettings.php b/app/Http/Livewire/Notifications/DiscordSettings.phpindex 1ddc236785..c3c114d3ba 100644--- a/app/Http/Livewire/Notifications/DiscordSettings.php+++ b/app/Http/Livewire/Notifications/DiscordSettings.php@@ -10,20 +10,21 @@ class DiscordSettings extends Component{public Team $model;protected $rules = [- 'model.extra_attributes.discord_enabled' => 'nullable|boolean',- 'model.extra_attributes.discord_webhook_url' => 'required|url',- 'model.extra_attributes.notifications_discord_test' => 'nullable|boolean',- 'model.extra_attributes.notifications_discord_deployments' => 'nullable|boolean',+ 'model.discord.enabled' => 'nullable|boolean',+ 'model.discord.webhook_url' => 'required|url',+ 'model.discord_notifications.test' => 'nullable|boolean',+ 'model.discord_notifications.deployments' => 'nullable|boolean',+];protected $validationAttributes = [- 'model.extra_attributes.discord_webhook_url' => 'Discord Webhook',+ 'model.discord.webhook_url' => 'Discord Webhook',];public function instantSave(){try {$this->submit();} catch (\Exception $e) {- $this->model->extra_attributes->discord_enabled = false;+ $this->model->discord->enabled = false;$this->validate();}}diff --git a/app/Http/Livewire/Notifications/EmailSettings.php b/app/Http/Livewire/Notifications/EmailSettings.phpindex d928cd5174..88004bea58 100644--- a/app/Http/Livewire/Notifications/EmailSettings.php+++ b/app/Http/Livewire/Notifications/EmailSettings.php@@ -12,53 +12,55 @@ class EmailSettings extends Componentpublic Team $model;protected $rules = [- 'model.extra_attributes.smtp_enabled' => 'nullable|boolean',- 'model.extra_attributes.smtp_from_address' => 'required|email',- 'model.extra_attributes.smtp_from_name' => 'required',- 'model.extra_attributes.smtp_recipients' => 'nullable',- 'model.extra_attributes.smtp_host' => 'required',- 'model.extra_attributes.smtp_port' => 'required',- 'model.extra_attributes.smtp_encryption' => 'nullable',- 'model.extra_attributes.smtp_username' => 'nullable',- 'model.extra_attributes.smtp_password' => 'nullable',- 'model.extra_attributes.smtp_timeout' => 'nullable',- 'model.extra_attributes.smtp_test_recipients' => 'nullable',- 'model.extra_attributes.notifications_smtp_test' => 'nullable|boolean',- 'model.extra_attributes.notifications_email_deployments' => 'nullable|boolean',+ 'model.smtp.enabled' => 'nullable|boolean',+ 'model.smtp.from_address' => 'required|email',+ 'model.smtp.from_name' => 'required',+ 'model.smtp.recipients' => 'nullable',+ 'model.smtp.host' => 'required',+ 'model.smtp.port' => 'required',+ 'model.smtp.encryption' => 'nullable',+ 'model.smtp.username' => 'nullable',+ 'model.smtp.password' => 'nullable',+ 'model.smtp.timeout' => 'nullable',+ 'model.smtp.test_recipients' => 'nullable',+ 'model.smtp_notifications.test' => 'nullable|boolean',+ 'model.smtp_notifications.deployments' => 'nullable|boolean',+ 'model.discord_notifications.test' => 'nullable|boolean',+ 'model.discord_notifications.deployments' => 'nullable|boolean',];protected $validationAttributes = [- 'model.extra_attributes.smtp_from_address' => 'From Address',- 'model.extra_attributes.smtp_from_name' => 'From Name',- 'model.extra_attributes.smtp_recipients' => 'Recipients',- 'model.extra_attributes.smtp_host' => 'Host',- 'model.extra_attributes.smtp_port' => 'Port',- 'model.extra_attributes.smtp_encryption' => 'Encryption',- 'model.extra_attributes.smtp_username' => 'Username',- 'model.extra_attributes.smtp_password' => 'Password',- 'model.extra_attributes.smtp_test_recipients' => 'Test Recipients',+ 'model.smtp.from_address' => 'From Address',+ 'model.smtp.from_name' => 'From Name',+ 'model.smtp.recipients' => 'Recipients',+ 'model.smtp.host' => 'Host',+ 'model.smtp.port' => 'Port',+ 'model.smtp.encryption' => 'Encryption',+ 'model.smtp.username' => 'Username',+ 'model.smtp.password' => 'Password',+ 'model.smtp.test_recipients' => 'Test Recipients',];- public function copySMTP()+ public function copyFromInstanceSettings(){$settings = InstanceSettings::get();- $this->model->extra_attributes->smtp_enabled = true;- $this->model->extra_attributes->smtp_from_address = $settings->extra_attributes->smtp_from_address;- $this->model->extra_attributes->smtp_from_name = $settings->extra_attributes->smtp_from_name;- $this->model->extra_attributes->smtp_recipients = $settings->extra_attributes->smtp_recipients;- $this->model->extra_attributes->smtp_host = $settings->extra_attributes->smtp_host;- $this->model->extra_attributes->smtp_port = $settings->extra_attributes->smtp_port;- $this->model->extra_attributes->smtp_encryption = $settings->extra_attributes->smtp_encryption;- $this->model->extra_attributes->smtp_username = $settings->extra_attributes->smtp_username;- $this->model->extra_attributes->smtp_password = $settings->extra_attributes->smtp_password;- $this->model->extra_attributes->smtp_timeout = $settings->extra_attributes->smtp_timeout;- $this->model->extra_attributes->smtp_test_recipients = $settings->extra_attributes->smtp_test_recipients;+ $this->model->smtp->enabled = true;+ $this->model->smtp->from_address = $settings->smtp->from_address;+ $this->model->smtp->from_name = $settings->smtp->from_name;+ $this->model->smtp->recipients = $settings->smtp->recipients;+ $this->model->smtp->host = $settings->smtp->host;+ $this->model->smtp->port = $settings->smtp->port;+ $this->model->smtp->encryption = $settings->smtp->encryption;+ $this->model->smtp->username = $settings->smtp->username;+ $this->model->smtp->password = $settings->smtp->password;+ $this->model->smtp->timeout = $settings->smtp->timeout;+ $this->model->smtp->test_recipients = $settings->smtp->test_recipients;$this->saveModel();}public function submit(){$this->resetErrorBag();$this->validate();- $this->model->extra_attributes->smtp_recipients = str_replace(' ', '', $this->model->extra_attributes->smtp_recipients);- $this->model->extra_attributes->smtp_test_recipients = str_replace(' ', '', $this->model->extra_attributes->smtp_test_recipients);+ $this->model->smtp->recipients = str_replace(' ', '', $this->model->smtp->recipients);+ $this->model->smtp->test_recipients = str_replace(' ', '', $this->model->smtp->test_recipients);$this->saveModel();}public function saveModel()@@ -79,7 +81,7 @@ class EmailSettings extends Componenttry {$this->submit();} catch (\Exception $e) {- $this->model->extra_attributes->smtp_enabled = false;+ $this->model->smtp->enabled = false;$this->validate();}}diff --git a/app/Http/Livewire/Settings/Email.php b/app/Http/Livewire/Settings/Email.phpindex 75f10e6e9f..e15c9e5d60 100644--- a/app/Http/Livewire/Settings/Email.php+++ b/app/Http/Livewire/Settings/Email.php@@ -12,34 +12,34 @@ class Email extends Componentpublic InstanceSettings $settings;protected $rules = [- 'settings.extra_attributes.smtp_enabled' => 'nullable|boolean',- 'settings.extra_attributes.smtp_host' => 'required',- 'settings.extra_attributes.smtp_port' => 'required|numeric',- 'settings.extra_attributes.smtp_encryption' => 'nullable',- 'settings.extra_attributes.smtp_username' => 'nullable',- 'settings.extra_attributes.smtp_password' => 'nullable',- 'settings.extra_attributes.smtp_timeout' => 'nullable',- 'settings.extra_attributes.smtp_test_recipients' => 'nullable',- 'settings.extra_attributes.smtp_from_address' => 'required|email',- 'settings.extra_attributes.smtp_from_name' => 'required',+ 'settings.smtp.enabled' => 'nullable|boolean',+ 'settings.smtp.host' => 'required',+ 'settings.smtp.port' => 'required|numeric',+ 'settings.smtp.encryption' => 'nullable',+ 'settings.smtp.username' => 'nullable',+ 'settings.smtp.password' => 'nullable',+ 'settings.smtp.timeout' => 'nullable',+ 'settings.smtp.test_recipients' => 'nullable',+ 'settings.smtp.from_address' => 'required|email',+ 'settings.smtp.from_name' => 'required',];protected $validationAttributes = [- 'settings.extra_attributes.smtp_from_address' => 'From Address',- 'settings.extra_attributes.smtp_from_name' => 'From Name',- 'settings.extra_attributes.smtp_recipients' => 'Recipients',- 'settings.extra_attributes.smtp_host' => 'Host',- 'settings.extra_attributes.smtp_port' => 'Port',- 'settings.extra_attributes.smtp_encryption' => 'Encryption',- 'settings.extra_attributes.smtp_username' => 'Username',- 'settings.extra_attributes.smtp_password' => 'Password',- 'settings.extra_attributes.smtp_test_recipients' => 'Test Recipients',+ 'settings.smtp.from_address' => 'From Address',+ 'settings.smtp.from_name' => 'From Name',+ 'settings.smtp.recipients' => 'Recipients',+ 'settings.smtp.host' => 'Host',+ 'settings.smtp.port' => 'Port',+ 'settings.smtp.encryption' => 'Encryption',+ 'settings.smtp.username' => 'Username',+ 'settings.smtp.password' => 'Password',+ 'settings.smtp.test_recipients' => 'Test Recipients',];public function instantSave(){try {$this->submit();} catch (\Exception $e) {- $this->settings->extra_attributes->smtp_enabled = false;+ $this->settings->smtp->enabled = false;$this->validate();}}@@ -51,7 +51,7 @@ class Email extends Componentpublic function submit(){$this->validate();- $this->settings->extra_attributes->smtp_test_recipients = str_replace(' ', '', $this->settings->extra_attributes->smtp_test_recipients);+ $this->settings->smtp->test_recipients = str_replace(' ', '', $this->settings->smtp->test_recipients);$this->settings->save();}}diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.phpindex cc66facd48..fefd315ce5 100644--- a/app/Models/InstanceSettings.php+++ b/app/Models/InstanceSettings.php@@ -7,20 +7,24 @@ use Illuminate\Contracts\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Model;use Illuminate\Notifications\Notifiable;use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;+use Spatie\SchemalessAttributes\SchemalessAttributesTrait;class InstanceSettings extends Model implements SendsEmail{- use Notifiable;+ use Notifiable, SchemalessAttributesTrait;+ protected $schemalessAttributes = [+ 'smtp',+ ];protected $casts = [- 'extra_attributes' => SchemalessAttributes::class,+ 'smtp' => SchemalessAttributes::class,];- public function scopeWithExtraAttributes(): Builder+ public function scopeWithSmtp(): Builder{- return $this->extra_attributes->modelScope();+ return $this->smtp->modelScope();}- public function routeNotificationForEmail(string $attribute = 'smtp_test_recipients')+ public function routeNotificationForEmail(string $attribute = 'test_recipients'){- $recipients = $this->extra_attributes->get($attribute, '');+ $recipients = $this->smtp->get($attribute, '');if (is_null($recipients) || $recipients === '') {return [];}diff --git a/app/Models/Team.php b/app/Models/Team.phpindex 42342aebdb..cf9a1f5cbb 100644--- a/app/Models/Team.php+++ b/app/Models/Team.php@@ -8,40 +8,64 @@ use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Model;use Illuminate\Notifications\Notifiable;use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;+use Spatie\SchemalessAttributes\SchemalessAttributesTrait;class Team extends Model implements SendsDiscord, SendsEmail{- use Notifiable;+ use Notifiable, SchemalessAttributesTrait;+ protected $schemalessAttributes = [+ 'smtp',+ 'discord',+ 'smtp_notifications',+ 'discord_notifications',+ ];protected $casts = [- 'extra_attributes' => SchemalessAttributes::class,+ 'smtp' => SchemalessAttributes::class,+ 'discord' => SchemalessAttributes::class,+ 'smtp_notifications' => SchemalessAttributes::class,+ 'discord_notifications' => SchemalessAttributes::class,'personal_team' => 'boolean',];+ public function scopeWithSmtp(): Builder+ {+ return $this->smtp->modelScope();+ }+ public function scopeWithDiscord(): Builder+ {+ return $this->discord->modelScope();+ }+ public function scopeWithSmtpNotifications(): Builder+ {+ return $this->smtp_notifications->modelScope();+ }+ public function scopeWithDiscordNotifications(): Builder+ {+ return $this->discord_notifications->modelScope();+ }protected $fillable = ['id','name','description','personal_team',- 'extra_attributes',+ 'smtp',+ 'discord'];public function routeNotificationForDiscord(){- return $this->extra_attributes->get('discord_webhook_url');+ return $this->discord->get('webhook_url');}- public function routeNotificationForEmail(string $attribute = 'smtp_recipients')+ public function routeNotificationForEmail(string $attribute = 'recipients'){- $recipients = $this->extra_attributes->get($attribute, '');+ $recipients = $this->smtp->get($attribute, '');if (is_null($recipients) || $recipients === '') {return [];}return explode(',', $recipients);}- public function scopeWithExtraAttributes(): Builder- {- return $this->extra_attributes->modelScope();- }+public function projects(){diff --git a/app/Models/User.php b/app/Models/User.phpindex 2e5148d48e..da42a977fd 100644--- a/app/Models/User.php+++ b/app/Models/User.php@@ -34,10 +34,20 @@ class User extends Authenticatable implements SendsEmail$team = ['name' => $user->name . "'s Team",'personal_team' => true,- 'extra_attributes' => [- 'notifications_smtp_test' => true,- 'notifications_discord_test' => true,- ]+ 'smtp' => [+ 'enabled' => false,+ ],+ 'smtp_notifications' => [+ 'test' => true,+ 'deployments' => false,+ ],+ 'discord' => [+ 'enabled' => false,+ ],+ 'discord_notifications' => [+ 'test' => true,+ 'deployments' => false,+ ],];if ($user->id === 0) {$team['id'] = 0;diff --git a/app/Notifications/Channels/EmailChannel.php b/app/Notifications/Channels/EmailChannel.phpindex 8db504f404..bc5c7e46e9 100644--- a/app/Notifications/Channels/EmailChannel.php+++ b/app/Notifications/Channels/EmailChannel.php@@ -12,7 +12,7 @@ class EmailChannel{$this->bootConfigs($notifiable);- $bcc = $notifiable->routeNotificationForEmail('smtp_test_recipients');+ $bcc = $notifiable->routeNotificationForEmail('test_recipients');if (count($bcc) === 0) {if ($notifiable instanceof \App\Models\Team) {$bcc = $notifiable->members()->pluck('email')->toArray();@@ -24,8 +24,8 @@ class EmailChannel[],fn (Message $message) => $message->from(- $notifiable->extra_attributes?->get('smtp_from_address'),- $notifiable->extra_attributes?->get('smtp_from_name')+ data_get($notifiable, 'smtp.from_address'),+ data_get($notifiable, 'smtp.from_name'),)->bcc($bcc)->subject($mailMessage->subject)@@ -38,12 +38,12 @@ class EmailChannelconfig()->set('mail.default', 'smtp');config()->set('mail.mailers.smtp', ["transport" => "smtp",- "host" => $notifiable->extra_attributes?->get('smtp_host'),- "port" => $notifiable->extra_attributes?->get('smtp_port'),- "encryption" => $notifiable->extra_attributes?->get('smtp_encryption'),- "username" => $notifiable->extra_attributes?->get('smtp_username'),- "password" => $notifiable->extra_attributes?->get('smtp_password'),- "timeout" => $notifiable->extra_attributes?->get('smtp_timeout'),+ "host" => data_get($notifiable, 'smtp.host'),+ "port" => data_get($notifiable, 'smtp.port'),+ "encryption" => data_get($notifiable, 'smtp.encryption'),+ "username" => data_get($notifiable, 'smtp.username'),+ "password" => data_get($notifiable, 'smtp.password'),+ "timeout" => data_get($notifiable, 'smtp.timeout'),"local_domain" => null,]);}diff --git a/app/Notifications/Channels/TransactionalEmailChannel.php b/app/Notifications/Channels/TransactionalEmailChannel.phpindex d4098f0da5..431469e100 100644--- a/app/Notifications/Channels/TransactionalEmailChannel.php+++ b/app/Notifications/Channels/TransactionalEmailChannel.php@@ -13,23 +13,22 @@ class TransactionalEmailChannelpublic function send(User $notifiable, Notification $notification): void{$settings = InstanceSettings::get();- if ($settings->extra_attributes?->get('smtp_enabled') !== true) {+ if (data_get($settings, 'smtp.enabled') !== true) {return;}$email = $notifiable->email;if (!$email) {return;}- $this->bootConfigs($settings);+ $this->bootConfigs();$mailMessage = $notification->toMail($notifiable);-Mail::send([],[],fn (Message $message) => $message->from(- $settings->extra_attributes?->get('smtp_from_address'),- $settings->extra_attributes?->get('smtp_from_name')+ data_get($settings, 'smtp.from_address'),+ data_get($settings, 'smtp.from_name'))->to($email)->subject($mailMessage->subject)@@ -37,7 +36,7 @@ class TransactionalEmailChannel);}- private function bootConfigs(InstanceSettings $settings): void+ private function bootConfigs(): void{set_transanctional_email_settings();}diff --git a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.phpindex a13ad7901c..22f0badc74 100644--- a/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php+++ b/app/Notifications/Notifications/Application/DeployedSuccessfullyNotification.php@@ -43,10 +43,15 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQuepublic function via(object $notifiable): array{$channels = [];- if ($notifiable->extra_attributes?->get('smtp_enabled') && $notifiable->extra_attributes?->get('notifications_email_deployments')) {+ $isEmailEnabled = data_get($notifiable, 'smtp.enabled');+ $isDiscordEnabled = data_get($notifiable, 'discord.enabled');+ $isSubscribedToEmailDeployments = data_get($notifiable, 'smtp_notifications.deployments');+ $isSubscribedToDiscordDeployments = data_get($notifiable, 'discord_notifications.deployments');++ if ($isEmailEnabled && $isSubscribedToEmailDeployments) {$channels[] = EmailChannel::class;}- if ($notifiable->extra_attributes?->get('discord_enabled') && $notifiable->extra_attributes?->get('notifications_discord_deployments')) {+ if ($isDiscordEnabled && $isSubscribedToDiscordDeployments) {$channels[] = DiscordChannel::class;}return $channels;diff --git a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.phpindex ecbc97359e..2e309024d2 100644--- a/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php+++ b/app/Notifications/Notifications/Application/DeployedWithErrorNotification.php@@ -44,10 +44,15 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueuepublic function via(object $notifiable): array{$channels = [];- if ($notifiable->extra_attributes?->get('smtp_enabled') && $notifiable->extra_attributes?->get('notifications_email_deployments')) {+ $isEmailEnabled = data_get($notifiable, 'smtp.enabled');+ $isDiscordEnabled = data_get($notifiable, 'discord.enabled');+ $isSubscribedToEmailDeployments = data_get($notifiable, 'smtp_notifications.deployments');+ $isSubscribedToDiscordDeployments = data_get($notifiable, 'discord_notifications.deployments');++ if ($isEmailEnabled && $isSubscribedToEmailDeployments) {$channels[] = EmailChannel::class;}- if ($notifiable->extra_attributes?->get('discord_enabled') && $notifiable->extra_attributes?->get('notifications_discord_deployments')) {+ if ($isDiscordEnabled && $isSubscribedToDiscordDeployments) {$channels[] = DiscordChannel::class;}return $channels;diff --git a/app/Notifications/Notifications/TestNotification.php b/app/Notifications/Notifications/TestNotification.phpindex 6f03c27e19..8e10e3d94d 100644--- a/app/Notifications/Notifications/TestNotification.php+++ b/app/Notifications/Notifications/TestNotification.php@@ -20,12 +20,21 @@ class TestNotification extends Notification implements ShouldQueuepublic function via(object $notifiable): array{$channels = [];- if (($this->type === 'smtp' || is_null($this->type)) && $notifiable->extra_attributes?->get('smtp_enabled') && $notifiable->extra_attributes?->get('notifications_smtp_test')) {++ $isSmtp = $this->type === 'smtp' || is_null($this->type);+ $isDiscord = $this->type === 'discord' || is_null($this->type);+ $isEmailEnabled = data_get($notifiable, 'smtp.enabled');+ $isDiscordEnabled = data_get($notifiable, 'discord.enabled');+ $isSubscribedToEmailTests = data_get($notifiable, 'smtp_notifications.test');+ $isSubscribedToDiscordTests = data_get($notifiable, 'discord_notifications.test');++ if ($isEmailEnabled && $isSubscribedToEmailTests && $isSmtp) {$channels[] = EmailChannel::class;}- if (($this->type === 'discord' || is_null($this->type)) && $notifiable->extra_attributes?->get('discord_enabled') && $notifiable->extra_attributes?->get('notifications_discord_test')) {+ if ($isDiscordEnabled && $isSubscribedToDiscordTests && $isDiscord) {$channels[] = DiscordChannel::class;}+return $channels;}public function toMail(): MailMessage@@ -39,7 +48,7 @@ class TestNotification extends Notification implements ShouldQueuepublic function toDiscord(): string{return 'This is a test Discord notification from Coolify.-+[Go to your dashboard](' . base_url() . ')';}}diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex cb2338106d..5d1821855a 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -69,7 +69,7 @@ function generate_application_name(string $git_repository, string $git_branch)function is_transactional_emails_active(){- return data_get(InstanceSettings::get(), 'extra_attributes.smtp_enabled');+ return data_get(InstanceSettings::get(), 'smtp.enabled');}function set_transanctional_email_settings()@@ -78,12 +78,12 @@ function set_transanctional_email_settings()config()->set('mail.default', 'smtp');config()->set('mail.mailers.smtp', ["transport" => "smtp",- "host" => $settings->extra_attributes?->get('smtp_host'),- "port" => $settings->extra_attributes?->get('smtp_port'),- "encryption" => $settings->extra_attributes?->get('smtp_encryption'),- "username" => $settings->extra_attributes?->get('smtp_username'),- "password" => $settings->extra_attributes?->get('smtp_password'),- "timeout" => $settings->extra_attributes?->get('smtp_timeout'),+ "host" => data_get($settings, 'smtp.host'),+ "port" => data_get($settings, 'smtp.port'),+ "encryption" => data_get($settings, 'smtp.encryption'),+ "username" => data_get($settings, 'smtp.username'),+ "password" => data_get($settings, 'smtp.password'),+ "timeout" => data_get($settings, 'smtp.timeout'),"local_domain" => null,]);}diff --git a/database/migrations/2023_03_20_112811_create_teams_table.php b/database/migrations/2023_03_20_112811_create_teams_table.phpindex 83347563af..0f41c5e95d 100644--- a/database/migrations/2023_03_20_112811_create_teams_table.php+++ b/database/migrations/2023_03_20_112811_create_teams_table.php@@ -16,7 +16,10 @@ return new class extends Migration$table->string('name');$table->string('description')->nullable();$table->boolean('personal_team')->default(false);- $table->schemalessAttributes('extra_attributes');+ $table->schemalessAttributes('smtp');+ $table->schemalessAttributes('smtp_notifications');+ $table->schemalessAttributes('discord');+ $table->schemalessAttributes('discord_notifications');$table->timestamps();});}diff --git a/database/migrations/2023_03_20_112814_create_instance_settings_table.php b/database/migrations/2023_03_20_112814_create_instance_settings_table.phpindex c0fc8a6fb4..a90c740fc2 100644--- a/database/migrations/2023_03_20_112814_create_instance_settings_table.php+++ b/database/migrations/2023_03_20_112814_create_instance_settings_table.php@@ -23,7 +23,7 @@ return new class extends Migration$table->boolean('do_not_track')->default(false);$table->boolean('is_auto_update_enabled')->default(true);$table->boolean('is_registration_enabled')->default(true);- $table->schemalessAttributes('extra_attributes');+ $table->schemalessAttributes('smtp');// $table->string('custom_dns_servers')->default('1.1.1.1,8.8.8.8');// $table->boolean('is_dns_check_enabled')->default(true);$table->timestamps();diff --git a/database/seeders/InstanceSettingsSeeder.php b/database/seeders/InstanceSettingsSeeder.phpindex 503ce62ff1..12e6e2fcb3 100644--- a/database/seeders/InstanceSettingsSeeder.php+++ b/database/seeders/InstanceSettingsSeeder.php@@ -2,7 +2,6 @@namespace Database\Seeders;-use App\Data\SmtpConfiguration;use App\Models\InstanceSettings;use Illuminate\Database\Seeder;use Illuminate\Support\Facades\Process;@@ -17,14 +16,14 @@ class InstanceSettingsSeeder extends SeederInstanceSettings::create(['id' => 0,'is_registration_enabled' => true,- 'extra_attributes' => SmtpConfiguration::from([- 'smtp_enabled' => true,- 'smtp_test_recipients' => '[email protected],[email protected]',- 'smtp_host' => 'coolify-mail',- 'smtp_port' => 1025,- 'smtp_from_address' => '[email protected]',- 'smtp_from_name' => 'Coolify',- ])+ 'smtp' => [+ 'enabled' => true,+ 'test_recipients' => '[email protected],[email protected]',+ 'host' => 'coolify-mail',+ 'port' => 1025,+ 'from_address' => '[email protected]',+ 'from_name' => 'Coolify',+ ]]);try {$ipv4 = Process::run('curl -4s https://ifconfig.io')->output();diff --git a/resources/views/livewire/notifications/discord-settings.blade.php b/resources/views/livewire/notifications/discord-settings.blade.phpindex a037912a74..5785362d80 100644--- a/resources/views/livewire/notifications/discord-settings.blade.php+++ b/resources/views/livewire/notifications/discord-settings.blade.php@@ -5,7 +5,7 @@<x-forms.button type="submit">Save</x-forms.button>- @if ($model->extra_attributes->discord_enabled)+ @if ($model->discord->enabled)<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"wire:click="sendTestNotification">Send Test Notifications@@ -13,20 +13,20 @@@endif</div><div class="w-48">- <x-forms.checkbox instantSave id="model.extra_attributes.discord_enabled" label="Notification Enabled" />+ <x-forms.checkbox instantSave id="model.discord.enabled" label="Notification Enabled" /></div><x-forms.input type="string"helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." required- id="model.extra_attributes.discord_webhook_url" label="Webhook" />+ id="model.discord.webhook_url" label="Webhook" /></form>- @if (data_get($model, 'extra_attributes.discord_enabled'))+ @if (data_get($model, 'discord.enabled'))<h4 class="mt-4">Subscribe to events</h4><div class="w-64 ">@if (isDev())- <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_discord_test"+ <x-forms.checkbox instantSave="saveModel" id="model.discord_notifications.test"label="Test Notifications" />@endif- <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_discord_deployments"+ <x-forms.checkbox instantSave="saveModel" id="model.discord_notifications.deployments"label="New Deployments" /></div>@endifdiff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.phpindex 9f3aa35ac9..406c7ce6b9 100644--- a/resources/views/livewire/notifications/email-settings.blade.php+++ b/resources/views/livewire/notifications/email-settings.blade.php@@ -6,11 +6,11 @@Save</x-forms.button>@if (auth()->user()->isInstanceAdmin())- <x-forms.button wire:click='copySMTP'>+ <x-forms.button wire:click='copyFromInstanceSettings'>Copy from Instance Settings</x-forms.button>@endif- @if ($model->extra_attributes->smtp_enabled)+ @if ($model->smtp->enabled)<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"wire:click="sendTestNotification">Send Test Notifications@@ -18,49 +18,44 @@@endif</div><div class="w-48">- <x-forms.checkbox instantSave id="model.extra_attributes.smtp_enabled" label="Notification Enabled" />+ <x-forms.checkbox instantSave id="model.smtp.enabled" label="Notification Enabled" /></div><div class="flex flex-col gap-2 xl:flex-row">- <x-forms.input id="model.extra_attributes.smtp_recipients"- placeholder="If empty, all users will be notified in the team."+ <x-forms.input id="model.smtp.recipients" placeholder="If empty, all users will be notified in the team."helper="Email list to send the all notifications to, separated by comma." label="Recipients" />- <x-forms.input id="model.extra_attributes.smtp_test_recipients" label="Test Notification Recipients"+ <x-forms.input id="model.smtp.test_recipients" label="Test Notification Recipients"placeholder="If empty, all users will be notified in the team."helper="Email list to send the test notification to, separated by comma." /></div><div class="flex flex-col gap-2 xl:flex-row">- <x-forms.input required id="model.extra_attributes.smtp_host" helper="SMTP Hostname"- placeholder="smtp.mailgun.org" label="Host" />- <x-forms.input required id="model.extra_attributes.smtp_port" helper="SMTP Port" placeholder="587"- label="Port" />- <x-forms.input helper="If SMTP through SSL, set it to 'tls'." placeholder="tls"- id="model.extra_attributes.smtp_encryption" label="Encryption" />+ <x-forms.input required id="model.smtp.host" helper="SMTP Hostname" placeholder="smtp.mailgun.org"+ label="Host" />+ <x-forms.input required id="model.smtp.port" helper="SMTP Port" placeholder="587" label="Port" />+ <x-forms.input helper="If SMTP through SSL, set it to 'tls'." placeholder="tls" id="model.smtp.encryption"+ label="Encryption" /></div><div class="flex flex-col"><div class="flex flex-col gap-2 xl:flex-row">- <x-forms.input id="model.extra_attributes.smtp_username" helper="SMTP Username" label="Username" />- <x-forms.input type="password" helper="SMTP Password" id="model.extra_attributes.smtp_password"- label="Password" />+ <x-forms.input id="model.smtp.username" helper="SMTP Username" label="Username" />+ <x-forms.input type="password" helper="SMTP Password" id="model.smtp.password" label="Password" /></div>- <x-forms.input id="model.extra_attributes.smtp_timeout" helper="Timeout value for sending emails."- label="Timeout" />+ <x-forms.input id="model.smtp.timeout" helper="Timeout value for sending emails." label="Timeout" /><div class="flex flex-col gap-2 xl:flex-row">- <x-forms.input required id="model.extra_attributes.smtp_from_name" helper="Name used in emails."- label="From Name" />- <x-forms.input required id="model.extra_attributes.smtp_from_address"- helper="Email address used in emails." label="From Address" />+ <x-forms.input required id="model.smtp.from_name" helper="Name used in emails." label="From Name" />+ <x-forms.input required id="model.smtp.from_address" helper="Email address used in emails."+ label="From Address" /></div></div></form>- @if (data_get($model, 'extra_attributes.smtp_enabled'))+ @if (data_get($model, 'smtp.enabled'))<h4 class="mt-4">Subscribe to events</h4>- <div class="w-64 ">+ <div class="w-64">@if (isDev())- <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_smtp_test"+ <x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications.test"label="Test Notifications" />@endif- <x-forms.checkbox instantSave="saveModel" id="model.extra_attributes.notifications_email_deployments"+ <x-forms.checkbox instantSave="saveModel" id="model.smtp_notifications.deployments"label="New Deployments" /></div>@endifdiff --git a/resources/views/livewire/settings/email.blade.php b/resources/views/livewire/settings/email.blade.phpindex cefea888f1..22f87f88bc 100644--- a/resources/views/livewire/settings/email.blade.php+++ b/resources/views/livewire/settings/email.blade.php@@ -8,12 +8,12 @@</div><div class="pt-2 pb-4 ">SMTP settings for password resets, invitations, etc.</div><div class="flex flex-col">- <x-forms.checkbox instantSave id="settings.extra_attributes.smtp_enabled" label="Enabled" />+ <x-forms.checkbox instantSave id="settings.smtp.enabled" label="Enabled" /></div><div class="flex items-end gap-2">- <x-forms.input id="settings.extra_attributes.smtp_test_recipients" label="Test Recipients"+ <x-forms.input id="settings.smtp.test_recipients" label="Test Recipients"helper="Email list to send a test email to, separated by comma." />- @if ($settings->extra_attributes->smtp_enabled)+ @if ($settings->smtp->enabled)<x-forms.button wire:click='test_email'>Send Test Email</x-forms.button>@@ -21,26 +21,22 @@</div><div class="flex flex-col gap-2 xl:flex-row"><div class="flex flex-col w-full">- <x-forms.input required id="settings.extra_attributes.smtp_host" helper="SMTP Hostname"- placeholder="smtp.mailgun.org" label="Host" />- <x-forms.input required id="settings.extra_attributes.smtp_port" helper="SMTP Port" placeholder="587"- label="Port" />- <x-forms.input id="settings.extra_attributes.smtp_encryption"- helper="If SMTP through SSL, set it to 'tls'." placeholder="tls" label="Encryption" />+ <x-forms.input required id="settings.smtp.host" helper="SMTP Hostname" placeholder="smtp.mailgun.org"+ label="Host" />+ <x-forms.input required id="settings.smtp.port" helper="SMTP Port" placeholder="587" label="Port" />+ <x-forms.input id="settings.smtp.encryption" helper="If SMTP through SSL, set it to 'tls'."+ placeholder="tls" label="Encryption" /></div><div class="flex flex-col w-full">- <x-forms.input id="settings.extra_attributes.smtp_username" helper="SMTP Username"- label="SMTP Username" />- <x-forms.input id="settings.extra_attributes.smtp_password" type="password" helper="SMTP Password"+ <x-forms.input id="settings.smtp.username" helper="SMTP Username" label="SMTP Username" />+ <x-forms.input id="settings.smtp.password" type="password" helper="SMTP Password"label="SMTP Password" />- <x-forms.input id="settings.extra_attributes.smtp_timeout" helper="Timeout value for sending emails."- label="Timeout" />+ <x-forms.input id="settings.smtp.timeout" helper="Timeout value for sending emails." label="Timeout" /></div><div class="flex flex-col w-full">- <x-forms.input required id="settings.extra_attributes.smtp_from_name" helper="Name used in emails."- label="From Name" />- <x-forms.input required id="settings.extra_attributes.smtp_from_address"- helper="Email address used in emails." label="From Address" />+ <x-forms.input required id="settings.smtp.from_name" helper="Name used in emails." label="From Name" />+ <x-forms.input required id="settings.smtp.from_address" helper="Email address used in emails."+ label="From Address" /></div></div></form>