fix: make coolify-db backups unique dir
This commit is contained in:
parent
61facbb871
commit
3d432d025a
@ -18,6 +18,7 @@
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Throwable;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DatabaseBackupJob implements ShouldQueue
|
||||
{
|
||||
@ -68,11 +69,13 @@ public function handle(): void
|
||||
return;
|
||||
}
|
||||
$this->container_name = $this->database->uuid;
|
||||
$this->backup_dir = backup_dir() . "/" . $this->container_name;
|
||||
|
||||
if ($this->database->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_location = $this->backup_dir . $this->backup_file;
|
||||
|
||||
@ -95,6 +98,7 @@ public function handle(): void
|
||||
private function backup_standalone_postgresql(): void
|
||||
{
|
||||
try {
|
||||
ray($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";
|
||||
|
||||
|
@ -130,10 +130,16 @@ function set_transanctional_email_settings(InstanceSettings|null $settings = nul
|
||||
function base_ip(): string
|
||||
{
|
||||
if (is_dev()) {
|
||||
return "http://localhost";
|
||||
return "localhost";
|
||||
}
|
||||
$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
|
||||
|
||||
return '4.0.0-beta.19';
|
||||
return '4.0.0-beta.20';
|
||||
|
Loading…
Reference in New Issue
Block a user