do not seed in coolify cloud

This commit is contained in:
Andras Bacsai 2023-08-28 15:03:44 +02:00
parent 5989eb8f6e
commit af30d0831d

View File

@ -45,60 +45,62 @@ class ProductionSeeder extends Seeder
]); ]);
} }
// Save SSH Keys for the Coolify Host if (config('app.name') !== 'coolify-cloud') {
$coolify_key_name = "id.root@host.docker.internal"; // Save SSH Keys for the Coolify Host
$coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}"); $coolify_key_name = "id.root@host.docker.internal";
$coolify_key = Storage::disk('ssh-keys')->get("{$coolify_key_name}");
if ($coolify_key) { if ($coolify_key) {
PrivateKey::updateOrCreate( PrivateKey::updateOrCreate(
[ [
'id' => 0,
'name' => 'localhost\'s key',
'description' => 'The private key for the Coolify host machine (localhost).',
'team_id' => 0,
],
['private_key' => $coolify_key]
);
} else {
echo "No SSH key found for the Coolify host machine (localhost).\n";
echo "Please generate one and save it in /data/coolify/ssh/keys/{$coolify_key_name}\n";
echo "Then try to install again.\n";
exit(1);
}
// Add Coolify host (localhost) as Server if it doesn't exist
if (Server::find(0) == null) {
$server_details = [
'id' => 0, 'id' => 0,
'name' => 'localhost\'s key', 'name' => "localhost",
'description' => 'The private key for the Coolify host machine (localhost).', 'description' => "This is the server where Coolify is running on. Don't delete this!",
'user' => 'root',
'ip' => "host.docker.internal",
'team_id' => 0, 'team_id' => 0,
], 'private_key_id' => 0
['private_key' => $coolify_key] ];
); $server_details['proxy'] = ServerMetadata::from([
} else { 'type' => ProxyTypes::TRAEFIK_V2->value,
echo "No SSH key found for the Coolify host machine (localhost).\n"; 'status' => ProxyStatus::EXITED->value
echo "Please generate one and save it in /data/coolify/ssh/keys/{$coolify_key_name}\n"; ]);
echo "Then try to install again.\n"; $server = Server::create($server_details);
exit(1); $server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
} else {
$server = Server::find(0);
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
}
if (StandaloneDocker::find(0) == null) {
StandaloneDocker::create([
'id' => 0,
'name' => 'localhost-coolify',
'network' => 'coolify',
'server_id' => 0,
]);
}
} }
// Add Coolify host (localhost) as Server if it doesn't exist
if (Server::find(0) == null) {
$server_details = [
'id' => 0,
'name' => "localhost",
'description' => "This is the server where Coolify is running on. Don't delete this!",
'user' => 'root',
'ip' => "host.docker.internal",
'team_id' => 0,
'private_key_id' => 0
];
$server_details['proxy'] = ServerMetadata::from([
'type' => ProxyTypes::TRAEFIK_V2->value,
'status' => ProxyStatus::EXITED->value
]);
$server = Server::create($server_details);
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
} else {
$server = Server::find(0);
$server->settings->is_reachable = true;
$server->settings->is_usable = true;
$server->settings->save();
}
if (StandaloneDocker::find(0) == null) {
StandaloneDocker::create([
'id' => 0,
'name' => 'localhost-coolify',
'network' => 'coolify',
'server_id' => 0,
]);
}
try { try {
$settings = InstanceSettings::get(); $settings = InstanceSettings::get();
if (is_null($settings->public_ipv4)) { if (is_null($settings->public_ipv4)) {