add debug logs
This commit is contained in:
@@ -26,6 +26,7 @@ class Init extends Command
|
|||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
echo "Starting handle()\n";
|
||||||
$this->optimize();
|
$this->optimize();
|
||||||
|
|
||||||
if (isCloud() && ! $this->option('force-cloud')) {
|
if (isCloud() && ! $this->option('force-cloud')) {
|
||||||
@@ -34,13 +35,17 @@ class Init extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Loading servers...\n";
|
||||||
$this->servers = Server::all();
|
$this->servers = Server::all();
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
|
echo "Running in cloud mode\n";
|
||||||
} else {
|
} else {
|
||||||
|
echo "Running in self-hosted mode\n";
|
||||||
$this->send_alive_signal();
|
$this->send_alive_signal();
|
||||||
get_public_ips();
|
get_public_ips();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Starting backward compatibility checks...\n";
|
||||||
// Backward compatibility
|
// Backward compatibility
|
||||||
$this->replace_slash_in_environment_name();
|
$this->replace_slash_in_environment_name();
|
||||||
$this->restore_coolify_db_backup();
|
$this->restore_coolify_db_backup();
|
||||||
@@ -48,25 +53,32 @@ class Init extends Command
|
|||||||
//
|
//
|
||||||
$this->update_traefik_labels();
|
$this->update_traefik_labels();
|
||||||
if (! isCloud() || $this->option('force-cloud')) {
|
if (! isCloud() || $this->option('force-cloud')) {
|
||||||
|
echo "Cleaning up unused networks...\n";
|
||||||
$this->cleanup_unused_network_from_coolify_proxy();
|
$this->cleanup_unused_network_from_coolify_proxy();
|
||||||
}
|
}
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
|
echo "Cleaning up unnecessary proxy configs...\n";
|
||||||
$this->cleanup_unnecessary_dynamic_proxy_configuration();
|
$this->cleanup_unnecessary_dynamic_proxy_configuration();
|
||||||
} else {
|
} else {
|
||||||
|
echo "Cleaning up in-progress deployments...\n";
|
||||||
$this->cleanup_in_progress_application_deployments();
|
$this->cleanup_in_progress_application_deployments();
|
||||||
}
|
}
|
||||||
|
echo "Running redis cleanup...\n";
|
||||||
$this->call('cleanup:redis');
|
$this->call('cleanup:redis');
|
||||||
|
|
||||||
|
echo "Running stucked resources cleanup...\n";
|
||||||
$this->call('cleanup:stucked-resources');
|
$this->call('cleanup:stucked-resources');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
echo "Pulling helper image...\n";
|
||||||
$this->pullHelperImage();
|
$this->pullHelperImage();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
//
|
echo "Error pulling helper image: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
try {
|
try {
|
||||||
|
echo "Pulling templates from CDN (cloud mode)...\n";
|
||||||
$this->pullTemplatesFromCDN();
|
$this->pullTemplatesFromCDN();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Could not pull templates from CDN: {$e->getMessage()}\n";
|
echo "Could not pull templates from CDN: {$e->getMessage()}\n";
|
||||||
@@ -75,36 +87,45 @@ class Init extends Command
|
|||||||
|
|
||||||
if (! isCloud()) {
|
if (! isCloud()) {
|
||||||
try {
|
try {
|
||||||
|
echo "Pulling templates from CDN (self-hosted mode)...\n";
|
||||||
$this->pullTemplatesFromCDN();
|
$this->pullTemplatesFromCDN();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Could not pull templates from CDN: {$e->getMessage()}\n";
|
echo "Could not pull templates from CDN: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
echo "Setting up localhost proxy config...\n";
|
||||||
$localhost = $this->servers->where('id', 0)->first();
|
$localhost = $this->servers->where('id', 0)->first();
|
||||||
$localhost->setupDynamicProxyConfiguration();
|
$localhost->setupDynamicProxyConfiguration();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
|
echo "Could not setup dynamic configuration: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
|
echo "Checking auto-update settings...\n";
|
||||||
$settings = instanceSettings();
|
$settings = instanceSettings();
|
||||||
if (! is_null(config('constants.coolify.autoupdate', null))) {
|
if (! is_null(config('constants.coolify.autoupdate', null))) {
|
||||||
if (config('constants.coolify.autoupdate') == true) {
|
if (config('constants.coolify.autoupdate') == true) {
|
||||||
|
echo "Enabling auto-update\n";
|
||||||
$settings->update(['is_auto_update_enabled' => true]);
|
$settings->update(['is_auto_update_enabled' => true]);
|
||||||
} else {
|
} else {
|
||||||
|
echo "Disabling auto-update\n";
|
||||||
$settings->update(['is_auto_update_enabled' => false]);
|
$settings->update(['is_auto_update_enabled' => false]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo "handle() complete\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
private function pullHelperImage()
|
private function pullHelperImage()
|
||||||
{
|
{
|
||||||
|
echo "Dispatching CheckHelperImageJob\n";
|
||||||
CheckHelperImageJob::dispatch();
|
CheckHelperImageJob::dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function pullTemplatesFromCDN()
|
private function pullTemplatesFromCDN()
|
||||||
{
|
{
|
||||||
|
echo 'Pulling templates from '.config('constants.services.official')."\n";
|
||||||
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
|
echo "Successfully pulled templates\n";
|
||||||
$services = $response->json();
|
$services = $response->json();
|
||||||
File::put(base_path('templates/service-templates.json'), json_encode($services));
|
File::put(base_path('templates/service-templates.json'), json_encode($services));
|
||||||
}
|
}
|
||||||
@@ -112,14 +133,20 @@ class Init extends Command
|
|||||||
|
|
||||||
private function optimize()
|
private function optimize()
|
||||||
{
|
{
|
||||||
|
echo "Running optimize:clear\n";
|
||||||
Artisan::call('optimize:clear');
|
Artisan::call('optimize:clear');
|
||||||
|
echo "Running optimize\n";
|
||||||
Artisan::call('optimize');
|
Artisan::call('optimize');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function update_user_emails()
|
private function update_user_emails()
|
||||||
{
|
{
|
||||||
|
echo "Starting user email updates...\n";
|
||||||
try {
|
try {
|
||||||
User::whereRaw('email ~ \'[A-Z]\'')->get()->each(fn (User $user) => $user->update(['email' => strtolower($user->email)]));
|
User::whereRaw('email ~ \'[A-Z]\'')->get()->each(function (User $user) {
|
||||||
|
echo "Converting email to lowercase: {$user->email}\n";
|
||||||
|
$user->update(['email' => strtolower($user->email)]);
|
||||||
|
});
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Error in updating user emails: {$e->getMessage()}\n";
|
echo "Error in updating user emails: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
@@ -127,8 +154,10 @@ class Init extends Command
|
|||||||
|
|
||||||
private function update_traefik_labels()
|
private function update_traefik_labels()
|
||||||
{
|
{
|
||||||
|
echo "Updating traefik labels...\n";
|
||||||
try {
|
try {
|
||||||
Server::where('proxy->type', 'TRAEFIK_V2')->update(['proxy->type' => 'TRAEFIK']);
|
Server::where('proxy->type', 'TRAEFIK_V2')->update(['proxy->type' => 'TRAEFIK']);
|
||||||
|
echo "Traefik labels updated successfully\n";
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Error in updating traefik labels: {$e->getMessage()}\n";
|
echo "Error in updating traefik labels: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
@@ -136,15 +165,21 @@ class Init extends Command
|
|||||||
|
|
||||||
private function cleanup_unnecessary_dynamic_proxy_configuration()
|
private function cleanup_unnecessary_dynamic_proxy_configuration()
|
||||||
{
|
{
|
||||||
|
echo "Starting cleanup of unnecessary proxy configs...\n";
|
||||||
foreach ($this->servers as $server) {
|
foreach ($this->servers as $server) {
|
||||||
try {
|
try {
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
|
echo "Server {$server->id} not functional, skipping\n";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($server->id === 0) {
|
if ($server->id === 0) {
|
||||||
|
echo "Skipping localhost server\n";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$file = $server->proxyPath().'/dynamic/coolify.yaml';
|
$file = $server->proxyPath().'/dynamic/coolify.yaml';
|
||||||
|
echo "Removing file: $file\n";
|
||||||
|
|
||||||
return instant_remote_process([
|
return instant_remote_process([
|
||||||
"rm -f $file",
|
"rm -f $file",
|
||||||
@@ -157,20 +192,28 @@ class Init extends Command
|
|||||||
|
|
||||||
private function cleanup_unused_network_from_coolify_proxy()
|
private function cleanup_unused_network_from_coolify_proxy()
|
||||||
{
|
{
|
||||||
|
echo "Starting cleanup of unused networks...\n";
|
||||||
foreach ($this->servers as $server) {
|
foreach ($this->servers as $server) {
|
||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
|
echo "Server {$server->id} not functional, skipping\n";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (! $server->isProxyShouldRun()) {
|
if (! $server->isProxyShouldRun()) {
|
||||||
|
echo "Proxy should not run on server {$server->id}, skipping\n";
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
echo "Collecting docker networks for server {$server->id}\n";
|
||||||
['networks' => $networks, 'allNetworks' => $allNetworks] = collectDockerNetworksByServer($server);
|
['networks' => $networks, 'allNetworks' => $allNetworks] = collectDockerNetworksByServer($server);
|
||||||
$removeNetworks = $allNetworks->diff($networks);
|
$removeNetworks = $allNetworks->diff($networks);
|
||||||
$commands = collect();
|
$commands = collect();
|
||||||
foreach ($removeNetworks as $network) {
|
foreach ($removeNetworks as $network) {
|
||||||
|
echo "Checking network: $network\n";
|
||||||
$out = instant_remote_process(["docker network inspect -f json $network | jq '.[].Containers | if . == {} then null else . end'"], $server, false);
|
$out = instant_remote_process(["docker network inspect -f json $network | jq '.[].Containers | if . == {} then null else . end'"], $server, false);
|
||||||
if (empty($out)) {
|
if (empty($out)) {
|
||||||
|
echo "Network $network is empty, marking for removal\n";
|
||||||
$commands->push("docker network disconnect $network coolify-proxy >/dev/null 2>&1 || true");
|
$commands->push("docker network disconnect $network coolify-proxy >/dev/null 2>&1 || true");
|
||||||
$commands->push("docker network rm $network >/dev/null 2>&1 || true");
|
$commands->push("docker network rm $network >/dev/null 2>&1 || true");
|
||||||
} else {
|
} else {
|
||||||
@@ -179,6 +222,7 @@ class Init extends Command
|
|||||||
// If only coolify-proxy itself is connected to that network (it should not be possible, but who knows)
|
// If only coolify-proxy itself is connected to that network (it should not be possible, but who knows)
|
||||||
$isCoolifyProxyItself = data_get($data->first(), 'Name') === 'coolify-proxy';
|
$isCoolifyProxyItself = data_get($data->first(), 'Name') === 'coolify-proxy';
|
||||||
if ($isCoolifyProxyItself) {
|
if ($isCoolifyProxyItself) {
|
||||||
|
echo "Network $network only has coolify-proxy, marking for removal\n";
|
||||||
$commands->push("docker network disconnect $network coolify-proxy >/dev/null 2>&1 || true");
|
$commands->push("docker network disconnect $network coolify-proxy >/dev/null 2>&1 || true");
|
||||||
$commands->push("docker network rm $network >/dev/null 2>&1 || true");
|
$commands->push("docker network rm $network >/dev/null 2>&1 || true");
|
||||||
}
|
}
|
||||||
@@ -186,6 +230,7 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($commands->isNotEmpty()) {
|
if ($commands->isNotEmpty()) {
|
||||||
|
echo "Executing network cleanup commands\n";
|
||||||
remote_process(command: $commands, type: ActivityTypes::INLINE->value, server: $server, ignore_errors: false);
|
remote_process(command: $commands, type: ActivityTypes::INLINE->value, server: $server, ignore_errors: false);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@@ -196,6 +241,7 @@ class Init extends Command
|
|||||||
|
|
||||||
private function restore_coolify_db_backup()
|
private function restore_coolify_db_backup()
|
||||||
{
|
{
|
||||||
|
echo "Checking if DB backup restore is needed...\n";
|
||||||
if (version_compare('4.0.0-beta.179', config('constants.coolify.version'), '<=')) {
|
if (version_compare('4.0.0-beta.179', config('constants.coolify.version'), '<=')) {
|
||||||
try {
|
try {
|
||||||
$database = StandalonePostgresql::withTrashed()->find(0);
|
$database = StandalonePostgresql::withTrashed()->find(0);
|
||||||
@@ -204,6 +250,7 @@ class Init extends Command
|
|||||||
$database->restore();
|
$database->restore();
|
||||||
$scheduledBackup = ScheduledDatabaseBackup::find(0);
|
$scheduledBackup = ScheduledDatabaseBackup::find(0);
|
||||||
if (! $scheduledBackup) {
|
if (! $scheduledBackup) {
|
||||||
|
echo "Creating scheduled backup\n";
|
||||||
ScheduledDatabaseBackup::create([
|
ScheduledDatabaseBackup::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
@@ -223,6 +270,7 @@ class Init extends Command
|
|||||||
|
|
||||||
private function send_alive_signal()
|
private function send_alive_signal()
|
||||||
{
|
{
|
||||||
|
echo "Sending alive signal...\n";
|
||||||
$id = config('app.id');
|
$id = config('app.id');
|
||||||
$version = config('constants.coolify.version');
|
$version = config('constants.coolify.version');
|
||||||
$settings = instanceSettings();
|
$settings = instanceSettings();
|
||||||
@@ -233,6 +281,7 @@ class Init extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
echo "Sending request to undead.coolify.io\n";
|
||||||
Http::get("https://undead.coolify.io/v4/alive?appId=$id&version=$version");
|
Http::get("https://undead.coolify.io/v4/alive?appId=$id&version=$version");
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Error in sending live signal: {$e->getMessage()}\n";
|
echo "Error in sending live signal: {$e->getMessage()}\n";
|
||||||
@@ -241,13 +290,18 @@ class Init extends Command
|
|||||||
|
|
||||||
private function cleanup_in_progress_application_deployments()
|
private function cleanup_in_progress_application_deployments()
|
||||||
{
|
{
|
||||||
|
echo "Starting cleanup of in-progress deployments...\n";
|
||||||
// Cleanup any failed deployments
|
// Cleanup any failed deployments
|
||||||
try {
|
try {
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
|
echo "Skipping cleanup in cloud mode\n";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
echo "Finding queued/in-progress deployments...\n";
|
||||||
$queued_inprogress_deployments = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS->value, ApplicationDeploymentStatus::QUEUED->value])->get();
|
$queued_inprogress_deployments = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS->value, ApplicationDeploymentStatus::QUEUED->value])->get();
|
||||||
foreach ($queued_inprogress_deployments as $deployment) {
|
foreach ($queued_inprogress_deployments as $deployment) {
|
||||||
|
echo "Marking deployment {$deployment->id} as failed\n";
|
||||||
$deployment->status = ApplicationDeploymentStatus::FAILED->value;
|
$deployment->status = ApplicationDeploymentStatus::FAILED->value;
|
||||||
$deployment->save();
|
$deployment->save();
|
||||||
}
|
}
|
||||||
@@ -258,10 +312,12 @@ class Init extends Command
|
|||||||
|
|
||||||
private function replace_slash_in_environment_name()
|
private function replace_slash_in_environment_name()
|
||||||
{
|
{
|
||||||
|
echo "Checking for slashes in environment names...\n";
|
||||||
if (version_compare('4.0.0-beta.298', config('constants.coolify.version'), '<=')) {
|
if (version_compare('4.0.0-beta.298', config('constants.coolify.version'), '<=')) {
|
||||||
$environments = Environment::all();
|
$environments = Environment::all();
|
||||||
foreach ($environments as $environment) {
|
foreach ($environments as $environment) {
|
||||||
if (str_contains($environment->name, '/')) {
|
if (str_contains($environment->name, '/')) {
|
||||||
|
echo "Replacing slashes in environment: {$environment->name}\n";
|
||||||
$environment->name = str_replace('/', '-', $environment->name);
|
$environment->name = str_replace('/', '-', $environment->name);
|
||||||
$environment->save();
|
$environment->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ class ProductionSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
|
echo "Starting ProductionSeeder...\n";
|
||||||
|
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
echo " Running in cloud mode.\n";
|
echo " Running in cloud mode.\n";
|
||||||
} else {
|
} else {
|
||||||
@@ -28,8 +30,11 @@ class ProductionSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fix for 4.0.0-beta.37
|
// Fix for 4.0.0-beta.37
|
||||||
|
echo "Checking for beta.37 fix...\n";
|
||||||
if (User::find(0) !== null && Team::find(0) !== null) {
|
if (User::find(0) !== null && Team::find(0) !== null) {
|
||||||
|
echo " Found User 0 and Team 0\n";
|
||||||
if (DB::table('team_user')->where('user_id', 0)->first() === null) {
|
if (DB::table('team_user')->where('user_id', 0)->first() === null) {
|
||||||
|
echo " Creating team_user relationship\n";
|
||||||
DB::table('team_user')->insert([
|
DB::table('team_user')->insert([
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
@@ -40,13 +45,17 @@ class ProductionSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Checking InstanceSettings...\n";
|
||||||
if (InstanceSettings::find(0) == null) {
|
if (InstanceSettings::find(0) == null) {
|
||||||
|
echo " Creating InstanceSettings\n";
|
||||||
InstanceSettings::create([
|
InstanceSettings::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Checking GithubApp...\n";
|
||||||
if (GithubApp::find(0) == null) {
|
if (GithubApp::find(0) == null) {
|
||||||
|
echo " Creating GithubApp\n";
|
||||||
GithubApp::create([
|
GithubApp::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'Public GitHub',
|
'name' => 'Public GitHub',
|
||||||
@@ -56,7 +65,10 @@ class ProductionSeeder extends Seeder
|
|||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Checking GitlabApp...\n";
|
||||||
if (GitlabApp::find(0) == null) {
|
if (GitlabApp::find(0) == null) {
|
||||||
|
echo " Creating GitlabApp\n";
|
||||||
GitlabApp::create([
|
GitlabApp::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'Public GitLab',
|
'name' => 'Public GitLab',
|
||||||
@@ -66,9 +78,12 @@ class ProductionSeeder extends Seeder
|
|||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Coolify host (localhost) as Server if it doesn't exist
|
// Add Coolify host (localhost) as Server if it doesn't exist
|
||||||
if (! isCloud()) {
|
if (! isCloud()) {
|
||||||
|
echo "Setting up localhost server...\n";
|
||||||
if (Server::find(0) == null) {
|
if (Server::find(0) == null) {
|
||||||
|
echo " Creating localhost server\n";
|
||||||
$server_details = [
|
$server_details = [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'localhost',
|
'name' => 'localhost',
|
||||||
@@ -87,12 +102,16 @@ class ProductionSeeder extends Seeder
|
|||||||
$server->settings->is_usable = true;
|
$server->settings->is_usable = true;
|
||||||
$server->settings->save();
|
$server->settings->save();
|
||||||
} else {
|
} else {
|
||||||
|
echo " Updating existing localhost server\n";
|
||||||
$server = Server::find(0);
|
$server = Server::find(0);
|
||||||
$server->settings->is_reachable = true;
|
$server->settings->is_reachable = true;
|
||||||
$server->settings->is_usable = true;
|
$server->settings->is_usable = true;
|
||||||
$server->settings->save();
|
$server->settings->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Checking StandaloneDocker...\n";
|
||||||
if (StandaloneDocker::find(0) == null) {
|
if (StandaloneDocker::find(0) == null) {
|
||||||
|
echo " Creating StandaloneDocker\n";
|
||||||
StandaloneDocker::create([
|
StandaloneDocker::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'localhost-coolify',
|
'name' => 'localhost-coolify',
|
||||||
@@ -103,14 +122,17 @@ class ProductionSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
|
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
|
||||||
|
echo "Setting up SSH keys for non-Windows environment...\n";
|
||||||
$coolify_key_name = '@host.docker.internal';
|
$coolify_key_name = '@host.docker.internal';
|
||||||
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
|
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
|
||||||
|
echo ' Found '.count($ssh_keys_directory)." SSH keys\n";
|
||||||
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
|
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
|
||||||
|
|
||||||
$server = Server::find(0);
|
$server = Server::find(0);
|
||||||
$found = $server->privateKey;
|
$found = $server->privateKey;
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
if ($coolify_key) {
|
if ($coolify_key) {
|
||||||
|
echo " Found Coolify SSH key\n";
|
||||||
$user = str($coolify_key)->before('@')->after('id.');
|
$user = str($coolify_key)->before('@')->after('id.');
|
||||||
$coolify_key = Storage::disk('ssh-keys')->get($coolify_key);
|
$coolify_key = Storage::disk('ssh-keys')->get($coolify_key);
|
||||||
PrivateKey::create([
|
PrivateKey::create([
|
||||||
@@ -129,7 +151,10 @@ class ProductionSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('constants.coolify.is_windows_docker_desktop')) {
|
if (config('constants.coolify.is_windows_docker_desktop')) {
|
||||||
|
echo "Setting up Windows Docker Desktop environment...\n";
|
||||||
|
echo " Creating/updating private key\n";
|
||||||
PrivateKey::updateOrCreate(
|
PrivateKey::updateOrCreate(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
@@ -149,6 +174,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
if (Server::find(0) == null) {
|
if (Server::find(0) == null) {
|
||||||
|
echo " Creating Windows localhost server\n";
|
||||||
$server_details = [
|
$server_details = [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'uuid' => 'coolify-testing-host',
|
'uuid' => 'coolify-testing-host',
|
||||||
@@ -168,12 +194,16 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
$server->settings->is_usable = true;
|
$server->settings->is_usable = true;
|
||||||
$server->settings->save();
|
$server->settings->save();
|
||||||
} else {
|
} else {
|
||||||
|
echo " Updating Windows localhost server\n";
|
||||||
$server = Server::find(0);
|
$server = Server::find(0);
|
||||||
$server->settings->is_reachable = true;
|
$server->settings->is_reachable = true;
|
||||||
$server->settings->is_usable = true;
|
$server->settings->is_usable = true;
|
||||||
$server->settings->save();
|
$server->settings->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Checking Windows StandaloneDocker...\n";
|
||||||
if (StandaloneDocker::find(0) == null) {
|
if (StandaloneDocker::find(0) == null) {
|
||||||
|
echo " Creating Windows StandaloneDocker\n";
|
||||||
StandaloneDocker::create([
|
StandaloneDocker::create([
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'name' => 'localhost-coolify',
|
'name' => 'localhost-coolify',
|
||||||
@@ -183,11 +213,19 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Getting public IPs...\n";
|
||||||
get_public_ips();
|
get_public_ips();
|
||||||
|
|
||||||
|
echo "Running additional seeders...\n";
|
||||||
|
echo " Running OauthSettingSeeder\n";
|
||||||
$this->call(OauthSettingSeeder::class);
|
$this->call(OauthSettingSeeder::class);
|
||||||
|
echo " Running PopulateSshKeysDirectorySeeder\n";
|
||||||
$this->call(PopulateSshKeysDirectorySeeder::class);
|
$this->call(PopulateSshKeysDirectorySeeder::class);
|
||||||
|
echo " Running SentinelSeeder\n";
|
||||||
$this->call(SentinelSeeder::class);
|
$this->call(SentinelSeeder::class);
|
||||||
// $this->call(RootUserSeeder::class);
|
echo " Running RootUserSeeder\n";
|
||||||
|
$this->call(RootUserSeeder::class);
|
||||||
|
|
||||||
|
echo "ProductionSeeder complete!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user