update proxy things

This commit is contained in:
Andras Bacsai
2023-05-22 12:47:15 +02:00
parent f5bf07a7c3
commit c1bafccac1
7 changed files with 42 additions and 26 deletions

View File

@@ -2,11 +2,13 @@
namespace Database\Seeders;
use App\Data\ServerMetadata;
use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes;
use App\Models\GithubApp;
use App\Models\GitlabApp;
use App\Models\InstanceSettings;
use App\Models\PrivateKey;
use App\Models\Project;
use App\Models\Server;
use App\Models\Team;
use Illuminate\Database\Seeder;
@@ -73,20 +75,26 @@ class ProductionSeeder extends Seeder
// TODO: Add a command to generate a new SSH key for the Coolify host machine (localhost).
echo "No SSH key found for the Coolify host machine (localhost).\n";
echo "Please generate one and save it in storage/app/ssh-keys/{$coolify_key_name}\n";
exit(1);
}
// Add Coolify host (localhost) as Server if it doesn't exist
if (Server::find(0) == null) {
$server = Server::create([
$server_details = [
'id' => 0,
'name' => "localhost",
'description' => "This is the local machine",
'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,
]);
'private_key_id' => 0
];
if (env('COOLIFY_DEFAULT_PROXY') == 'traefik') {
$server_details['extra_attributes'] = ServerMetadata::from([
'proxy_type' => ProxyTypes::TRAEFIK_V2->value,
'proxy_status' => ProxyStatus::EXITED->value
]);
}
$server = Server::create($server_details);
$server->settings->is_validated = true;
$server->settings->save();
}