Add coolify database and handle exceptions
This commit is contained in:
parent
90ad46b7c5
commit
5e36c37838
@ -41,35 +41,39 @@ class Backup extends Component
|
|||||||
}
|
}
|
||||||
public function add_coolify_database()
|
public function add_coolify_database()
|
||||||
{
|
{
|
||||||
$server = Server::find(0);
|
try {
|
||||||
$out = instant_remote_process(['docker inspect coolify-db'], $server);
|
$server = Server::findOrFail(0);
|
||||||
$envs = format_docker_envs_to_json($out);
|
$out = instant_remote_process(['docker inspect coolify-db'], $server);
|
||||||
$postgres_password = $envs['POSTGRES_PASSWORD'];
|
$envs = format_docker_envs_to_json($out);
|
||||||
$postgres_user = $envs['POSTGRES_USER'];
|
$postgres_password = $envs['POSTGRES_PASSWORD'];
|
||||||
$postgres_db = $envs['POSTGRES_DB'];
|
$postgres_user = $envs['POSTGRES_USER'];
|
||||||
$this->database = StandalonePostgresql::create([
|
$postgres_db = $envs['POSTGRES_DB'];
|
||||||
'id' => 0,
|
$this->database = StandalonePostgresql::create([
|
||||||
'name' => 'coolify-db',
|
'id' => 0,
|
||||||
'description' => 'Coolify database',
|
'name' => 'coolify-db',
|
||||||
'postgres_user' => $postgres_user,
|
'description' => 'Coolify database',
|
||||||
'postgres_password' => $postgres_password,
|
'postgres_user' => $postgres_user,
|
||||||
'postgres_db' => $postgres_db,
|
'postgres_password' => $postgres_password,
|
||||||
'status' => 'running',
|
'postgres_db' => $postgres_db,
|
||||||
'destination_type' => 'App\Models\StandaloneDocker',
|
'status' => 'running',
|
||||||
'destination_id' => 0,
|
'destination_type' => 'App\Models\StandaloneDocker',
|
||||||
]);
|
'destination_id' => 0,
|
||||||
$this->backup = ScheduledDatabaseBackup::create([
|
]);
|
||||||
'id' => 0,
|
$this->backup = ScheduledDatabaseBackup::create([
|
||||||
'enabled' => true,
|
'id' => 0,
|
||||||
'save_s3' => false,
|
'enabled' => true,
|
||||||
'frequency' => '0 0 * * *',
|
'save_s3' => false,
|
||||||
'database_id' => $this->database->id,
|
'frequency' => '0 0 * * *',
|
||||||
'database_type' => 'App\Models\StandalonePostgresql',
|
'database_id' => $this->database->id,
|
||||||
'team_id' => currentTeam()->id,
|
'database_type' => 'App\Models\StandalonePostgresql',
|
||||||
]);
|
'team_id' => currentTeam()->id,
|
||||||
$this->database->refresh();
|
]);
|
||||||
$this->backup->refresh();
|
$this->database->refresh();
|
||||||
$this->s3s = S3Storage::whereTeamId(0)->get();
|
$this->backup->refresh();
|
||||||
|
$this->s3s = S3Storage::whereTeamId(0)->get();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return handleError($e, $this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function backup_now()
|
public function backup_now()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user