From c4dfd99a8c1de24f31e49aec509f9ad1a5e558dc Mon Sep 17 00:00:00 2001 From: iamEvan Date: Sun, 14 Apr 2024 21:31:55 +0100 Subject: [PATCH 01/21] init commit --- app/Livewire/Project/Database/Import.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.php index 74e41056a..11c6da314 100644 --- a/app/Livewire/Project/Database/Import.php +++ b/app/Livewire/Project/Database/Import.php @@ -27,6 +27,7 @@ class Import extends Component public string $postgresqlRestoreCommand = 'pg_restore -U $POSTGRES_USER -d $POSTGRES_DB'; public string $mysqlRestoreCommand = 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE'; public string $mariadbRestoreCommand = 'mariadb -u $MARIADB_USER -p$MARIADB_PASSWORD $MARIADB_DATABASE'; + public string $mongodbRestoreCommand = 'mongorestore --authenticationDatabase=admin --username $MONGO_INITDB_ROOT_USERNAME --password $MONGO_INITDB_ROOT_PASSWORD --uri mongodb://localhost:27017 --gzip'; public function getListeners() { @@ -62,8 +63,7 @@ class Import extends Component $this->resource->getMorphClass() == 'App\Models\StandaloneRedis' || $this->resource->getMorphClass() == 'App\Models\StandaloneKeydb' || $this->resource->getMorphClass() == 'App\Models\StandaloneDragonfly' || - $this->resource->getMorphClass() == 'App\Models\StandaloneClickhouse' || - $this->resource->getMorphClass() == 'App\Models\StandaloneMongodb' + $this->resource->getMorphClass() == 'App\Models\StandaloneClickhouse' ) { $this->unsupported = true; } @@ -101,6 +101,10 @@ class Import extends Component $this->importCommands[] = "docker exec {$this->container} sh -c '{$this->postgresqlRestoreCommand} {$tmpPath}'"; $this->importCommands[] = "rm {$tmpPath}"; break; + case 'App\Models\StandaloneMongodb': + $this->importCommands[] = "docker exec {$this->container} sh -c '{$this->mongodbRestoreCommand} {$tmpPath}'"; + $this->importCommands[] = "rm {$tmpPath}"; + break; } $this->importCommands[] = "docker exec {$this->container} sh -c 'rm {$tmpPath}'"; From 23de13b82c8aca6d2d6264e6f10337786f4b6bee Mon Sep 17 00:00:00 2001 From: iamEvan Date: Thu, 25 Apr 2024 22:44:46 +0100 Subject: [PATCH 02/21] mac dev docker-compose --- docker-compose-mac.dev.yml | 118 +++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docker-compose-mac.dev.yml diff --git a/docker-compose-mac.dev.yml b/docker-compose-mac.dev.yml new file mode 100644 index 000000000..ec1e9814f --- /dev/null +++ b/docker-compose-mac.dev.yml @@ -0,0 +1,118 @@ +version: "3.8" + +services: + coolify: + build: + context: . + dockerfile: ./docker/dev-ssu/Dockerfile + ports: + - "${APP_PORT:-8000}:80" + environment: + PUID: "${USERID:-1000}" + PGID: "${GROUPID:-1000}" + SSL_MODE: "off" + AUTORUN_LARAVEL_STORAGE_LINK: "false" + AUTORUN_LARAVEL_MIGRATION: "false" + PUSHER_HOST: "${PUSHER_HOST}" + PUSHER_PORT: "${PUSHER_PORT}" + PUSHER_SCHEME: "${PUSHER_SCHEME:-http}" + PUSHER_APP_ID: "${PUSHER_APP_ID:-coolify}" + PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" + PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" + volumes: + - .:/var/www/html/:cached + postgres: + pull_policy: always + ports: + - "${FORWARD_DB_PORT:-5432}:5432" + env_file: + - .env + environment: + POSTGRES_USER: "${DB_USERNAME:-coolify}" + POSTGRES_PASSWORD: "${DB_PASSWORD:-password}" + POSTGRES_DB: "${DB_DATABASE:-coolify}" + POSTGRES_HOST_AUTH_METHOD: "trust" + volumes: + # - /data/coolify/_volumes/database/:/var/lib/postgresql/data + - coolify-pg-data-dev:/var/lib/postgresql/data + redis: + pull_policy: always + ports: + - "${FORWARD_REDIS_PORT:-6379}:6379" + env_file: + - .env + volumes: + # - /data/coolify/_volumes/redis/:/data + - coolify-redis-data-dev:/data + soketi: + env_file: + - .env + ports: + - "${FORWARD_SOKETI_PORT:-6001}:6001" + environment: + SOKETI_DEBUG: "false" + SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}" + SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}" + SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" + vite: + image: node:20 + pull_policy: always + working_dir: /var/www/html + # environment: + # VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" + ports: + - "${VITE_PORT:-5173}:${VITE_PORT:-5173}" + volumes: + - .:/var/www/html:cached + command: sh -c "npm install && npm run dev" + networks: + - coolify + testing-host: + image: "ghcr.io/coollabsio/coolify-testing-host:latest" + pull_policy: always + init: true + container_name: coolify-testing-host + volumes: + - /:/host + - /var/run/docker.sock:/var/run/docker.sock + # - /data/coolify/:/data/coolify + - coolify-data-dev:/data/coolify + networks: + - coolify + mailpit: + image: "axllent/mailpit:latest" + pull_policy: always + container_name: coolify-mail + ports: + - "${FORWARD_MAILPIT_PORT:-1025}:1025" + - "${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025" + networks: + - coolify + minio: + image: minio/minio:latest + pull_policy: always + container_name: coolify-minio + command: server /data --console-address ":9001" + ports: + - "${FORWARD_MINIO_PORT:-9000}:9000" + - "${FORWARD_MINIO_PORT_CONSOLE:-9001}:9001" + environment: + MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY:-minioadmin}" + MINIO_SECRET_KEY: "${MINIO_SECRET_KEY:-minioadmin}" + volumes: + # - /data/coolify/_volumes/minio/:/data + - coolify-minio-data-dev:/data + networks: + - coolify + +volumes: + coolify-data-dev: + coolify-pg-data-dev: + coolify-redis-data-dev: + coolify-minio-data-dev: + + +networks: + coolify: + name: coolify + external: false From 3582cb3f46057278aa62ef5018b09efe91457106 Mon Sep 17 00:00:00 2001 From: iamEvan Date: Thu, 25 Apr 2024 22:44:55 +0100 Subject: [PATCH 03/21] fix mongodb imports --- app/Livewire/Project/Database/Import.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.php index 11c6da314..d435289fa 100644 --- a/app/Livewire/Project/Database/Import.php +++ b/app/Livewire/Project/Database/Import.php @@ -27,7 +27,7 @@ class Import extends Component public string $postgresqlRestoreCommand = 'pg_restore -U $POSTGRES_USER -d $POSTGRES_DB'; public string $mysqlRestoreCommand = 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE'; public string $mariadbRestoreCommand = 'mariadb -u $MARIADB_USER -p$MARIADB_PASSWORD $MARIADB_DATABASE'; - public string $mongodbRestoreCommand = 'mongorestore --authenticationDatabase=admin --username $MONGO_INITDB_ROOT_USERNAME --password $MONGO_INITDB_ROOT_PASSWORD --uri mongodb://localhost:27017 --gzip'; + public string $mongodbRestoreCommand = 'mongorestore --authenticationDatabase=admin --username $MONGO_INITDB_ROOT_USERNAME --password $MONGO_INITDB_ROOT_PASSWORD --uri mongodb://localhost:27017 --gzip --archive='; public function getListeners() { @@ -102,7 +102,7 @@ class Import extends Component $this->importCommands[] = "rm {$tmpPath}"; break; case 'App\Models\StandaloneMongodb': - $this->importCommands[] = "docker exec {$this->container} sh -c '{$this->mongodbRestoreCommand} {$tmpPath}'"; + $this->importCommands[] = "docker exec {$this->container} sh -c '{$this->mongodbRestoreCommand}{$tmpPath}'"; $this->importCommands[] = "rm {$tmpPath}"; break; } From 8551e6e74af94e4b3fb58f5d62d7a9a8af0e17a8 Mon Sep 17 00:00:00 2001 From: iamEvan Date: Thu, 25 Apr 2024 22:47:47 +0100 Subject: [PATCH 04/21] opps... wrong commit --- docker-compose-mac.dev.yml | 118 ------------------------------------- 1 file changed, 118 deletions(-) delete mode 100644 docker-compose-mac.dev.yml diff --git a/docker-compose-mac.dev.yml b/docker-compose-mac.dev.yml deleted file mode 100644 index ec1e9814f..000000000 --- a/docker-compose-mac.dev.yml +++ /dev/null @@ -1,118 +0,0 @@ -version: "3.8" - -services: - coolify: - build: - context: . - dockerfile: ./docker/dev-ssu/Dockerfile - ports: - - "${APP_PORT:-8000}:80" - environment: - PUID: "${USERID:-1000}" - PGID: "${GROUPID:-1000}" - SSL_MODE: "off" - AUTORUN_LARAVEL_STORAGE_LINK: "false" - AUTORUN_LARAVEL_MIGRATION: "false" - PUSHER_HOST: "${PUSHER_HOST}" - PUSHER_PORT: "${PUSHER_PORT}" - PUSHER_SCHEME: "${PUSHER_SCHEME:-http}" - PUSHER_APP_ID: "${PUSHER_APP_ID:-coolify}" - PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" - PUSHER_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" - volumes: - - .:/var/www/html/:cached - postgres: - pull_policy: always - ports: - - "${FORWARD_DB_PORT:-5432}:5432" - env_file: - - .env - environment: - POSTGRES_USER: "${DB_USERNAME:-coolify}" - POSTGRES_PASSWORD: "${DB_PASSWORD:-password}" - POSTGRES_DB: "${DB_DATABASE:-coolify}" - POSTGRES_HOST_AUTH_METHOD: "trust" - volumes: - # - /data/coolify/_volumes/database/:/var/lib/postgresql/data - - coolify-pg-data-dev:/var/lib/postgresql/data - redis: - pull_policy: always - ports: - - "${FORWARD_REDIS_PORT:-6379}:6379" - env_file: - - .env - volumes: - # - /data/coolify/_volumes/redis/:/data - - coolify-redis-data-dev:/data - soketi: - env_file: - - .env - ports: - - "${FORWARD_SOKETI_PORT:-6001}:6001" - environment: - SOKETI_DEBUG: "false" - SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-coolify}" - SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-coolify}" - SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-coolify}" - vite: - image: node:20 - pull_policy: always - working_dir: /var/www/html - # environment: - # VITE_PUSHER_APP_KEY: "${PUSHER_APP_KEY:-coolify}" - ports: - - "${VITE_PORT:-5173}:${VITE_PORT:-5173}" - volumes: - - .:/var/www/html:cached - command: sh -c "npm install && npm run dev" - networks: - - coolify - testing-host: - image: "ghcr.io/coollabsio/coolify-testing-host:latest" - pull_policy: always - init: true - container_name: coolify-testing-host - volumes: - - /:/host - - /var/run/docker.sock:/var/run/docker.sock - # - /data/coolify/:/data/coolify - - coolify-data-dev:/data/coolify - networks: - - coolify - mailpit: - image: "axllent/mailpit:latest" - pull_policy: always - container_name: coolify-mail - ports: - - "${FORWARD_MAILPIT_PORT:-1025}:1025" - - "${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025" - networks: - - coolify - minio: - image: minio/minio:latest - pull_policy: always - container_name: coolify-minio - command: server /data --console-address ":9001" - ports: - - "${FORWARD_MINIO_PORT:-9000}:9000" - - "${FORWARD_MINIO_PORT_CONSOLE:-9001}:9001" - environment: - MINIO_ACCESS_KEY: "${MINIO_ACCESS_KEY:-minioadmin}" - MINIO_SECRET_KEY: "${MINIO_SECRET_KEY:-minioadmin}" - volumes: - # - /data/coolify/_volumes/minio/:/data - - coolify-minio-data-dev:/data - networks: - - coolify - -volumes: - coolify-data-dev: - coolify-pg-data-dev: - coolify-redis-data-dev: - coolify-minio-data-dev: - - -networks: - coolify: - name: coolify - external: false From ae1222268758447661f0138f9baeba152c692448 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 29 Apr 2024 09:30:18 +0200 Subject: [PATCH 05/21] Update version to 4.0.0-beta.271 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index e833ffdb2..15711e651 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.270', + 'release' => '4.0.0-beta.271', // 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 e85b7f5a5..ebbaefd2a 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Mon, 29 Apr 2024 09:38:45 +0200 Subject: [PATCH 06/21] fix: backups --- app/Jobs/DatabaseBackupJob.php | 5 +- app/Jobs/SendMessageToTelegramJob.php | 2 +- .../Project/Database/Backup/Execution.php | 5 -- .../Project/Database/BackupExecutions.php | 8 +- app/Models/StandaloneClickhouse.php | 3 - app/Models/StandaloneDragonfly.php | 3 - app/Models/StandaloneKeydb.php | 3 - app/Models/StandaloneMariadb.php | 3 - app/Models/StandaloneMongodb.php | 3 - app/Models/StandaloneMysql.php | 3 - app/Models/StandalonePostgresql.php | 3 - app/Models/StandaloneRedis.php | 3 - app/Notifications/Database/BackupFailed.php | 13 ++- app/Notifications/Database/BackupSuccess.php | 8 +- .../database/backup-executions.blade.php | 84 ++++++++++--------- .../database/backup/execution.blade.php | 4 - .../database/scheduled-backups.blade.php | 14 ++-- 17 files changed, 71 insertions(+), 96 deletions(-) diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index befeffed0..a09ebeada 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -289,7 +289,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted if ($this->backup->save_s3) { $this->upload_to_s3(); } - $this->team?->notify(new BackupSuccess($this->backup, $this->database)); + $this->team?->notify(new BackupSuccess($this->backup, $this->database, $database)); $this->backup_log->update([ 'status' => 'success', 'message' => $this->backup_output, @@ -305,8 +305,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted ]); } send_internal_notification('DatabaseBackupJob failed with: ' . $e->getMessage()); - $this->team?->notify(new BackupFailed($this->backup, $this->database, $this->backup_output)); - throw $e; + $this->team?->notify(new BackupFailed($this->backup, $this->database, $this->backup_output, $database)); } } } catch (\Throwable $e) { diff --git a/app/Jobs/SendMessageToTelegramJob.php b/app/Jobs/SendMessageToTelegramJob.php index 4785da669..4191b02fe 100644 --- a/app/Jobs/SendMessageToTelegramJob.php +++ b/app/Jobs/SendMessageToTelegramJob.php @@ -57,7 +57,7 @@ class SendMessageToTelegramJob implements ShouldQueue, ShouldBeEncrypted } } $payload = [ - 'parse_mode' => 'markdown', + // 'parse_mode' => 'markdown', 'reply_markup' => json_encode([ 'inline_keyboard' => [ [...$inlineButtons], diff --git a/app/Livewire/Project/Database/Backup/Execution.php b/app/Livewire/Project/Database/Backup/Execution.php index 1f790d643..000b6fb2b 100644 --- a/app/Livewire/Project/Database/Backup/Execution.php +++ b/app/Livewire/Project/Database/Backup/Execution.php @@ -35,11 +35,6 @@ class Execution extends Component $this->executions = $executions; $this->s3s = currentTeam()->s3s; } - public function cleanupFailed() - { - $this->backup->executions()->where('status', 'failed')->delete(); - $this->dispatch('refreshBackupExecutions'); - } public function render() { return view('livewire.project.database.backup.execution'); diff --git a/app/Livewire/Project/Database/BackupExecutions.php b/app/Livewire/Project/Database/BackupExecutions.php index b127a685c..a34d849f2 100644 --- a/app/Livewire/Project/Database/BackupExecutions.php +++ b/app/Livewire/Project/Database/BackupExecutions.php @@ -2,9 +2,7 @@ namespace App\Livewire\Project\Database; -use Illuminate\Support\Facades\Storage; use Livewire\Component; -use Symfony\Component\HttpFoundation\StreamedResponse; class BackupExecutions extends Component { @@ -16,11 +14,15 @@ class BackupExecutions extends Component $userId = auth()->user()->id; return [ "echo-private:team.{$userId},BackupCreated" => 'refreshBackupExecutions', - "refreshBackupExecutions", "deleteBackup" ]; } + public function cleanupFailed() + { + $this->backup->executions()->where('status', 'failed')->delete(); + $this->refreshBackupExecutions(); + } public function deleteBackup($exeuctionId) { $execution = $this->backup->executions()->where('id', $exeuctionId)->first(); diff --git a/app/Models/StandaloneClickhouse.php b/app/Models/StandaloneClickhouse.php index 3746a32f5..2197d51df 100644 --- a/app/Models/StandaloneClickhouse.php +++ b/app/Models/StandaloneClickhouse.php @@ -207,7 +207,4 @@ class StandaloneClickhouse extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return $this->clickhouse_db; - } } diff --git a/app/Models/StandaloneDragonfly.php b/app/Models/StandaloneDragonfly.php index adc1ea6cc..7b18666b8 100644 --- a/app/Models/StandaloneDragonfly.php +++ b/app/Models/StandaloneDragonfly.php @@ -207,7 +207,4 @@ class StandaloneDragonfly extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return '0'; - } } diff --git a/app/Models/StandaloneKeydb.php b/app/Models/StandaloneKeydb.php index ff91322a0..c2c1b98da 100644 --- a/app/Models/StandaloneKeydb.php +++ b/app/Models/StandaloneKeydb.php @@ -208,7 +208,4 @@ class StandaloneKeydb extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return '0'; - } } diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.php index 37d39f882..5e18bbfde 100644 --- a/app/Models/StandaloneMariadb.php +++ b/app/Models/StandaloneMariadb.php @@ -208,7 +208,4 @@ class StandaloneMariadb extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return $this->mariadb_database; - } } diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.php index 30414e26b..8e4d327a3 100644 --- a/app/Models/StandaloneMongodb.php +++ b/app/Models/StandaloneMongodb.php @@ -223,7 +223,4 @@ class StandaloneMongodb extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return null; - } } diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.php index 53e9b6f22..eede451d7 100644 --- a/app/Models/StandaloneMysql.php +++ b/app/Models/StandaloneMysql.php @@ -209,7 +209,4 @@ class StandaloneMysql extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return $this->mysql_database; - } } diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.php index 6435c49de..cf449a815 100644 --- a/app/Models/StandalonePostgresql.php +++ b/app/Models/StandalonePostgresql.php @@ -208,7 +208,4 @@ class StandalonePostgresql extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return $this->postgres_db; - } } diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php index de18c8c07..da4701df9 100644 --- a/app/Models/StandaloneRedis.php +++ b/app/Models/StandaloneRedis.php @@ -204,7 +204,4 @@ class StandaloneRedis extends BaseModel { return $this->morphMany(ScheduledDatabaseBackup::class, 'database'); } - public function database_name() { - return '0'; - } } diff --git a/app/Notifications/Database/BackupFailed.php b/app/Notifications/Database/BackupFailed.php index 67fd27589..7cad486b3 100644 --- a/app/Notifications/Database/BackupFailed.php +++ b/app/Notifications/Database/BackupFailed.php @@ -15,21 +15,20 @@ class BackupFailed extends Notification implements ShouldQueue { use Queueable; - public $tries = 1; + public $backoff = 10; + public $tries = 2; public string $name; - public ?string $database_name = null; public string $frequency; - public function __construct(ScheduledDatabaseBackup $backup, public $database, public $output) + public function __construct(ScheduledDatabaseBackup $backup, public $database, public $output, public $database_name) { $this->name = $database->name; - $this->database_name = $database->database_name(); $this->frequency = $backup->frequency; } public function via(object $notifiable): array { - return [DiscordChannel::class, TelegramChannel::class, MailChannel::class]; + return setNotificationChannels($notifiable, 'database_backups'); } public function toMail(): MailMessage @@ -47,11 +46,11 @@ class BackupFailed extends Notification implements ShouldQueue public function toDiscord(): string { - return "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}"; + return "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was FAILED.\n\nReason:\n{$this->output}"; } public function toTelegram(): array { - $message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was FAILED.\n\nReason: {$this->output}"; + $message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was FAILED.\n\nReason:\n{$this->output}"; return [ "message" => $message, ]; diff --git a/app/Notifications/Database/BackupSuccess.php b/app/Notifications/Database/BackupSuccess.php index d69a31f46..c43a12276 100644 --- a/app/Notifications/Database/BackupSuccess.php +++ b/app/Notifications/Database/BackupSuccess.php @@ -12,15 +12,14 @@ class BackupSuccess extends Notification implements ShouldQueue { use Queueable; - public $tries = 1; + public $backoff = 10; + public $tries = 3; public string $name; - public ?string $database_name = null; public string $frequency; - public function __construct(ScheduledDatabaseBackup $backup, public $database) + public function __construct(ScheduledDatabaseBackup $backup, public $database, public $database_name) { $this->name = $database->name; - $this->database_name = $database->database_name(); $this->frequency = $backup->frequency; } @@ -48,6 +47,7 @@ class BackupSuccess extends Notification implements ShouldQueue public function toTelegram(): array { $message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was successful."; + ray($message); return [ "message" => $message, ]; diff --git a/resources/views/livewire/project/database/backup-executions.blade.php b/resources/views/livewire/project/database/backup-executions.blade.php index ae9428923..34e2b965d 100644 --- a/resources/views/livewire/project/database/backup-executions.blade.php +++ b/resources/views/livewire/project/database/backup-executions.blade.php @@ -1,43 +1,51 @@ -
- @forelse($executions as $execution) -
data_get($execution, 'status') === 'success', - 'border-red-500' => data_get($execution, 'status') === 'failed', - ])> - @if (data_get($execution, 'status') === 'running') -
- -
- @endif -
Database: {{ data_get($execution, 'database_name', 'N/A') }}
-
Status: {{ data_get($execution, 'status') }}
-
Started At: {{ data_get($execution, 'created_at') }}
- @if (data_get($execution, 'message')) -
Message: {{ data_get($execution, 'message') }}
- @endif -
Size: {{ data_get($execution, 'size') }} B / {{ round((int) data_get($execution, 'size') / 1024, 2) }} - kB / {{ round((int) data_get($execution, 'size') / 1024 / 1024, 3) }} MB -
-
Location: {{ data_get($execution, 'filename', 'N/A') }}
-
-
- @if (data_get($execution, 'status') === 'success') - Download +
+
+

Executions

+ Cleanup Failed Backups +
+
+ @forelse($executions as $execution) + data_get($execution, 'status') === 'success', + 'border-red-500' => data_get($execution, 'status') === 'failed', + ])> + @if (data_get($execution, 'status') === 'running') +
+ +
@endif - - - Delete - - This will delete this backup. It is not reversible.
Please think again. -
-
- +
Database: {{ data_get($execution, 'database_name', 'N/A') }}
+
Status: {{ data_get($execution, 'status') }}
+
Started At: {{ data_get($execution, 'created_at') }}
+ @if (data_get($execution, 'message')) +
Message: {{ data_get($execution, 'message') }}
+ @endif +
Size: {{ data_get($execution, 'size') }} B / + {{ round((int) data_get($execution, 'size') / 1024, 2) }} + kB / {{ round((int) data_get($execution, 'size') / 1024 / 1024, 3) }} MB +
+
Location: {{ data_get($execution, 'filename', 'N/A') }}
+
+
+ @if (data_get($execution, 'status') === 'success') + Download + @endif + + + Delete + + This will delete this backup. It is not reversible.
Please think again. +
+
+ - @empty -
No executions found.
- @endforelse + @empty +
No executions found.
+ @endforelse +