fix: make coolify-db backups unique dir
This commit is contained in:
@@ -18,6 +18,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class DatabaseBackupJob implements ShouldQueue
|
class DatabaseBackupJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -68,11 +69,13 @@ class DatabaseBackupJob implements ShouldQueue
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->container_name = $this->database->uuid;
|
$this->container_name = $this->database->uuid;
|
||||||
|
$this->backup_dir = backup_dir() . "/" . $this->container_name;
|
||||||
|
|
||||||
if ($this->database->name === 'coolify-db') {
|
if ($this->database->name === 'coolify-db') {
|
||||||
$this->container_name = "coolify-db";
|
$this->container_name = "coolify-db";
|
||||||
|
$ip = Str::slug($this->server->ip);
|
||||||
|
$this->backup_dir = backup_dir() . "/coolify-db-$ip";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->backup_dir = backup_dir() . "/" . $this->container_name;
|
|
||||||
$this->backup_file = "/dumpall-" . Carbon::now()->timestamp . ".sql";
|
$this->backup_file = "/dumpall-" . Carbon::now()->timestamp . ".sql";
|
||||||
$this->backup_location = $this->backup_dir . $this->backup_file;
|
$this->backup_location = $this->backup_dir . $this->backup_file;
|
||||||
|
|
||||||
@@ -95,6 +98,7 @@ class DatabaseBackupJob implements ShouldQueue
|
|||||||
private function backup_standalone_postgresql(): void
|
private function backup_standalone_postgresql(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
ray($this->backup_dir);
|
||||||
$commands[] = "mkdir -p " . $this->backup_dir;
|
$commands[] = "mkdir -p " . $this->backup_dir;
|
||||||
$commands[] = "docker exec $this->container_name pg_dumpall -U {$this->database->postgres_user} > $this->backup_location";
|
$commands[] = "docker exec $this->container_name pg_dumpall -U {$this->database->postgres_user} > $this->backup_location";
|
||||||
|
|
||||||
|
|||||||
@@ -130,10 +130,16 @@ function set_transanctional_email_settings(InstanceSettings|null $settings = nul
|
|||||||
function base_ip(): string
|
function base_ip(): string
|
||||||
{
|
{
|
||||||
if (is_dev()) {
|
if (is_dev()) {
|
||||||
return "http://localhost";
|
return "localhost";
|
||||||
}
|
}
|
||||||
$settings = InstanceSettings::get();
|
$settings = InstanceSettings::get();
|
||||||
return "http://$settings->public_ipv4";
|
if ($settings->public_ipv4) {
|
||||||
|
return "$settings->public_ipv4";
|
||||||
|
}
|
||||||
|
if ($settings->public_ipv6) {
|
||||||
|
return "$settings->public_ipv6";
|
||||||
|
}
|
||||||
|
return "localhost";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.19';
|
return '4.0.0-beta.20';
|
||||||
|
|||||||
Reference in New Issue
Block a user