Skip to content

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.

fix: database backups

Andras Bacsai24fa56762e5c
diff --git a/app/Http/Livewire/Project/Database/BackupEdit.php b/app/Http/Livewire/Project/Database/BackupEdit.php
index a8a0ef055a..ea217f5266 100644
--- a/app/Http/Livewire/Project/Database/BackupEdit.php
+++ b/app/Http/Livewire/Project/Database/BackupEdit.php
@@ -8,6 +8,7 @@ class BackupEdit extends Component
{
public $backup;
public $s3s;
+ public ?string $status = null;
public array $parameters;
protected $rules = [
diff --git a/app/Http/Livewire/Team/Storage/Create.php b/app/Http/Livewire/Team/Storage/Create.php
index bcac861f80..4d7fb4f12b 100644
--- a/app/Http/Livewire/Team/Storage/Create.php
+++ b/app/Http/Livewire/Team/Storage/Create.php
@@ -64,7 +64,7 @@ class Create extends Component
}
$this->storage->team_id = currentTeam()->id;
$this->storage->testConnection();
- $this->emit('success', 'Connection is working. Tested with "ListObjectsV2" action.');
+ $this->storage->is_usable = true;
$this->storage->save();
return redirect()->route('team.storages.show', $this->storage->uuid);
} catch (\Throwable $e) {
diff --git a/app/Http/Livewire/Team/Storage/Form.php b/app/Http/Livewire/Team/Storage/Form.php
index 223c5ac415..573c851d7d 100644
--- a/app/Http/Livewire/Team/Storage/Form.php
+++ b/app/Http/Livewire/Team/Storage/Form.php
@@ -9,6 +9,7 @@ class Form extends Component
{
public S3Storage $storage;
protected $rules = [
+ 'storage.is_usable' => 'nullable|boolean',
'storage.name' => 'nullable|min:3|max:255',
'storage.description' => 'nullable|min:3|max:255',
'storage.region' => 'required|max:255',
@@ -18,6 +19,7 @@ class Form extends Component
'storage.endpoint' => 'required|url|max:255',
];
protected $validationAttributes = [
+ 'storage.is_usable' => 'Is Usable',
'storage.name' => 'Name',
'storage.description' => 'Description',
'storage.region' => 'Region',
diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php
index a59c6494a9..cc65cea9be 100644
--- a/app/Jobs/DatabaseBackupJob.php
+++ b/app/Jobs/DatabaseBackupJob.php
@@ -31,7 +31,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
public ?string $container_name = null;
public ?ScheduledDatabaseBackupExecution $backup_log = null;
- public string $backup_status;
+ public string $backup_status = 'failed';
public ?string $backup_location = null;
public string $backup_dir;
public string $backup_file;
@@ -74,7 +74,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
$ip = Str::slug($this->server->ip);
$this->backup_dir = backup_dir() . "/coolify" . "/coolify-db-$ip";
}
- $this->backup_file = "/pg_dump-" . Carbon::now()->timestamp . ".dump";
+ $this->backup_file = "/pg-backup-customformat-" . Carbon::now()->timestamp . ".backup";
$this->backup_location = $this->backup_dir . $this->backup_file;
$this->backup_log = ScheduledDatabaseBackupExecution::create([
@@ -90,10 +90,17 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
$this->upload_to_s3();
}
$this->save_backup_logs();
+ $this->team->notify(new BackupSuccess($this->backup, $this->database));
+ $this->backup_status = 'success';
} catch (\Throwable $e) {
- ray($e->getMessage());
+ $this->backup_status = 'failed';
send_internal_notification('DatabaseBackupJob failed with: ' . $e->getMessage());
+ $this->team->notify(new BackupFailed($this->backup, $this->database, $this->backup_output));
throw $e;
+ } finally {
+ $this->backup_log->update([
+ 'status' => $this->backup_status,
+ ]);
}
}
@@ -103,28 +110,15 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
ray($this->backup_dir);
$commands[] = "mkdir -p " . $this->backup_dir;
$commands[] = "docker exec $this->container_name pg_dump -Fc -U {$this->database->postgres_user} > $this->backup_location";
-
$this->backup_output = instant_remote_process($commands, $this->server);
-
$this->backup_output = trim($this->backup_output);
-
if ($this->backup_output === '') {
$this->backup_output = null;
}
-
ray('Backup done for ' . $this->container_name . ' at ' . $this->server->name . ':' . $this->backup_location);
-
- $this->backup_status = 'success';
- $this->team->notify(new BackupSuccess($this->backup, $this->database));
} catch (\Throwable $e) {
- $this->backup_status = 'failed';
$this->add_to_backup_output($e->getMessage());
ray('Backup failed for ' . $this->container_name . ' at ' . $this->server->name . ':' . $this->backup_location . '\n\nError:' . $e->getMessage());
- $this->team->notify(new BackupFailed($this->backup, $this->database, $this->backup_output));
- } finally {
- $this->backup_log->update([
- 'status' => $this->backup_status,
- ]);
}
}
@@ -163,11 +157,16 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
}
$key = $this->s3->key;
$secret = $this->s3->secret;
- // $region = $this->s3->region;
+ // $region = $this->s3->region;
$bucket = $this->s3->bucket;
$endpoint = $this->s3->endpoint;
+ $this->s3->testConnection();
+ if (isDev()) {
+ $commands[] = "docker run --pull=always -d --network {$this->database->destination->network} --name backup-of-{$this->backup->uuid} --rm -v coolify_coolify-data-dev:/data/coolify:ro ghcr.io/coollabsio/coolify-helper >/dev/null 2>&1";
+ } else {
+ $commands[] = "docker run --pull=always -d --network {$this->database->destination->network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro ghcr.io/coollabsio/coolify-helper >/dev/null 2>&1";
+ }
- $commands[] = "docker run --pull=always -d --network {$this->database->destination->network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro ghcr.io/coollabsio/coolify-helper";
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
instant_remote_process($commands, $this->server);
@@ -175,7 +174,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
ray('Uploaded to S3. ' . $this->backup_location . ' to s3://' . $bucket . $this->backup_dir);
} catch (\Throwable $e) {
$this->add_to_backup_output($e->getMessage());
- ray($e->getMessage());
+ throw $e;
} finally {
$command = "docker rm -f backup-of-{$this->backup->uuid}";
instant_remote_process([$command], $this->server);
diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php
index cbcdb97a9a..03953d3197 100644
--- a/app/Models/S3Storage.php
+++ b/app/Models/S3Storage.php
@@ -3,6 +3,8 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Support\Facades\Storage;
class S3Storage extends BaseModel
{
@@ -10,6 +12,7 @@ class S3Storage extends BaseModel
protected $guarded = [];
protected $casts = [
+ 'is_usable' => 'boolean',
'key' => 'encrypted',
'secret' => 'encrypted',
];
@@ -19,7 +22,15 @@ class S3Storage extends BaseModel
$selectArray = collect($select)->concat(['id']);
return S3Storage::whereTeamId(currentTeam()->id)->select($selectArray->all())->orderBy('name');
}
+ public function isUsable()
+ {
+ return $this->is_usable;
+ }
+ public function team()
+ {
+ return $this->belongsTo(Team::class);
+ }
public function awsUrl()
{
return "{$this->endpoint}/{$this->bucket}";
@@ -27,7 +38,34 @@ class S3Storage extends BaseModel
public function testConnection()
{
- set_s3_target($this);
- return \Storage::disk('custom-s3')->files();
+ try {
+ set_s3_target($this);
+ Storage::disk('custom-s3')->files();
+ $this->unusable_email_sent = false;
+ $this->is_usable = true;
+ return;
+ } catch (\Throwable $e) {
+ $this->is_usable = false;
+ if ($this->unusable_email_sent === false) {
+ $mail = new MailMessage();
+ $mail->subject('Coolify: S3 Storage Connection Error');
+ $mail->view('emails.s3-connection-error', ['name' => $this->name, 'reason' => $e->getMessage(), 'url' => route('team.storages.show', ['storage_uuid' => $this->uuid])]);
+ $users = collect([]);
+ $members = $this->team->members()->get();
+ foreach ($members as $user) {
+ if ($user->isAdmin()) {
+ $users->push($user);
+ }
+ }
+ foreach ($users as $user) {
+ send_user_an_email($mail, $user->email);
+ }
+ $this->unusable_email_sent = true;
+ }
+
+ throw $e;
+ } finally {
+ $this->save();
+ }
}
}
diff --git a/app/Models/Team.php b/app/Models/Team.php
index 6ae949d080..8021b1e974 100644
--- a/app/Models/Team.php
+++ b/app/Models/Team.php
@@ -48,6 +48,7 @@ class Team extends Model implements SendsDiscord, SendsEmail
}
return explode(',', $recipients);
}
+
public function limits(): Attribute
{
return Attribute::make(
@@ -125,7 +126,7 @@ class Team extends Model implements SendsDiscord, SendsEmail
public function s3s()
{
- return $this->hasMany(S3Storage::class);
+ return $this->hasMany(S3Storage::class)->where('is_usable', true);
}
public function trialEnded() {
foreach ($this->servers as $server) {
diff --git a/app/Notifications/Application/DeploymentFailed.php b/app/Notifications/Application/DeploymentFailed.php
index f97fbc77ed..a379cd46f4 100644
--- a/app/Notifications/Application/DeploymentFailed.php
+++ b/app/Notifications/Application/DeploymentFailed.php
@@ -52,10 +52,10 @@ class DeploymentFailed extends Notification implements ShouldQueue
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
$fqdn = $this->fqdn;
if ($pull_request_id === 0) {
- $mail->subject('❌ Deployment failed of ' . $this->application_name . '.');
+ $mail->subject('Coolify: Deployment failed of ' . $this->application_name . '.');
} else {
$fqdn = $this->preview->fqdn;
- $mail->subject('❌ Deployment failed of pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . '.');
+ $mail->subject('Coolify: Deployment failed of pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . '.');
}
$mail->view('emails.application-deployment-failed', [
'name' => $this->application_name,
@@ -69,10 +69,10 @@ class DeploymentFailed extends Notification implements ShouldQueue
public function toDiscord(): string
{
if ($this->preview) {
- $message = '❌ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '** (' . $this->preview->fqdn . ') deployment failed: ';
+ $message = 'Coolify: Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '** (' . $this->preview->fqdn . ') deployment failed: ';
$message .= '[View Deployment Logs](' . $this->deployment_url . ')';
} else {
- $message = '❌ Deployment failed of **' . $this->application_name . '** (' . $this->fqdn . '): ';
+ $message = 'Coolify: Deployment failed of **' . $this->application_name . '** (' . $this->fqdn . '): ';
$message .= '[View Deployment Logs](' . $this->deployment_url . ')';
}
return $message;
@@ -80,9 +80,9 @@ class DeploymentFailed extends Notification implements ShouldQueue
public function toTelegram(): array
{
if ($this->preview) {
- $message = '❌ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '** (' . $this->preview->fqdn . ') deployment failed: ';
+ $message = 'Coolify: Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '** (' . $this->preview->fqdn . ') deployment failed: ';
} else {
- $message = '❌ Deployment failed of **' . $this->application_name . '** (' . $this->fqdn . '): ';
+ $message = 'Coolify: Deployment failed of **' . $this->application_name . '** (' . $this->fqdn . '): ';
}
return [
"message" => $message,
diff --git a/app/Notifications/Application/DeploymentSuccess.php b/app/Notifications/Application/DeploymentSuccess.php
index 053ae7a2b9..1fe01a5d7d 100644
--- a/app/Notifications/Application/DeploymentSuccess.php
+++ b/app/Notifications/Application/DeploymentSuccess.php
@@ -52,10 +52,10 @@ class DeploymentSuccess extends Notification implements ShouldQueue
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
$fqdn = $this->fqdn;
if ($pull_request_id === 0) {
- $mail->subject("✅ New version is deployed of {$this->application_name}");
+ $mail->subject("Coolify: New version is deployed of {$this->application_name}");
} else {
$fqdn = $this->preview->fqdn;
- $mail->subject("✅ Pull request #{$pull_request_id} of {$this->application_name} deployed successfully");
+ $mail->subject("Coolify: Pull request #{$pull_request_id} of {$this->application_name} deployed successfully");
}
$mail->view('emails.application-deployment-success', [
'name' => $this->application_name,
@@ -69,7 +69,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue
public function toDiscord(): string
{
if ($this->preview) {
- $message = '✅ New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '
+ $message = 'Coolify: New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '
';
if ($this->preview->fqdn) {
@@ -77,7 +77,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue
}
$message .= '[Deployment logs](' . $this->deployment_url . ')';
} else {
- $message = '✅ New version successfully deployed of ' . $this->application_name . '
+ $message = 'Coolify: New version successfully deployed of ' . $this->application_name . '
';
if ($this->fqdn) {
@@ -90,7 +90,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue
public function toTelegram(): array
{
if ($this->preview) {
- $message = '✅ New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '';
+ $message = 'Coolify: New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '';
if ($this->preview->fqdn) {
$buttons[] = [
"text" => "Open Application",
diff --git a/app/Notifications/Application/StatusChanged.php b/app/Notifications/Application/StatusChanged.php
index 064c347d0c..df12f2b0a7 100644
--- a/app/Notifications/Application/StatusChanged.php
+++ b/app/Notifications/Application/StatusChanged.php
@@ -45,7 +45,7 @@ class StatusChanged extends Notification implements ShouldQueue
{
$mail = new MailMessage();
$fqdn = $this->fqdn;
- $mail->subject("⛔ {$this->application_name} has been stopped");
+ $mail->subject("Coolify: {$this->application_name} has been stopped");
$mail->view('emails.application-status-changes', [
'name' => $this->application_name,
'fqdn' => $fqdn,
@@ -56,7 +56,7 @@ class StatusChanged extends Notification implements ShouldQueue
public function toDiscord(): string
{
- $message = '⛔ ' . $this->application_name . ' has been stopped.
+ $message = 'Coolify: ' . $this->application_name . ' has been stopped.
';
$message .= '[Open Application in Coolify](' . $this->application_url . ')';
@@ -64,7 +64,7 @@ class StatusChanged extends Notification implements ShouldQueue
}
public function toTelegram(): array
{
- $message = '⛔ ' . $this->application_name . ' has been stopped.';
+ $message = 'Coolify: ' . $this->application_name . ' has been stopped.';
return [
"message" => $message,
"buttons" => [
diff --git a/app/Notifications/Container/ContainerRestarted.php b/app/Notifications/Container/ContainerRestarted.php
index 25fd08ff83..dc55c05d27 100644
--- a/app/Notifications/Container/ContainerRestarted.php
+++ b/app/Notifications/Container/ContainerRestarted.php
@@ -27,7 +27,7 @@ class ContainerRestarted extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("✅ Container ({$this->name}) has been restarted automatically on {$this->server->name}");
+ $mail->subject("Coolify: Container ({$this->name}) has been restarted automatically on {$this->server->name}");
$mail->view('emails.container-restarted', [
'containerName' => $this->name,
'serverName' => $this->server->name,
@@ -38,12 +38,12 @@ class ContainerRestarted extends Notification implements ShouldQueue
public function toDiscord(): string
{
- $message = "✅ Container ({$this->name}) has been restarted automatically on {$this->server->name}";
+ $message = "Coolify: Container ({$this->name}) has been restarted automatically on {$this->server->name}";
return $message;
}
public function toTelegram(): array
{
- $message = "✅ Container ({$this->name}) has been restarted automatically on {$this->server->name}";
+ $message = "Coolify: Container ({$this->name}) has been restarted automatically on {$this->server->name}";
$payload = [
"message" => $message,
];
diff --git a/app/Notifications/Container/ContainerStopped.php b/app/Notifications/Container/ContainerStopped.php
index 390c9552be..4518698fb5 100644
--- a/app/Notifications/Container/ContainerStopped.php
+++ b/app/Notifications/Container/ContainerStopped.php
@@ -26,7 +26,7 @@ class ContainerStopped extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("⛔ Container {$this->name} has been stopped on {$this->server->name}");
+ $mail->subject("Coolify: Container ({$this->name}) has been stopped on {$this->server->name}");
$mail->view('emails.container-stopped', [
'containerName' => $this->name,
'serverName' => $this->server->name,
@@ -37,12 +37,12 @@ class ContainerStopped extends Notification implements ShouldQueue
public function toDiscord(): string
{
- $message = "⛔ Container {$this->name} has been stopped on {$this->server->name}";
+ $message = "Coolify: Container ({$this->name}) has been stopped on {$this->server->name}";
return $message;
}
public function toTelegram(): array
{
- $message = "⛔ Container ($this->name} has been stopped on {$this->server->name}";
+ $message = "Coolify: Container ($this->name} has been stopped on {$this->server->name}";
$payload = [
"message" => $message,
];
diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.php
index 482b27977e..dddc1240bd 100644
--- a/app/Notifications/Database/BackupFailed.php
+++ b/app/Notifications/Database/BackupFailed.php
@@ -30,7 +30,7 @@ class BackupFailed extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("❌ [ACTION REQUIRED] Backup FAILED for {$this->database->name}");
+ $mail->subject("Coolify: [ACTION REQUIRED] Backup FAILED for {$this->database->name}");
$mail->view('emails.backup-failed', [
'name' => $this->name,
'frequency' => $this->frequency,
@@ -41,11 +41,11 @@ class BackupFailed extends Notification implements ShouldQueue
public function toDiscord(): string
{
- return "❌ Database backup for {$this->name} with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}";
+ return "Coolify: Database backup for {$this->name} with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}";
}
public function toTelegram(): array
{
- $message = "❌ Database backup for {$this->name} with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}";
+ $message = "Coolify: Database backup for {$this->name} with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}";
return [
"message" => $message,
];
diff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.php
index 0378baf961..bbe0bc6d36 100644
--- a/app/Notifications/Database/BackupSuccess.php
+++ b/app/Notifications/Database/BackupSuccess.php
@@ -30,7 +30,7 @@ class BackupSuccess extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("✅ Backup successfully done for {$this->database->name}");
+ $mail->subject("Coolify: Backup successfully done for {$this->database->name}");
$mail->view('emails.backup-success', [
'name' => $this->name,
'frequency' => $this->frequency,
@@ -40,11 +40,11 @@ class BackupSuccess extends Notification implements ShouldQueue
public function toDiscord(): string
{
- return "✅ Database backup for {$this->name} with frequency of {$this->frequency} was successful.";
+ return "Coolify: Database backup for {$this->name} with frequency of {$this->frequency} was successful.";
}
public function toTelegram(): array
{
- $message = "✅ Database backup for {$this->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,
];
diff --git a/app/Notifications/Server/Revived.php b/app/Notifications/Server/Revived.php
index 07771a2870..21fe6d40dc 100644
--- a/app/Notifications/Server/Revived.php
+++ b/app/Notifications/Server/Revived.php
@@ -45,7 +45,7 @@ class Revived extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("✅ Server ({$this->server->name}) revived.");
+ $mail->subject("Coolify: Server ({$this->server->name}) revived.");
$mail->view('emails.server-revived', [
'name' => $this->server->name,
]);
@@ -54,13 +54,13 @@ class Revived extends Notification implements ShouldQueue
public function toDiscord(): string
{
- $message = "✅ Server '{$this->server->name}' revived. All automations & integrations are turned on again!";
+ $message = "Coolify: Server '{$this->server->name}' revived. All automations & integrations are turned on again!";
return $message;
}
public function toTelegram(): array
{
return [
- "message" => "✅ Server '{$this->server->name}' revived. All automations & integrations are turned on again!"
+ "message" => "Coolify: Server '{$this->server->name}' revived. All automations & integrations are turned on again!"
];
}
}
diff --git a/app/Notifications/Server/Unreachable.php b/app/Notifications/Server/Unreachable.php
index 705988e31a..ae100b804a 100644
--- a/app/Notifications/Server/Unreachable.php
+++ b/app/Notifications/Server/Unreachable.php
@@ -43,7 +43,7 @@ class Unreachable extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("⛔ Server ({$this->server->name}) is unreachable after trying to connect to it 5 times");
+ $mail->subject("Coolify: Server ({$this->server->name}) is unreachable after trying to connect to it 5 times");
$mail->view('emails.server-lost-connection', [
'name' => $this->server->name,
]);
@@ -52,13 +52,13 @@ class Unreachable extends Notification implements ShouldQueue
public function toDiscord(): string
{
- $message = "⛔ Server '{$this->server->name}' is unreachable after trying to connect to it 5 times. All automations & integrations are turned off! Please check your server! IMPORTANT: We automatically try to revive your server. If your server is back online, we will automatically turn on all automations & integrations.";
+ $message = "Coolify: Server '{$this->server->name}' is unreachable after trying to connect to it 5 times. All automations & integrations are turned off! Please check your server! IMPORTANT: We automatically try to revive your server. If your server is back online, we will automatically turn on all automations & integrations.";
return $message;
}
public function toTelegram(): array
{
return [
- "message" => "⛔ Server '{$this->server->name}' is unreachable after trying to connect to it 5 times. All automations & integrations are turned off! Please check your server! IMPORTANT: We automatically try to revive your server. If your server is back online, we will automatically turn on all automations & integrations."
+ "message" => "Coolify: Server '{$this->server->name}' is unreachable after trying to connect to it 5 times. All automations & integrations are turned off! Please check your server! IMPORTANT: We automatically try to revive your server. If your server is back online, we will automatically turn on all automations & integrations."
];
}
}
diff --git a/app/Notifications/Test.php b/app/Notifications/Test.php
index 098a94920c..06e3adbaa8 100644
--- a/app/Notifications/Test.php
+++ b/app/Notifications/Test.php
@@ -24,14 +24,14 @@ class Test extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("Test Email");
+ $mail->subject("Coolify: Test Email");
$mail->view('emails.test');
return $mail;
}
public function toDiscord(): string
{
- $message = 'This is a test Discord notification from Coolify.';
+ $message = 'Coolify: This is a test Discord notification from Coolify.';
$message .= "\n\n";
$message .= '[Go to your dashboard](' . base_url() . ')';
return $message;
@@ -39,7 +39,7 @@ class Test extends Notification implements ShouldQueue
public function toTelegram(): array
{
return [
- "message" => 'This is a test Telegram notification from Coolify.',
+ "message" => 'Coolify: This is a test Telegram notification from Coolify.',
"buttons" => [
[
"text" => "Go to your dashboard",
diff --git a/app/Notifications/TransactionalEmails/InvitationLink.php b/app/Notifications/TransactionalEmails/InvitationLink.php
index ab7cfb1220..dd1275c2d1 100644
--- a/app/Notifications/TransactionalEmails/InvitationLink.php
+++ b/app/Notifications/TransactionalEmails/InvitationLink.php
@@ -30,7 +30,7 @@ class InvitationLink extends Notification implements ShouldQueue
$invitation_team = Team::find($invitation->team->id);
$mail = new MailMessage();
- $mail->subject('Invitation for ' . $invitation_team->name);
+ $mail->subject('Coolify: Invitation for ' . $invitation_team->name);
$mail->view('emails.invitation-link', [
'team' => $invitation_team->name,
'email' => $this->user->email,
diff --git a/app/Notifications/TransactionalEmails/ResetPassword.php b/app/Notifications/TransactionalEmails/ResetPassword.php
index 2a11051b3e..cde6190e2a 100644
--- a/app/Notifications/TransactionalEmails/ResetPassword.php
+++ b/app/Notifications/TransactionalEmails/ResetPassword.php
@@ -50,7 +50,7 @@ class ResetPassword extends Notification
protected function buildMailMessage($url)
{
$mail = new MailMessage();
- $mail->subject('Reset Password');
+ $mail->subject('Coolify: Reset Password');
$mail->view('emails.reset-password', ['url' => $url, 'count' => config('auth.passwords.' . config('auth.defaults.passwords') . '.expire')]);
return $mail;
}
diff --git a/app/Notifications/TransactionalEmails/Test.php b/app/Notifications/TransactionalEmails/Test.php
index 21cf874703..6a4e5533fc 100644
--- a/app/Notifications/TransactionalEmails/Test.php
+++ b/app/Notifications/TransactionalEmails/Test.php
@@ -25,7 +25,7 @@ class Test extends Notification implements ShouldQueue
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject('Test Email');
+ $mail->subject('Coolify: Test Email');
$mail->view('emails.test');
return $mail;
}
diff --git a/database/migrations/2023_10_10_100320_update_s3_storages_table.php b/database/migrations/2023_10_10_100320_update_s3_storages_table.php
new file mode 100644
index 0000000000..b9c482c829
--- /dev/null
+++ b/database/migrations/2023_10_10_100320_update_s3_storages_table.php
@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('s3_storages', function (Blueprint $table) {
+ $table->boolean('is_usable')->default(false);
+ $table->boolean('unusable_email_sent')->default(false);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('s3_storages', function (Blueprint $table) {
+ $table->dropColumn('is_usable');
+ $table->dropColumn('unusable_email_sent');
+ });
+ }
+};
diff --git a/resources/views/emails/s3-connection-error.blade.php b/resources/views/emails/s3-connection-error.blade.php
new file mode 100644
index 0000000000..68faa06081
--- /dev/null
+++ b/resources/views/emails/s3-connection-error.blade.php
@@ -0,0 +1,6 @@
+<x-emails.layout>
+ Connection could not be establised with one of your S3 Storage ({{ $name }}). Please fix it
+ [here]({{ $url }}).
+
+ {{ $reason }}
+</x-emails.layout>
diff --git a/resources/views/livewire/project/database/backup-edit.blade.php b/resources/views/livewire/project/database/backup-edit.blade.php
index 4450d209a3..412595958a 100644
--- a/resources/views/livewire/project/database/backup-edit.blade.php
+++ b/resources/views/livewire/project/database/backup-edit.blade.php
@@ -4,7 +4,9 @@
<x-forms.button type="submit">
Save
</x-forms.button>
- <livewire:project.database.backup-now :backup="$backup" />
+ @if (Str::of($status)->startsWith('running'))
+ <livewire:project.database.backup-now :backup="$backup" />
+ @endif
@if ($backup->database_id !== 0)
<x-forms.button isError wire:click="delete">Delete</x-forms.button>
@endif
diff --git a/resources/views/livewire/settings/backup.blade.php b/resources/views/livewire/settings/backup.blade.php
index f2bb18fbee..3b050bfb55 100644
--- a/resources/views/livewire/settings/backup.blade.php
+++ b/resources/views/livewire/settings/backup.blade.php
@@ -22,7 +22,7 @@
<x-forms.input type="password" label="Password" readonly id="database.postgres_password" />
</div>
</div>
- <livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" />
+ <livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" :status="data_get($database,'status')" />
@else
To configure automatic backup for your Coolify instance, you first need to add as a database resource
into Coolify.
diff --git a/resources/views/livewire/team/storage/form.blade.php b/resources/views/livewire/team/storage/form.blade.php
index 5c824e9845..5e7c6a7d87 100644
--- a/resources/views/livewire/team/storage/form.blade.php
+++ b/resources/views/livewire/team/storage/form.blade.php
@@ -10,12 +10,17 @@
<div class="pb-4">
<h2>Storage Details</h2>
<div>{{ $storage->name }}</div>
+ @if ($storage->is_usable)
+ <div> Usable </div>
+ @else
+ <div class="text-red-500"> Not Usable </div>
+ @endif
</div>
<x-forms.button type="submit">
Save
</x-forms.button>
<x-forms.button wire:click="test_s3_connection">
- Test Connection
+ Validate Connection
</x-forms.button>
<x-forms.button isError isModal modalId="deleteS3Storage">
Delete
diff --git a/resources/views/project/database/backups/executions.blade.php b/resources/views/project/database/backups/executions.blade.php
index afcd0c061b..26d4aabd04 100644
--- a/resources/views/project/database/backups/executions.blade.php
+++ b/resources/views/project/database/backups/executions.blade.php
@@ -12,7 +12,7 @@
</x-slot:modalSubmit>
</x-modal>
<div class="pt-6">
- <livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" />
+ <livewire:project.database.backup-edit :backup="$backup" :s3s="$s3s" :status="data_get($database,'status')" />
<h3 class="py-4">Executions</h3>
<livewire:project.database.backup-executions :backup="$backup" :executions="$executions" />
</div>