feat: restart database

feat: public dbs stay public after restart
feat: patch database conf
This commit is contained in:
Andras Bacsai
2024-07-02 13:39:44 +02:00
parent c39d6dd407
commit 3c13f1ff61
12 changed files with 471 additions and 140 deletions

View File

@@ -178,9 +178,6 @@ function create_standalone_clickhouse($environment_id, $destination_uuid, ?array
return $database;
}
/**
* Delete file locally on the filesystem.
*/
function delete_backup_locally(?string $filename, Server $server): void
{
if (empty($filename)) {
@@ -188,3 +185,17 @@ function delete_backup_locally(?string $filename, Server $server): void
}
instant_remote_process(["rm -f \"{$filename}\""], $server, throwError: false);
}
function isPublicPortAlreadyUsed(Server $server, int $port, ?string $id = null): bool
{
if ($id) {
$foundDatabase = $server->databases()->where('public_port', $port)->where('is_public', true)->where('id', '!=', $id)->first();
} else {
$foundDatabase = $server->databases()->where('public_port', $port)->where('is_public', true)->first();
}
if ($foundDatabase) {
return true;
}
return false;
}