Refactor app:init command and update cleanup options
This commit is contained in:
parent
3d7295fec3
commit
7554de5993
@ -14,39 +14,41 @@
|
|||||||
|
|
||||||
class Init extends Command
|
class Init extends Command
|
||||||
{
|
{
|
||||||
protected $signature = 'app:init {--cleanup}';
|
protected $signature = 'app:init {--full-cleanup}';
|
||||||
protected $description = 'Cleanup instance related stuffs';
|
protected $description = 'Cleanup instance related stuffs';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$this->alive();
|
$this->alive();
|
||||||
$cleanup = $this->option('cleanup');
|
$init = $this->option('init');
|
||||||
if ($cleanup) {
|
if ($init) {
|
||||||
echo "Running cleanups...\n";
|
echo "Running init cleanups.\n";
|
||||||
$this->call('cleanup:stucked-resources');
|
|
||||||
// Required for falsely deleted coolify db
|
// Required for falsely deleted coolify db
|
||||||
$this->restore_coolify_db_backup();
|
$this->restore_coolify_db_backup();
|
||||||
|
$this->cleanup_in_progress_application_deployments();
|
||||||
// $this->cleanup_ssh();
|
$this->cleanup_stucked_helper_containers();
|
||||||
}
|
$this->call('cleanup:queue');
|
||||||
$this->cleanup_in_progress_application_deployments();
|
$this->call('cleanup:stucked-resources');
|
||||||
$this->cleanup_stucked_helper_containers();
|
try {
|
||||||
|
setup_dynamic_configuration();
|
||||||
try {
|
} catch (\Throwable $e) {
|
||||||
setup_dynamic_configuration();
|
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
|
||||||
} catch (\Throwable $e) {
|
|
||||||
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$settings = InstanceSettings::get();
|
|
||||||
if (!is_null(env('AUTOUPDATE', null))) {
|
|
||||||
if (env('AUTOUPDATE') == true) {
|
|
||||||
$settings->update(['is_auto_update_enabled' => true]);
|
|
||||||
} else {
|
|
||||||
$settings->update(['is_auto_update_enabled' => false]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$settings = InstanceSettings::get();
|
||||||
|
if (!is_null(env('AUTOUPDATE', null))) {
|
||||||
|
if (env('AUTOUPDATE') == true) {
|
||||||
|
$settings->update(['is_auto_update_enabled' => true]);
|
||||||
|
} else {
|
||||||
|
$settings->update(['is_auto_update_enabled' => false]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$this->call('cleanup:queue');
|
echo "Running cleanups.\n";
|
||||||
|
$this->cleanup_stucked_helper_containers();
|
||||||
|
$this->call('cleanup:stucked-resources');
|
||||||
}
|
}
|
||||||
private function restore_coolify_db_backup()
|
private function restore_coolify_db_backup()
|
||||||
{
|
{
|
||||||
@ -129,5 +131,4 @@ private function cleanup_in_progress_application_deployments()
|
|||||||
echo "Error: {$e->getMessage()}\n";
|
echo "Error: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#!/command/execlineb -P
|
#!/command/execlineb -P
|
||||||
s6-setuidgid webuser
|
s6-setuidgid webuser
|
||||||
php /var/www/html/artisan app:init --cleanup
|
php /var/www/html/artisan app:init --full-cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user