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.

Make sure key is not created with wrong private_key

Andras Bacsai795af8de52f3
diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php
index d0f0f10f40..2c56824c67 100644
--- a/database/seeders/ProductionSeeder.php
+++ b/database/seeders/ProductionSeeder.php
@@ -106,7 +106,8 @@ class ProductionSeeder extends Seeder
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
- $found = PrivateKey::find(0);
+ $server = Server::find(0);
+ $found = $server->privateKey;
if ($found) {
echo 'Private Key found in database.\n';
if ($coolify_key) {
@@ -125,17 +126,7 @@ class ProductionSeeder extends Seeder
]);
$server->update(['user' => $user]);
echo "SSH key found for the Coolify host machine (localhost).\n";
-
} else {
- PrivateKey::create(
- [
- 'id' => 0,
- 'team_id' => 0,
- 'name' => 'localhost\'s key',
- 'description' => 'The private key for the Coolify host machine (localhost).',
- 'private_key' => 'Paste here you private key!!',
- ]
- );
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.";