update init script
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Models\Application;
|
|||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use App\Models\StandaloneMongodb;
|
use App\Models\StandaloneMongodb;
|
||||||
|
use App\Models\StandaloneMysql;
|
||||||
use App\Models\StandalonePostgresql;
|
use App\Models\StandalonePostgresql;
|
||||||
use App\Models\StandaloneRedis;
|
use App\Models\StandaloneRedis;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
@@ -22,10 +23,11 @@ class Init extends Command
|
|||||||
ray()->clearAll();
|
ray()->clearAll();
|
||||||
$this->cleanup_in_progress_application_deployments();
|
$this->cleanup_in_progress_application_deployments();
|
||||||
$this->cleanup_stucked_resources();
|
$this->cleanup_stucked_resources();
|
||||||
$this->cleanup_ssh();
|
// $this->cleanup_ssh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function cleanup_ssh() {
|
private function cleanup_ssh()
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$files = Storage::allFiles('ssh/keys');
|
$files = Storage::allFiles('ssh/keys');
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
@@ -53,11 +55,12 @@ class Init extends Command
|
|||||||
echo "Error: {$e->getMessage()}\n";
|
echo "Error: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private function cleanup_stucked_resources() {
|
private function cleanup_stucked_resources()
|
||||||
|
{
|
||||||
// Cleanup any resources that are not attached to any environment or destination or server
|
// Cleanup any resources that are not attached to any environment or destination or server
|
||||||
try {
|
try {
|
||||||
$applications = Application::all();
|
$applications = Application::all();
|
||||||
foreach($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
if (!$application->environment) {
|
if (!$application->environment) {
|
||||||
ray('Application without environment', $application->name);
|
ray('Application without environment', $application->name);
|
||||||
$application->delete();
|
$application->delete();
|
||||||
@@ -68,7 +71,7 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$postgresqls = StandalonePostgresql::all();
|
$postgresqls = StandalonePostgresql::all();
|
||||||
foreach($postgresqls as $postgresql) {
|
foreach ($postgresqls as $postgresql) {
|
||||||
if (!$postgresql->environment) {
|
if (!$postgresql->environment) {
|
||||||
ray('Postgresql without environment', $postgresql->name);
|
ray('Postgresql without environment', $postgresql->name);
|
||||||
$postgresql->delete();
|
$postgresql->delete();
|
||||||
@@ -79,7 +82,7 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$redis = StandaloneRedis::all();
|
$redis = StandaloneRedis::all();
|
||||||
foreach($redis as $redis) {
|
foreach ($redis as $redis) {
|
||||||
if (!$redis->environment) {
|
if (!$redis->environment) {
|
||||||
ray('Redis without environment', $redis->name);
|
ray('Redis without environment', $redis->name);
|
||||||
$redis->delete();
|
$redis->delete();
|
||||||
@@ -90,7 +93,7 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$mongodbs = StandaloneMongodb::all();
|
$mongodbs = StandaloneMongodb::all();
|
||||||
foreach($mongodbs as $mongodb) {
|
foreach ($mongodbs as $mongodb) {
|
||||||
if (!$mongodb->environment) {
|
if (!$mongodb->environment) {
|
||||||
ray('Mongodb without environment', $mongodb->name);
|
ray('Mongodb without environment', $mongodb->name);
|
||||||
$mongodb->delete();
|
$mongodb->delete();
|
||||||
@@ -100,8 +103,30 @@ class Init extends Command
|
|||||||
$mongodb->delete();
|
$mongodb->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$mysqls = StandaloneMysql::all();
|
||||||
|
foreach ($mysqls as $mysql) {
|
||||||
|
if (!$mysql->environment) {
|
||||||
|
ray('Mysql without environment', $mysql->name);
|
||||||
|
$mysql->delete();
|
||||||
|
}
|
||||||
|
if (!$mysql->destination()) {
|
||||||
|
ray('Mysql without destination', $mysql->name);
|
||||||
|
$mysql->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$mariadbs = StandaloneMysql::all();
|
||||||
|
foreach ($mariadbs as $mariadb) {
|
||||||
|
if (!$mariadb->environment) {
|
||||||
|
ray('Mariadb without environment', $mariadb->name);
|
||||||
|
$mariadb->delete();
|
||||||
|
}
|
||||||
|
if (!$mariadb->destination()) {
|
||||||
|
ray('Mariadb without destination', $mariadb->name);
|
||||||
|
$mariadb->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
$services = Service::all();
|
$services = Service::all();
|
||||||
foreach($services as $service) {
|
foreach ($services as $service) {
|
||||||
if (!$service->environment) {
|
if (!$service->environment) {
|
||||||
ray('Service without environment', $service->name);
|
ray('Service without environment', $service->name);
|
||||||
$service->delete();
|
$service->delete();
|
||||||
|
|||||||
@@ -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.102',
|
'release' => '4.0.0-beta.103',
|
||||||
// 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.102';
|
return '4.0.0-beta.103';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "3.12.36"
|
"version": "3.12.36"
|
||||||
},
|
},
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.102"
|
"version": "4.0.0-beta.103"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user