diff --git a/app/Console/Commands/Emails.php b/app/Console/Commands/Emails.php index 43ba06804..60626ced8 100644 --- a/app/Console/Commands/Emails.php +++ b/app/Console/Commands/Emails.php @@ -54,7 +54,6 @@ class Emails extends Command options: [ 'updates' => 'Send Update Email to all users', 'emails-test' => 'Test', - 'database-backup-statuses-daily' => 'Database - Backup Statuses (Daily)', 'application-deployment-success-daily' => 'Application - Deployment Success (Daily)', 'application-deployment-success' => 'Application - Deployment Success', 'application-deployment-failed' => 'Application - Deployment Failed', @@ -167,7 +166,7 @@ class Emails extends Command ]); } $output = 'Because of an error, the backup of the database '.$db->name.' failed.'; - $this->mail = (new BackupFailed($backup, $db, $output, $backup->database_name ?? 'unknown'))->toMail(); + $this->mail = (new BackupFailed($backup, $db, $output))->toMail(); $this->sendEmail(); break; case 'backup-success': diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.php index c2b21b1d5..0040d7ace 100644 --- a/app/Notifications/Database/BackupFailed.php +++ b/app/Notifications/Database/BackupFailed.php @@ -15,7 +15,7 @@ class BackupFailed extends CustomEmailNotification public string $frequency; - public function __construct(ScheduledDatabaseBackup $backup, public $database, public $output, public $database_name) + public function __construct(ScheduledDatabaseBackup $backup, public $database, public $output) { $this->onQueue('high'); $this->name = $database->name; @@ -33,7 +33,6 @@ class BackupFailed extends CustomEmailNotification $mail->subject("Coolify: [ACTION REQUIRED] Database Backup FAILED for {$this->database->name}"); $mail->view('emails.backup-failed', [ 'name' => $this->name, - 'database_name' => $this->database_name, 'frequency' => $this->frequency, 'output' => $this->output, ]); @@ -45,7 +44,7 @@ class BackupFailed extends CustomEmailNotification { $message = new DiscordMessage( title: ':cross_mark: Database backup failed', - description: "Database backup for {$this->name} (db:{$this->database_name}) has FAILED.", + description: "Database backup for {$this->name} has FAILED.", color: DiscordMessage::errorColor(), isCritical: true, ); @@ -58,7 +57,7 @@ class BackupFailed extends CustomEmailNotification public function toTelegram(): array { - $message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was FAILED.\n\nReason:\n{$this->output}"; + $message = "Coolify: Database backup for {$this->name} with frequency of {$this->frequency} was FAILED.\n\nReason:\n{$this->output}"; return [ 'message' => $message, @@ -70,14 +69,14 @@ class BackupFailed extends CustomEmailNotification return new PushoverMessage( title: 'Database backup failed', level: 'error', - message: "Database backup for {$this->name} (db:{$this->database_name}) was FAILED

Frequency: {$this->frequency} .
Reason: {$this->output}", + message: "Database backup for {$this->name} was FAILED

Frequency: {$this->frequency} .
Reason: {$this->output}", ); } public function toSlack(): SlackMessage { $title = 'Database backup failed'; - $description = "Database backup for {$this->name} (db:{$this->database_name}) has FAILED."; + $description = "Database backup for {$this->name} has FAILED."; $description .= "\n\n*Frequency:* {$this->frequency}"; $description .= "\n\n*Error Output:* {$this->output}"; @@ -99,7 +98,6 @@ class BackupFailed extends CustomEmailNotification 'event' => 'backup_failed', 'database_name' => $this->name, 'database_uuid' => $this->database->uuid, - 'database_type' => $this->database_name, 'frequency' => $this->frequency, 'error_output' => $this->output, 'url' => $url, diff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.php index 3d2d8ece3..4624fcef8 100644 --- a/app/Notifications/Database/BackupSuccess.php +++ b/app/Notifications/Database/BackupSuccess.php @@ -15,7 +15,7 @@ class BackupSuccess extends CustomEmailNotification public string $frequency; - public function __construct(ScheduledDatabaseBackup $backup, public $database, public $database_name) + public function __construct(ScheduledDatabaseBackup $backup, public $database) { $this->onQueue('high'); @@ -34,7 +34,6 @@ class BackupSuccess extends CustomEmailNotification $mail->subject("Coolify: Backup successfully done for {$this->database->name}"); $mail->view('emails.backup-success', [ 'name' => $this->name, - 'database_name' => $this->database_name, 'frequency' => $this->frequency, ]); @@ -45,7 +44,7 @@ class BackupSuccess extends CustomEmailNotification { $message = new DiscordMessage( title: ':white_check_mark: Database backup successful', - description: "Database backup for {$this->name} (db:{$this->database_name}) was successful.", + description: "Database backup for {$this->name} was successful.", color: DiscordMessage::successColor(), ); @@ -56,7 +55,7 @@ class BackupSuccess extends CustomEmailNotification public function toTelegram(): array { - $message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was successful."; + $message = "Coolify: Database backup for {$this->name} with frequency of {$this->frequency} was successful."; return [ 'message' => $message, @@ -68,14 +67,14 @@ class BackupSuccess extends CustomEmailNotification return new PushoverMessage( title: 'Database backup successful', level: 'success', - message: "Database backup for {$this->name} (db:{$this->database_name}) was successful.

Frequency: {$this->frequency}.", + message: "Database backup for {$this->name} was successful.

Frequency: {$this->frequency}.", ); } public function toSlack(): SlackMessage { $title = 'Database backup successful'; - $description = "Database backup for {$this->name} (db:{$this->database_name}) was successful."; + $description = "Database backup for {$this->name} was successful."; $description .= "\n\n*Frequency:* {$this->frequency}"; @@ -96,7 +95,6 @@ class BackupSuccess extends CustomEmailNotification 'event' => 'backup_success', 'database_name' => $this->name, 'database_uuid' => $this->database->uuid, - 'database_type' => $this->database_name, 'frequency' => $this->frequency, 'url' => $url, ]; diff --git a/app/Notifications/Database/BackupSuccessWithS3Warning.php b/app/Notifications/Database/BackupSuccessWithS3Warning.php index ee24ef17d..d8ec01731 100644 --- a/app/Notifications/Database/BackupSuccessWithS3Warning.php +++ b/app/Notifications/Database/BackupSuccessWithS3Warning.php @@ -17,7 +17,7 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification public ?string $s3_storage_url = null; - public function __construct(ScheduledDatabaseBackup $backup, public $database, public $database_name, public $s3_error) + public function __construct(ScheduledDatabaseBackup $backup, public $database, public $s3_error) { $this->onQueue('high'); @@ -40,7 +40,6 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification $mail->subject("Coolify: Backup succeeded locally but S3 upload failed for {$this->database->name}"); $mail->view('emails.backup-success-with-s3-warning', [ 'name' => $this->name, - 'database_name' => $this->database_name, 'frequency' => $this->frequency, 's3_error' => $this->s3_error, 's3_storage_url' => $this->s3_storage_url, @@ -53,7 +52,7 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification { $message = new DiscordMessage( title: ':warning: Database backup succeeded locally, S3 upload failed', - description: "Database backup for {$this->name} (db:{$this->database_name}) was created successfully on local storage, but failed to upload to S3.", + description: "Database backup for {$this->name} was created successfully on local storage, but failed to upload to S3.", color: DiscordMessage::warningColor(), ); @@ -69,7 +68,7 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification public function toTelegram(): array { - $message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} succeeded locally but failed to upload to S3.\n\nS3 Error:\n{$this->s3_error}"; + $message = "Coolify: Database backup for {$this->name} with frequency of {$this->frequency} succeeded locally but failed to upload to S3.\n\nS3 Error:\n{$this->s3_error}"; if ($this->s3_storage_url) { $message .= "\n\nCheck S3 Configuration: {$this->s3_storage_url}"; @@ -82,7 +81,7 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification public function toPushover(): PushoverMessage { - $message = "Database backup for {$this->name} (db:{$this->database_name}) was created successfully on local storage, but failed to upload to S3.

Frequency: {$this->frequency}.
S3 Error: {$this->s3_error}"; + $message = "Database backup for {$this->name} was created successfully on local storage, but failed to upload to S3.

Frequency: {$this->frequency}.
S3 Error: {$this->s3_error}"; if ($this->s3_storage_url) { $message .= "

s3_storage_url}\">Check S3 Configuration"; @@ -98,7 +97,7 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification public function toSlack(): SlackMessage { $title = 'Database backup succeeded locally, S3 upload failed'; - $description = "Database backup for {$this->name} (db:{$this->database_name}) was created successfully on local storage, but failed to upload to S3."; + $description = "Database backup for {$this->name} was created successfully on local storage, but failed to upload to S3."; $description .= "\n\n*Frequency:* {$this->frequency}"; $description .= "\n\n*S3 Error:* {$this->s3_error}"; @@ -124,7 +123,6 @@ class BackupSuccessWithS3Warning extends CustomEmailNotification 'event' => 'backup_success_with_s3_warning', 'database_name' => $this->name, 'database_uuid' => $this->database->uuid, - 'database_type' => $this->database_name, 'frequency' => $this->frequency, 's3_error' => $this->s3_error, 'url' => $url, diff --git a/resources/views/emails/backup-failed.blade.php b/resources/views/emails/backup-failed.blade.php index 013c8bc98..de6a7c981 100644 --- a/resources/views/emails/backup-failed.blade.php +++ b/resources/views/emails/backup-failed.blade.php @@ -1,5 +1,5 @@ -Database backup for {{ $name }} @if($database_name)(db:{{ $database_name }})@endif with frequency of {{ $frequency }} was FAILED. +Database backup for {{ $name }} with frequency of {{ $frequency }} was FAILED. ### Reason diff --git a/resources/views/emails/backup-success-with-s3-warning.blade.php b/resources/views/emails/backup-success-with-s3-warning.blade.php index 5d2f25851..1cc2e4549 100644 --- a/resources/views/emails/backup-success-with-s3-warning.blade.php +++ b/resources/views/emails/backup-success-with-s3-warning.blade.php @@ -1,5 +1,5 @@ -Database backup for {{ $name }} @if($database_name)(db:{{ $database_name }})@endif with frequency of {{ $frequency }} succeeded locally but failed to upload to S3. +Database backup for {{ $name }} with frequency of {{ $frequency }} succeeded locally but failed to upload to S3. S3 Error: {{ $s3_error }} diff --git a/resources/views/emails/backup-success.blade.php b/resources/views/emails/backup-success.blade.php index d06bca6ce..0d54a254c 100644 --- a/resources/views/emails/backup-success.blade.php +++ b/resources/views/emails/backup-success.blade.php @@ -1,3 +1,3 @@ -Database backup for {{ $name }} @if($database_name)(db:{{ $database_name }})@endif with frequency of {{ $frequency }} was successful. +Database backup for {{ $name }} with frequency of {{ $frequency }} was successful. diff --git a/resources/views/livewire/project/database/import.blade.php b/resources/views/livewire/project/database/import.blade.php index 666abb3b3..fa360e35b 100644 --- a/resources/views/livewire/project/database/import.blade.php +++ b/resources/views/livewire/project/database/import.blade.php @@ -61,39 +61,49 @@ @if (str($resourceStatus)->startsWith('running')) {{-- Restore Command Configuration --}} @if ($resourceDbType === 'standalone-postgresql') - @if ($dumpAll) - - @else - -
- You can add "--clean" to drop objects before creating them, avoiding - conflicts. - You can add "--verbose" to log more things. +
+

Import Options

+
+ +
- @endif -
- + + @if ($restoreCommandText) +
{{ $restoreCommandText }}
+ @endif
@elseif ($resourceDbType === 'standalone-mysql') - @if ($dumpAll) - - @else - - @endif -
- +
+

Import Options

+
+ + +
+ + @if ($restoreCommandText) +
{{ $restoreCommandText }}
+ @endif
@elseif ($resourceDbType === 'standalone-mariadb') - @if ($dumpAll) - - @else - - @endif -
- +
+

Import Options

+
+ + +
+ + @if ($restoreCommandText) +
{{ $restoreCommandText }}
+ @endif
@endif