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.

Update database backup job and version number

Andras Bacsai8212bb99a1fb
diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php
index 94e9078340..257d786f84 100644
--- a/app/Jobs/DatabaseBackupJob.php
+++ b/app/Jobs/DatabaseBackupJob.php
@@ -36,6 +36,7 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
public StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|ServiceDatabase $database;
public ?string $container_name = null;
+ public ?string $directory_name = null;
public ?ScheduledDatabaseBackupExecution $backup_log = null;
public string $backup_status = 'failed';
public ?string $backup_location = null;
@@ -88,27 +89,33 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
$databaseType = $this->database->databaseType();
$serviceUuid = $this->database->service->uuid;
+ $serviceName = str($this->database->service->name)->slug();
if ($databaseType === 'standalone-postgresql') {
$this->container_name = "postgresql-$serviceUuid";
+ $this->directory_name = $serviceName . '-' . $this->container_name;
$commands[] = "docker exec $this->container_name env | grep POSTGRES_";
$envs = instant_remote_process($commands, $this->server);
$databasesToBackup = Str::of($envs)->after('POSTGRES_DB=')->before("\n")->value();
$this->database->postgres_user = Str::of($envs)->after('POSTGRES_USER=')->before("\n")->value();
} else if ($databaseType === 'standalone-mysql') {
$this->container_name = "mysql-$serviceUuid";
+ $this->directory_name = $serviceName . '-' . $this->container_name;
$commands[] = "docker exec $this->container_name env | grep MYSQL_";
$envs = instant_remote_process($commands, $this->server);
$databasesToBackup = Str::of($envs)->after('MYSQL_DATABASE=')->before("\n")->value();
$this->database->mysql_root_password = Str::of($envs)->after('MYSQL_ROOT_PASSWORD=')->before("\n")->value();
} else if ($databaseType === 'standalone-mariadb') {
$this->container_name = "mariadb-$serviceUuid";
+ $this->directory_name = $serviceName . '-' . $this->container_name;
$commands[] = "docker exec $this->container_name env | grep MARIADB_";
$envs = instant_remote_process($commands, $this->server);
$databasesToBackup = Str::of($envs)->after('MARIADB_DATABASE=')->before("\n")->value();
$this->database->mysql_root_password = Str::of($envs)->after('MARIADB_ROOT_PASSWORD=')->before("\n")->value();
}
} else {
+ $databaseName = str($this->database->name)->slug()->value();
$this->container_name = $this->database->uuid;
+ $this->directory_name = $databaseName . '-' . $this->container_name;
$databaseType = $this->database->type();
$databasesToBackup = data_get($this->backup, 'databases_to_backup');
}
@@ -147,11 +154,11 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted
return;
}
}
- $this->backup_dir = backup_dir() . "/databases/" . Str::of($this->team->name)->slug() . '-' . $this->team->id . '/' . $this->container_name;
+ $this->backup_dir = backup_dir() . "/databases/" . Str::of($this->team->name)->slug() . '-' . $this->team->id . '/' . $this->directory_name;
if ($this->database->name === 'coolify-db') {
$databasesToBackup = ['coolify'];
- $this->container_name = "coolify-db";
+ $this->directory_name = $this->container_name = "coolify-db";
$ip = Str::slug($this->server->ip);
$this->backup_dir = backup_dir() . "/coolify" . "/coolify-db-$ip";
}
diff --git a/config/sentry.php b/config/sentry.php
index e6e07d06bd..180d98f997 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.113',
+ 'release' => '4.0.0-beta.114',
// 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 ef861eb3a4..aee7423eaf 100644
--- a/config/version.php
+++ b/config/version.php
@@ -1,3 +1,3 @@
<?php
-return '4.0.0-beta.113';
+return '4.0.0-beta.114';
diff --git a/versions.json b/versions.json
index d2db97a80c..7dcd59a4f1 100644
--- a/versions.json
+++ b/versions.json
@@ -4,7 +4,7 @@
"version": "3.12.36"
},
"v4": {
- "version": "4.0.0-beta.113"
+ "version": "4.0.0-beta.114"
}
}
}