Merge pull request #4854 from coollabsio/next

fix new self-hosted installations
This commit is contained in:
Andras Bacsai
2025-01-17 14:01:40 +01:00
committed by GitHub
3 changed files with 113 additions and 109 deletions

View File

@@ -35,8 +35,7 @@ class Init extends Command
} }
$this->servers = Server::all(); $this->servers = Server::all();
if (isCloud()) { if (! isCloud()) {
} else {
$this->send_alive_signal(); $this->send_alive_signal();
get_public_ips(); get_public_ips();
} }
@@ -88,8 +87,10 @@ class Init extends Command
$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]);
} }
} }
@@ -119,7 +120,9 @@ class Init extends Command
private function update_user_emails() private function update_user_emails()
{ {
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) {
$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";
} }
@@ -200,7 +203,6 @@ class Init extends Command
try { try {
$database = StandalonePostgresql::withTrashed()->find(0); $database = StandalonePostgresql::withTrashed()->find(0);
if ($database && $database->trashed()) { if ($database && $database->trashed()) {
echo "Restoring coolify db backup\n";
$database->restore(); $database->restore();
$scheduledBackup = ScheduledDatabaseBackup::find(0); $scheduledBackup = ScheduledDatabaseBackup::find(0);
if (! $scheduledBackup) { if (! $scheduledBackup) {

146
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "83823b6e6da5f7d476556d5c95620f5b", "content-hash": "9c1a0833be38d1f058f216dcaa522077",
"packages": [ "packages": [
{ {
"name": "3sidedcube/laravel-redoc", "name": "3sidedcube/laravel-redoc",
@@ -928,16 +928,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.336.14", "version": "3.337.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "dc9ac0ab313bbfc4e41635ce6d6083f28d202bf0" "reference": "fa70febad922e9868c83bfe03c6d078fc2633e17"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/dc9ac0ab313bbfc4e41635ce6d6083f28d202bf0", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fa70febad922e9868c83bfe03c6d078fc2633e17",
"reference": "dc9ac0ab313bbfc4e41635ce6d6083f28d202bf0", "reference": "fa70febad922e9868c83bfe03c6d078fc2633e17",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1020,9 +1020,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.336.14" "source": "https://github.com/aws/aws-sdk-php/tree/3.337.1"
}, },
"time": "2025-01-13T19:04:40+00:00" "time": "2025-01-16T19:12:46+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@@ -1432,16 +1432,16 @@
}, },
{ {
"name": "doctrine/dbal", "name": "doctrine/dbal",
"version": "4.2.1", "version": "4.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/dbal.git", "url": "https://github.com/doctrine/dbal.git",
"reference": "dadd35300837a3a2184bd47d403333b15d0a9bd0" "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/dadd35300837a3a2184bd47d403333b15d0a9bd0", "url": "https://api.github.com/repos/doctrine/dbal/zipball/19a2b7deb5fe8c2df0ff817ecea305e50acb62ec",
"reference": "dadd35300837a3a2184bd47d403333b15d0a9bd0", "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1454,16 +1454,14 @@
"doctrine/coding-standard": "12.0.0", "doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1", "fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.2", "jetbrains/phpstorm-stubs": "2023.2",
"phpstan/phpstan": "1.12.6", "phpstan/phpstan": "2.1.1",
"phpstan/phpstan-phpunit": "1.4.0", "phpstan/phpstan-phpunit": "2.0.3",
"phpstan/phpstan-strict-rules": "^1.6", "phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "10.5.30", "phpunit/phpunit": "10.5.39",
"psalm/plugin-phpunit": "0.19.0",
"slevomat/coding-standard": "8.13.1", "slevomat/coding-standard": "8.13.1",
"squizlabs/php_codesniffer": "3.10.2", "squizlabs/php_codesniffer": "3.10.2",
"symfony/cache": "^6.3.8|^7.0", "symfony/cache": "^6.3.8|^7.0",
"symfony/console": "^5.4|^6.3|^7.0", "symfony/console": "^5.4|^6.3|^7.0"
"vimeo/psalm": "5.25.0"
}, },
"suggest": { "suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files." "symfony/console": "For helpful console commands such as SQL execution and import of files."
@@ -1520,7 +1518,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/dbal/issues", "issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/4.2.1" "source": "https://github.com/doctrine/dbal/tree/4.2.2"
}, },
"funding": [ "funding": [
{ {
@@ -1536,7 +1534,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-10-10T18:01:27+00:00" "time": "2025-01-16T08:40:56+00:00"
}, },
{ {
"name": "doctrine/deprecations", "name": "doctrine/deprecations",
@@ -2670,16 +2668,16 @@
}, },
{ {
"name": "laravel/fortify", "name": "laravel/fortify",
"version": "v1.25.1", "version": "v1.25.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/fortify.git", "url": "https://github.com/laravel/fortify.git",
"reference": "5022e7c01385fd6edcef91c12b19071f8f20d6d8" "reference": "a20e8033e7329b05820007c398f06065a38ae188"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/fortify/zipball/5022e7c01385fd6edcef91c12b19071f8f20d6d8", "url": "https://api.github.com/repos/laravel/fortify/zipball/a20e8033e7329b05820007c398f06065a38ae188",
"reference": "5022e7c01385fd6edcef91c12b19071f8f20d6d8", "reference": "a20e8033e7329b05820007c398f06065a38ae188",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2731,20 +2729,20 @@
"issues": "https://github.com/laravel/fortify/issues", "issues": "https://github.com/laravel/fortify/issues",
"source": "https://github.com/laravel/fortify" "source": "https://github.com/laravel/fortify"
}, },
"time": "2024-11-27T14:51:15+00:00" "time": "2025-01-10T20:33:47+00:00"
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v11.37.0", "version": "v11.38.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "6cb103d2024b087eae207654b3f4b26646119ba5" "reference": "9d290aa90fcad44048bedca5219d2b872e98772a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/6cb103d2024b087eae207654b3f4b26646119ba5", "url": "https://api.github.com/repos/laravel/framework/zipball/9d290aa90fcad44048bedca5219d2b872e98772a",
"reference": "6cb103d2024b087eae207654b3f4b26646119ba5", "reference": "9d290aa90fcad44048bedca5219d2b872e98772a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2945,20 +2943,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2025-01-02T20:10:21+00:00" "time": "2025-01-15T00:06:46+00:00"
}, },
{ {
"name": "laravel/horizon", "name": "laravel/horizon",
"version": "v5.30.1", "version": "v5.30.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/horizon.git", "url": "https://github.com/laravel/horizon.git",
"reference": "77177646679ef2f2acf71d4d4b16036d18002040" "reference": "baef526f036717b0090754cbd9c9b67f879739fd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/horizon/zipball/77177646679ef2f2acf71d4d4b16036d18002040", "url": "https://api.github.com/repos/laravel/horizon/zipball/baef526f036717b0090754cbd9c9b67f879739fd",
"reference": "77177646679ef2f2acf71d4d4b16036d18002040", "reference": "baef526f036717b0090754cbd9c9b67f879739fd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3023,9 +3021,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/horizon/issues", "issues": "https://github.com/laravel/horizon/issues",
"source": "https://github.com/laravel/horizon/tree/v5.30.1" "source": "https://github.com/laravel/horizon/tree/v5.30.2"
}, },
"time": "2024-12-13T14:08:51+00:00" "time": "2025-01-13T16:51:22+00:00"
}, },
{ {
"name": "laravel/pail", "name": "laravel/pail",
@@ -3107,16 +3105,16 @@
}, },
{ {
"name": "laravel/prompts", "name": "laravel/prompts",
"version": "v0.3.2", "version": "v0.3.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/prompts.git", "url": "https://github.com/laravel/prompts.git",
"reference": "0e0535747c6b8d6d10adca8b68293cf4517abb0f" "reference": "749395fcd5f8f7530fe1f00dfa84eb22c83d94ea"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/0e0535747c6b8d6d10adca8b68293cf4517abb0f", "url": "https://api.github.com/repos/laravel/prompts/zipball/749395fcd5f8f7530fe1f00dfa84eb22c83d94ea",
"reference": "0e0535747c6b8d6d10adca8b68293cf4517abb0f", "reference": "749395fcd5f8f7530fe1f00dfa84eb22c83d94ea",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3160,9 +3158,9 @@
"description": "Add beautiful and user-friendly forms to your command-line applications.", "description": "Add beautiful and user-friendly forms to your command-line applications.",
"support": { "support": {
"issues": "https://github.com/laravel/prompts/issues", "issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.3.2" "source": "https://github.com/laravel/prompts/tree/v0.3.3"
}, },
"time": "2024-11-12T14:59:47+00:00" "time": "2024-12-30T15:53:31+00:00"
}, },
{ {
"name": "laravel/sanctum", "name": "laravel/sanctum",
@@ -11756,16 +11754,16 @@
}, },
{ {
"name": "zircote/swagger-php", "name": "zircote/swagger-php",
"version": "5.0.2", "version": "5.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zircote/swagger-php.git", "url": "https://github.com/zircote/swagger-php.git",
"reference": "c6956de52edb270da4df2630b938c9ac3e26e42f" "reference": "7708510b17502a416214148edaa8c9958b23b6cd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/c6956de52edb270da4df2630b938c9ac3e26e42f", "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7708510b17502a416214148edaa8c9958b23b6cd",
"reference": "c6956de52edb270da4df2630b938c9ac3e26e42f", "reference": "7708510b17502a416214148edaa8c9958b23b6cd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -11836,9 +11834,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/zircote/swagger-php/issues", "issues": "https://github.com/zircote/swagger-php/issues",
"source": "https://github.com/zircote/swagger-php/tree/5.0.2" "source": "https://github.com/zircote/swagger-php/tree/5.0.3"
}, },
"time": "2025-01-09T19:42:31+00:00" "time": "2025-01-15T21:02:43+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -12302,16 +12300,16 @@
}, },
{ {
"name": "laravel/dusk", "name": "laravel/dusk",
"version": "v8.2.12", "version": "v8.2.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/dusk.git", "url": "https://github.com/laravel/dusk.git",
"reference": "a399aa31c1c9cef793ad747403017e56df77396c" "reference": "8ddd53a74c2e6f9c3b68cf8189dad44077b585b0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/dusk/zipball/a399aa31c1c9cef793ad747403017e56df77396c", "url": "https://api.github.com/repos/laravel/dusk/zipball/8ddd53a74c2e6f9c3b68cf8189dad44077b585b0",
"reference": "a399aa31c1c9cef793ad747403017e56df77396c", "reference": "8ddd53a74c2e6f9c3b68cf8189dad44077b585b0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -12368,22 +12366,22 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/dusk/issues", "issues": "https://github.com/laravel/dusk/issues",
"source": "https://github.com/laravel/dusk/tree/v8.2.12" "source": "https://github.com/laravel/dusk/tree/v8.2.13"
}, },
"time": "2024-11-21T17:37:39+00:00" "time": "2025-01-06T14:52:17+00:00"
}, },
{ {
"name": "laravel/pint", "name": "laravel/pint",
"version": "v1.19.0", "version": "v1.20.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/pint.git", "url": "https://github.com/laravel/pint.git",
"reference": "8169513746e1bac70c85d6ea1524d9225d4886f0" "reference": "53072e8ea22213a7ed168a8a15b96fbb8b82d44b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/8169513746e1bac70c85d6ea1524d9225d4886f0", "url": "https://api.github.com/repos/laravel/pint/zipball/53072e8ea22213a7ed168a8a15b96fbb8b82d44b",
"reference": "8169513746e1bac70c85d6ea1524d9225d4886f0", "reference": "53072e8ea22213a7ed168a8a15b96fbb8b82d44b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -12436,20 +12434,20 @@
"issues": "https://github.com/laravel/pint/issues", "issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint" "source": "https://github.com/laravel/pint"
}, },
"time": "2024-12-30T16:20:10+00:00" "time": "2025-01-14T16:20:53+00:00"
}, },
{ {
"name": "laravel/telescope", "name": "laravel/telescope",
"version": "v5.2.6", "version": "v5.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/telescope.git", "url": "https://github.com/laravel/telescope.git",
"reference": "7ee46fbea8e3b01108575c8edf7377abddfe8bb9" "reference": "216fd8d41eb17b49469bea9359b4f0f711b882b3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/telescope/zipball/7ee46fbea8e3b01108575c8edf7377abddfe8bb9", "url": "https://api.github.com/repos/laravel/telescope/zipball/216fd8d41eb17b49469bea9359b4f0f711b882b3",
"reference": "7ee46fbea8e3b01108575c8edf7377abddfe8bb9", "reference": "216fd8d41eb17b49469bea9359b4f0f711b882b3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -12503,9 +12501,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/telescope/issues", "issues": "https://github.com/laravel/telescope/issues",
"source": "https://github.com/laravel/telescope/tree/v5.2.6" "source": "https://github.com/laravel/telescope/tree/v5.3.0"
}, },
"time": "2024-11-25T20:34:58+00:00" "time": "2024-12-26T21:37:35+00:00"
}, },
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",
@@ -14792,16 +14790,16 @@
}, },
{ {
"name": "serversideup/spin", "name": "serversideup/spin",
"version": "v3.0.1", "version": "v3.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/serversideup/spin.git", "url": "https://github.com/serversideup/spin.git",
"reference": "ed3ee8f2b9eeaf9e2a0654438441a1eb8ccf5d3d" "reference": "f0e9c78dad8fd86db6030871a9f143fd6ab918e3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/serversideup/spin/zipball/ed3ee8f2b9eeaf9e2a0654438441a1eb8ccf5d3d", "url": "https://api.github.com/repos/serversideup/spin/zipball/f0e9c78dad8fd86db6030871a9f143fd6ab918e3",
"reference": "ed3ee8f2b9eeaf9e2a0654438441a1eb8ccf5d3d", "reference": "f0e9c78dad8fd86db6030871a9f143fd6ab918e3",
"shasum": "" "shasum": ""
}, },
"bin": [ "bin": [
@@ -14825,7 +14823,7 @@
"description": "Replicate your production environment locally using Docker. Just run \"spin up\". It's really that easy.", "description": "Replicate your production environment locally using Docker. Just run \"spin up\". It's really that easy.",
"support": { "support": {
"issues": "https://github.com/serversideup/spin/issues", "issues": "https://github.com/serversideup/spin/issues",
"source": "https://github.com/serversideup/spin/tree/v3.0.1" "source": "https://github.com/serversideup/spin/tree/v3.0.2"
}, },
"funding": [ "funding": [
{ {
@@ -14833,7 +14831,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-12-20T17:23:06+00:00" "time": "2025-01-14T19:02:40+00:00"
}, },
{ {
"name": "spatie/error-solutions", "name": "spatie/error-solutions",
@@ -15489,12 +15487,12 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {},
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^8.4" "php": "^8.4"
}, },
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.3.0" "plugin-api-version": "2.6.0"
} }

View File

@@ -21,13 +21,14 @@ class ProductionSeeder extends Seeder
{ {
public function run(): void public function run(): void
{ {
$user = 'root';
if (isCloud()) { if (isCloud()) {
echo " Running in cloud mode.\n"; echo " Running in cloud mode.\n";
} else { } else {
echo " Running in self-hosted mode.\n"; echo " Running in self-hosted mode.\n";
} }
// Fix for 4.0.0-beta.37
if (User::find(0) !== null && Team::find(0) !== null) { if (User::find(0) !== null && Team::find(0) !== null) {
if (DB::table('team_user')->where('user_id', 0)->first() === null) { if (DB::table('team_user')->where('user_id', 0)->first() === null) {
DB::table('team_user')->insert([ DB::table('team_user')->insert([
@@ -56,6 +57,7 @@ class ProductionSeeder extends Seeder
'team_id' => 0, 'team_id' => 0,
]); ]);
} }
if (GitlabApp::find(0) == null) { if (GitlabApp::find(0) == null) {
GitlabApp::create([ GitlabApp::create([
'id' => 0, 'id' => 0,
@@ -66,14 +68,41 @@ class ProductionSeeder extends Seeder
'team_id' => 0, 'team_id' => 0,
]); ]);
} }
// Add Coolify host (localhost) as Server if it doesn't exist
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
$coolify_key_name = '@host.docker.internal';
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
$private_key_found = PrivateKey::find(0);
if (! $private_key_found) {
if ($coolify_key) {
$user = str($coolify_key)->before('@')->after('id.');
$coolify_key = Storage::disk('ssh-keys')->get($coolify_key);
PrivateKey::create([
'id' => 0,
'team_id' => 0,
'name' => 'localhost\'s key',
'description' => 'The private key for the Coolify host machine (localhost).',
'private_key' => $coolify_key,
]);
echo "SSH key found for the Coolify host machine (localhost).\n";
} else {
echo "No SSH key found for the Coolify host machine (localhost).\n";
echo "Please read the following documentation (point 3) to fix it: https://coolify.
io/docs/knowledge-base/server/openssh/\n";
echo "Your localhost connection won't work until then.";
}
}
}
if (! isCloud()) { if (! isCloud()) {
if (Server::find(0) == null) { if (Server::find(0) == null) {
$server_details = [ $server_details = [
'id' => 0, 'id' => 0,
'name' => 'localhost', 'name' => 'localhost',
'description' => "This is the server where Coolify is running on. Don't delete this!", 'description' => "This is the server where Coolify is running on. Don't delete this!",
'user' => 'root', 'user' => $user,
'ip' => 'host.docker.internal', 'ip' => 'host.docker.internal',
'team_id' => 0, 'team_id' => 0,
'private_key_id' => 0, 'private_key_id' => 0,
@@ -92,6 +121,7 @@ class ProductionSeeder extends Seeder
$server->settings->is_usable = true; $server->settings->is_usable = true;
$server->settings->save(); $server->settings->save();
} }
if (StandaloneDocker::find(0) == null) { if (StandaloneDocker::find(0) == null) {
StandaloneDocker::create([ StandaloneDocker::create([
'id' => 0, 'id' => 0,
@@ -102,33 +132,6 @@ class ProductionSeeder extends Seeder
} }
} }
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
$coolify_key_name = '@host.docker.internal';
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
$server = Server::find(0);
$found = $server->privateKey;
if (! $found) {
if ($coolify_key) {
$user = str($coolify_key)->before('@')->after('id.');
$coolify_key = Storage::disk('ssh-keys')->get($coolify_key);
PrivateKey::create([
'id' => 0,
'team_id' => 0,
'name' => 'localhost\'s key',
'description' => 'The private key for the Coolify host machine (localhost).',
'private_key' => $coolify_key,
]);
$server->update(['user' => $user]);
echo "SSH key found for the Coolify host machine (localhost).\n";
} else {
echo "No SSH key found for the Coolify host machine (localhost).\n";
echo "Please read the following documentation (point 3) to fix it: https://coolify.io/docs/knowledge-base/server/openssh/\n";
echo "Your localhost connection won't work until then.";
}
}
}
if (config('constants.coolify.is_windows_docker_desktop')) { if (config('constants.coolify.is_windows_docker_desktop')) {
PrivateKey::updateOrCreate( PrivateKey::updateOrCreate(
[ [
@@ -173,6 +176,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$server->settings->is_usable = true; $server->settings->is_usable = true;
$server->settings->save(); $server->settings->save();
} }
if (StandaloneDocker::find(0) == null) { if (StandaloneDocker::find(0) == null) {
StandaloneDocker::create([ StandaloneDocker::create([
'id' => 0, 'id' => 0,
@@ -188,6 +192,6 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->call(OauthSettingSeeder::class); $this->call(OauthSettingSeeder::class);
$this->call(PopulateSshKeysDirectorySeeder::class); $this->call(PopulateSshKeysDirectorySeeder::class);
$this->call(SentinelSeeder::class); $this->call(SentinelSeeder::class);
// $this->call(RootUserSeeder::class); $this->call(RootUserSeeder::class);
} }
} }