Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Add cleanup option to app:init command

Andras Bacsai0dff57e69fea
diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php
index 4cf0f21bfb..862fb76257 100644
--- a/app/Console/Commands/Init.php
+++ b/app/Console/Commands/Init.php
@@ -30,6 +30,7 @@ class Init extends Command
$this->alive();
$cleanup = $this->option('cleanup');
if ($cleanup) {
+ echo "Running cleanup\n";
$this->cleanup_stucked_resources();
$this->cleanup_ssh();
}
@@ -101,14 +102,14 @@ class Init extends Command
ray('Application without environment', $application->name);
$application->delete();
}
- if (!data_get($application, 'destination.server')) {
- ray('Application without server', $application->name);
- $application->delete();
- }
if (!$application->destination()) {
ray('Application without destination', $application->name);
$application->delete();
}
+ if (!data_get($application, 'destination.server')) {
+ ray('Application without server', $application->name);
+ $application->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in application: {$e->getMessage()}\n";
@@ -120,14 +121,14 @@ class Init extends Command
ray('Postgresql without environment', $postgresql->name);
$postgresql->delete();
}
- if (!data_get($postgresql, 'destination.server')) {
- ray('Postgresql without server', $postgresql->name);
- $postgresql->delete();
- }
if (!$postgresql->destination()) {
ray('Postgresql without destination', $postgresql->name);
$postgresql->delete();
}
+ if (!data_get($postgresql, 'destination.server')) {
+ ray('Postgresql without server', $postgresql->name);
+ $postgresql->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in postgresql: {$e->getMessage()}\n";
@@ -139,14 +140,14 @@ class Init extends Command
ray('Redis without environment', $redis->name);
$redis->delete();
}
- if (!data_get($redis, 'destination.server')) {
- ray('Redis without server', $redis->name);
- $redis->delete();
- }
if (!$redis->destination()) {
ray('Redis without destination', $redis->name);
$redis->delete();
}
+ if (!data_get($redis, 'destination.server')) {
+ ray('Redis without server', $redis->name);
+ $redis->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in redis: {$e->getMessage()}\n";
@@ -159,14 +160,14 @@ class Init extends Command
ray('Mongodb without environment', $mongodb->name);
$mongodb->delete();
}
- if (!data_get($mongodb, 'destination.server')) {
- ray('Mongodb without server', $mongodb->name);
- $mongodb->delete();
- }
if (!$mongodb->destination()) {
ray('Mongodb without destination', $mongodb->name);
$mongodb->delete();
}
+ if (!data_get($mongodb, 'destination.server')) {
+ ray('Mongodb without server', $mongodb->name);
+ $mongodb->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in mongodb: {$e->getMessage()}\n";
@@ -179,14 +180,14 @@ class Init extends Command
ray('Mysql without environment', $mysql->name);
$mysql->delete();
}
- if (!data_get($mysql, 'destination.server')) {
- ray('Mysql without server', $mysql->name);
- $mysql->delete();
- }
if (!$mysql->destination()) {
ray('Mysql without destination', $mysql->name);
$mysql->delete();
}
+ if (!data_get($mysql, 'destination.server')) {
+ ray('Mysql without server', $mysql->name);
+ $mysql->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in mysql: {$e->getMessage()}\n";
@@ -199,14 +200,14 @@ class Init extends Command
ray('Mariadb without environment', $mariadb->name);
$mariadb->delete();
}
- if (!data_get($mariadb, 'destination.server')) {
- ray('Mariadb without server', $mariadb->name);
- $mariadb->delete();
- }
if (!$mariadb->destination()) {
ray('Mariadb without destination', $mariadb->name);
$mariadb->delete();
}
+ if (!data_get($mariadb, 'destination.server')) {
+ ray('Mariadb without server', $mariadb->name);
+ $mariadb->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in mariadb: {$e->getMessage()}\n";
@@ -219,14 +220,14 @@ class Init extends Command
ray('Service without environment', $service->name);
$service->delete();
}
- if (!data_get($service, 'server')) {
- ray('Service without server', $service->name);
- $service->delete();
- }
if (!$service->destination()) {
ray('Service without destination', $service->name);
$service->delete();
}
+ if (!data_get($service, 'server')) {
+ ray('Service without server', $service->name);
+ $service->delete();
+ }
}
} catch (\Throwable $e) {
echo "Error in service: {$e->getMessage()}\n";
diff --git a/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up
index 09595f7081..32492f6b7d 100644
--- a/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up
+++ b/docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-script/up
@@ -1,2 +1,2 @@
#!/command/execlineb -P
-php /var/www/html/artisan app:init
+php /var/www/html/artisan app:init --cleanup