commit
6a73a00a1f
@ -7,6 +7,7 @@ use App\Jobs\CleanupHelperContainersJob;
|
|||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\InstanceSettings;
|
use App\Models\InstanceSettings;
|
||||||
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use App\Models\ServiceApplication;
|
use App\Models\ServiceApplication;
|
||||||
@ -31,6 +32,9 @@ class Init extends Command
|
|||||||
if ($cleanup) {
|
if ($cleanup) {
|
||||||
echo "Running cleanup\n";
|
echo "Running cleanup\n";
|
||||||
$this->cleanup_stucked_resources();
|
$this->cleanup_stucked_resources();
|
||||||
|
// Required for falsely deleted coolify db
|
||||||
|
$this->restore_coolify_db_backup();
|
||||||
|
|
||||||
// $this->cleanup_ssh();
|
// $this->cleanup_ssh();
|
||||||
}
|
}
|
||||||
$this->cleanup_in_progress_application_deployments();
|
$this->cleanup_in_progress_application_deployments();
|
||||||
@ -51,6 +55,30 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private function restore_coolify_db_backup() {
|
||||||
|
try {
|
||||||
|
$database = StandalonePostgresql::withTrashed()->find(0);
|
||||||
|
if ($database && $database->trashed()) {
|
||||||
|
echo "Restoring coolify db backup\n";
|
||||||
|
$database->restore();
|
||||||
|
$scheduledBackup = ScheduledDatabaseBackup::find(0);
|
||||||
|
if (!$scheduledBackup) {
|
||||||
|
ScheduledDatabaseBackup::create([
|
||||||
|
'id' => 0,
|
||||||
|
'enabled' => true,
|
||||||
|
'save_s3' => false,
|
||||||
|
'frequency' => '0 0 * * *',
|
||||||
|
'database_id' => $database->id,
|
||||||
|
'database_type' => 'App\Models\StandalonePostgresql',
|
||||||
|
'team_id' => 0,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch(\Throwable $e) {
|
||||||
|
echo "Error in restoring coolify db backup: {$e->getMessage()}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
private function cleanup_stucked_helper_containers()
|
private function cleanup_stucked_helper_containers()
|
||||||
{
|
{
|
||||||
$servers = Server::all();
|
$servers = Server::all();
|
||||||
@ -134,7 +162,7 @@ class Init extends Command
|
|||||||
echo "Error in application: {$e->getMessage()}\n";
|
echo "Error in application: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$postgresqls = StandalonePostgresql::all();
|
$postgresqls = StandalonePostgresql::all()->where('id', '!=', 0);
|
||||||
foreach ($postgresqls as $postgresql) {
|
foreach ($postgresqls as $postgresql) {
|
||||||
if (!data_get($postgresql, 'environment')) {
|
if (!data_get($postgresql, 'environment')) {
|
||||||
echo 'Postgresql without environment: ' . $postgresql->name . ' soft deleting\n';
|
echo 'Postgresql without environment: ' . $postgresql->name . ' soft deleting\n';
|
||||||
|
@ -7,7 +7,7 @@ return [
|
|||||||
|
|
||||||
// The release version of your application
|
// The release version of your application
|
||||||
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
||||||
'release' => '4.0.0-beta.173',
|
'release' => '4.0.0-beta.174',
|
||||||
// When left empty or `null` the Laravel environment will be used
|
// When left empty or `null` the Laravel environment will be used
|
||||||
'environment' => config('app.env'),
|
'environment' => config('app.env'),
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.173';
|
return '4.0.0-beta.174';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"version": "3.12.36"
|
"version": "3.12.36"
|
||||||
},
|
},
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.173"
|
"version": "4.0.0-beta.174"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user