feat: github repo with deployment key

This commit is contained in:
Andras Bacsai
2023-04-04 14:11:53 +02:00
parent 2a8d603f98
commit 91e4280f6b
5 changed files with 74 additions and 27 deletions

View File

@@ -21,8 +21,6 @@ return new class extends Migration
$table->string('html_url');
$table->integer('custom_port')->default(22);
$table->string('custom_user')->default('git');
$table->boolean('is_system_wide')->default(false);
$table->boolean('is_public')->default(false);
$table->integer('app_id')->nullable();
$table->integer('installation_id')->nullable();
@@ -30,6 +28,9 @@ return new class extends Migration
$table->longText('client_secret')->nullable();
$table->longText('webhook_secret')->nullable();
$table->boolean('is_system_wide')->default(false);
$table->boolean('is_public')->default(false);
$table->foreignId('private_key_id')->nullable();
$table->foreignId('team_id');
$table->timestamps();

View File

@@ -22,12 +22,12 @@ class ApplicationSeeder extends Seeder
$standalone_docker_1 = StandaloneDocker::find(1);
$swarm_docker_1 = SwarmDocker::find(1);
$github_public_source = GithubApp::find(1);
$github_private_source = GithubApp::find(2);
$github_public_source = GithubApp::where('name', 'Public GitHub')->first();
$github_private_source = GithubApp::where('name', 'coolify-laravel-development-private-github')->first();
$github_private_source_with_deploy_key = GithubApp::where('name', 'Private GitHub (deployment key)')->first();
$pv_storage = LocalPersistentVolume::find(1);
Application::create([
'id' => 1,
'name' => 'Public application (from GitHub)',
'git_repository' => 'coollabsio/coolify-examples',
'git_branch' => 'nodejs-fastify',
@@ -41,7 +41,6 @@ class ApplicationSeeder extends Seeder
'source_type' => GithubApp::class,
]);
Application::create([
'id' => 2,
'name' => 'Private application (through GitHub App)',
'git_repository' => 'coollabsio/nodejs-example',
'git_branch' => 'main',
@@ -54,5 +53,18 @@ class ApplicationSeeder extends Seeder
'source_id' => $github_private_source->id,
'source_type' => GithubApp::class,
]);
Application::create([
'name' => 'Public application (from GitHub through Deploy Key)',
'git_repository' => 'coollabsio/php',
'git_branch' => 'main',
'build_pack' => 'nixpacks',
'ports_exposes' => '80,3000',
'ports_mappings' => '3002:80',
'environment_id' => $environment_1->id,
'destination_id' => $standalone_docker_1->id,
'destination_type' => StandaloneDocker::class,
'source_id' => $github_private_source_with_deploy_key->id,
'source_type' => GithubApp::class,
]);
}
}

View File

@@ -16,9 +16,9 @@ class GithubAppSeeder extends Seeder
public function run(): void
{
$root_team = Team::find(1);
$private_key_1 = PrivateKey::find(1);
$private_key_2 = PrivateKey::find(2);
GithubApp::create([
'id' => 1,
'name' => 'Public GitHub',
'api_url' => 'https://api.github.com',
'html_url' => 'https://github.com',
@@ -26,7 +26,6 @@ class GithubAppSeeder extends Seeder
'team_id' => $root_team->id,
]);
GithubApp::create([
'id' => 2,
'name' => 'coolify-laravel-development-private-github',
'api_url' => 'https://api.github.com',
'html_url' => 'https://github.com',
@@ -39,5 +38,13 @@ class GithubAppSeeder extends Seeder
'private_key_id' => $private_key_2->id,
'team_id' => $root_team->id,
]);
GithubApp::create([
'name' => 'Private GitHub (deployment key)',
'api_url' => 'https://api.github.com',
'html_url' => 'https://github.com',
'is_public' => false,
'private_key_id' => $private_key_1->id,
'team_id' => $root_team->id,
]);
}
}