mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-16 20:49:28 +00:00
chore: Add SSH key for localhost in ProductionSeeder
This commit is contained in:
@@ -67,28 +67,40 @@ class ProductionSeeder extends Seeder
|
|||||||
|
|
||||||
if (! isCloud() && config('coolify.is_windows_docker_desktop') == false) {
|
if (! isCloud() && config('coolify.is_windows_docker_desktop') == false) {
|
||||||
echo "Checking localhost key.\n";
|
echo "Checking localhost key.\n";
|
||||||
// Save SSH Keys for the Coolify Host
|
|
||||||
$coolify_key_name = 'id.root@host.docker.internal';
|
|
||||||
$coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}");
|
|
||||||
|
|
||||||
if ($coolify_key) {
|
$found = PrivateKey::find(0);
|
||||||
PrivateKey::updateOrCreate(
|
if ($found) {
|
||||||
[
|
echo 'Private Key found in database.';
|
||||||
'id' => 0,
|
|
||||||
'team_id' => 0,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => 'localhost\'s key',
|
|
||||||
'description' => 'The private key for the Coolify host machine (localhost).',
|
|
||||||
'private_key' => $coolify_key,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
echo "No SSH key found for the Coolify host machine (localhost).\n";
|
$coolify_key_name = 'id.root@host.docker.internal';
|
||||||
echo "Please generate one and save it in /data/coolify/ssh/keys/{$coolify_key_name}\n";
|
$coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}");
|
||||||
echo "Then try to install again.\n";
|
|
||||||
exit(1);
|
if ($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,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} 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.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Coolify host (localhost) as Server if it doesn't exist
|
// Add Coolify host (localhost) as Server if it doesn't exist
|
||||||
if (Server::find(0) == null) {
|
if (Server::find(0) == null) {
|
||||||
$server_details = [
|
$server_details = [
|
||||||
|
|||||||
Reference in New Issue
Block a user