Add GitHub, GitLab, DeployKeys
This commit is contained in:
parent
46c2d311e9
commit
54441ddfde
@ -12,4 +12,8 @@ public function destination()
|
|||||||
{
|
{
|
||||||
return $this->morphTo();
|
return $this->morphTo();
|
||||||
}
|
}
|
||||||
|
public function source()
|
||||||
|
{
|
||||||
|
return $this->morphTo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
7
app/Models/GitDeployKey.php
Normal file
7
app/Models/GitDeployKey.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
class GitDeployKey extends BaseModel
|
||||||
|
{
|
||||||
|
}
|
11
app/Models/GithubApp.php
Normal file
11
app/Models/GithubApp.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
class GithubApp extends BaseModel
|
||||||
|
{
|
||||||
|
public function applications()
|
||||||
|
{
|
||||||
|
return $this->morphMany(Application::class, 'source');
|
||||||
|
}
|
||||||
|
}
|
7
app/Models/GitlabApp.php
Normal file
7
app/Models/GitlabApp.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
class GitlabApp extends BaseModel
|
||||||
|
{
|
||||||
|
}
|
@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
class Kubernetes extends BaseModel
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Kubernetes extends Model
|
|
||||||
{
|
{
|
||||||
use HasFactory;
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ public function up(): void
|
|||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
|
||||||
$table->morphs('destination');
|
$table->morphs('destination');
|
||||||
|
$table->morphs('source');
|
||||||
$table->foreignId('environment_id');
|
$table->foreignId('environment_id');
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
@ -13,6 +13,8 @@ public function up(): void
|
|||||||
{
|
{
|
||||||
Schema::create('kubernetes', function (Blueprint $table) {
|
Schema::create('kubernetes', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->string('uuid')->unique();
|
||||||
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('github_apps', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('uuid')->unique();
|
||||||
|
$table->string('name');
|
||||||
|
|
||||||
|
$table->string('organization')->nullable();
|
||||||
|
$table->string('api_url');
|
||||||
|
$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();
|
||||||
|
$table->string('client_id')->nullable();
|
||||||
|
$table->longText('client_secret')->nullable();
|
||||||
|
$table->longText('webhook_secret')->nullable();
|
||||||
|
|
||||||
|
$table->foreignId('private_key_id')->nullable();
|
||||||
|
$table->foreignId('team_id');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('github_apps');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('gitlab_apps', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('uuid')->unique();
|
||||||
|
$table->string('name');
|
||||||
|
|
||||||
|
$table->string('organization')->nullable();
|
||||||
|
$table->string('api_url');
|
||||||
|
$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->string('app_secret')->nullable();
|
||||||
|
$table->integer('oauth_id')->nullable();
|
||||||
|
$table->string('group_name')->nullable();
|
||||||
|
$table->longText('public_key')->nullable();
|
||||||
|
$table->longText('webhook_token')->nullable();
|
||||||
|
$table->integer('deploy_key_id')->nullable();
|
||||||
|
|
||||||
|
$table->foreignId('private_key_id')->nullable();
|
||||||
|
$table->foreignId('team_id');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('gitlab_apps');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('git_deploy_keys', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('uuid')->unique();
|
||||||
|
$table->string('url');
|
||||||
|
|
||||||
|
$table->foreignId('private_key_id');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('git_deploy_keys');
|
||||||
|
}
|
||||||
|
};
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\Environment;
|
use App\Models\Environment;
|
||||||
|
use App\Models\GithubApp;
|
||||||
use App\Models\StandaloneDocker;
|
use App\Models\StandaloneDocker;
|
||||||
use App\Models\SwarmDocker;
|
use App\Models\SwarmDocker;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
@ -19,12 +20,15 @@ public function run(): void
|
|||||||
$standalone_docker_1 = StandaloneDocker::find(1);
|
$standalone_docker_1 = StandaloneDocker::find(1);
|
||||||
$swarm_docker_1 = SwarmDocker::find(1);
|
$swarm_docker_1 = SwarmDocker::find(1);
|
||||||
|
|
||||||
|
$github_public_source = GithubApp::find(1);
|
||||||
Application::create([
|
Application::create([
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'name' => 'My first application',
|
'name' => 'My first application',
|
||||||
'environment_id' => $environment_1->id,
|
'environment_id' => $environment_1->id,
|
||||||
'destination_id' => $standalone_docker_1->id,
|
'destination_id' => $standalone_docker_1->id,
|
||||||
'destination_type' => StandaloneDocker::class,
|
'destination_type' => StandaloneDocker::class,
|
||||||
|
'source_id' => $github_public_source->id,
|
||||||
|
'source_type' => GithubApp::class,
|
||||||
]);
|
]);
|
||||||
Application::create([
|
Application::create([
|
||||||
'id' => 2,
|
'id' => 2,
|
||||||
@ -32,6 +36,8 @@ public function run(): void
|
|||||||
'environment_id' => $environment_1->id,
|
'environment_id' => $environment_1->id,
|
||||||
'destination_id' => $swarm_docker_1->id,
|
'destination_id' => $swarm_docker_1->id,
|
||||||
'destination_type' => SwarmDocker::class,
|
'destination_type' => SwarmDocker::class,
|
||||||
|
'source_id' => $github_public_source->id,
|
||||||
|
'source_type' => GithubApp::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\StandaloneDocker;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
if (env('APP_ENV') === 'local') {
|
|
||||||
$this->call([
|
$this->call([
|
||||||
UserSeeder::class,
|
UserSeeder::class,
|
||||||
TeamSeeder::class,
|
TeamSeeder::class,
|
||||||
@ -21,10 +19,11 @@ public function run(): void
|
|||||||
StandaloneDockerSeeder::class,
|
StandaloneDockerSeeder::class,
|
||||||
SwarmDockerSeeder::class,
|
SwarmDockerSeeder::class,
|
||||||
KubernetesSeeder::class,
|
KubernetesSeeder::class,
|
||||||
|
GithubAppSeeder::class,
|
||||||
|
GitlabAppSeeder::class,
|
||||||
ApplicationSeeder::class,
|
ApplicationSeeder::class,
|
||||||
DBSeeder::class,
|
DBSeeder::class,
|
||||||
ServiceSeeder::class,
|
ServiceSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
17
database/seeders/GitDeployKeySeeder.php
Normal file
17
database/seeders/GitDeployKeySeeder.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class GitDeployKeySeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
43
database/seeders/GithubAppSeeder.php
Normal file
43
database/seeders/GithubAppSeeder.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\GithubApp;
|
||||||
|
use App\Models\PrivateKey;
|
||||||
|
use App\Models\Team;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class GithubAppSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$root_team = Team::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',
|
||||||
|
'is_public' => true,
|
||||||
|
'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',
|
||||||
|
'is_public' => false,
|
||||||
|
'app_id' => 292941,
|
||||||
|
'installation_id' => 34157139,
|
||||||
|
'client_id' => 'Iv1.220e564d2b0abd8c',
|
||||||
|
'client_secret' => '96b1b31f36ce0a34386d11798ff35b9b6d8aba3a',
|
||||||
|
'webhook_secret' => '326a47b49054f03288f800d81247ec9414d0abf3',
|
||||||
|
'private_key_id' => $private_key_2->id,
|
||||||
|
'team_id' => $root_team->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
43
database/seeders/GitlabAppSeeder.php
Normal file
43
database/seeders/GitlabAppSeeder.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\GitlabApp;
|
||||||
|
use App\Models\PrivateKey;
|
||||||
|
use App\Models\Team;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class GitlabAppSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$root_team = Team::find(1);
|
||||||
|
$private_key_3 = PrivateKey::find(3);
|
||||||
|
GitlabApp::create([
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Public GitLab',
|
||||||
|
'api_url' => 'https://gitlab.com/api/v4',
|
||||||
|
'html_url' => 'https://gitlab.com',
|
||||||
|
'is_public' => true,
|
||||||
|
'team_id' => $root_team->id,
|
||||||
|
]);
|
||||||
|
GitlabApp::create([
|
||||||
|
'id' => 2,
|
||||||
|
'name' => 'coolify-laravel-development-private-gitlab',
|
||||||
|
'api_url' => 'https://gitlab.com/api/v4',
|
||||||
|
'html_url' => 'https://gitlab.com',
|
||||||
|
'app_id' => 1234,
|
||||||
|
'app_secret' => '1234',
|
||||||
|
'oauth_id' => 1234,
|
||||||
|
'deploy_key_id' => '1234',
|
||||||
|
'public_key' => 'dfjasiourj',
|
||||||
|
'webhook_token' => '4u3928u4y392',
|
||||||
|
'private_key_id' => $private_key_3->id,
|
||||||
|
'team_id' => $root_team->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ class PrivateKeySeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
PrivateKey::create([
|
PrivateKey::create([
|
||||||
|
"id" => 1,
|
||||||
"name" => "Testing-host",
|
"name" => "Testing-host",
|
||||||
"description" => "This is a test docker container",
|
"description" => "This is a test docker container",
|
||||||
"private_key" => "-----BEGIN OPENSSH PRIVATE KEY-----
|
"private_key" => "-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
@ -26,5 +27,43 @@ public function run(): void
|
|||||||
-----END OPENSSH PRIVATE KEY-----
|
-----END OPENSSH PRIVATE KEY-----
|
||||||
"
|
"
|
||||||
]);
|
]);
|
||||||
|
PrivateKey::create([
|
||||||
|
"id" => 2,
|
||||||
|
"name" => "development-github-app",
|
||||||
|
"description" => "This is the key for using the development GitHub app",
|
||||||
|
"private_key" => "-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpAIBAAKCAQEAstJo/SfYh3tquc2BA29a1X3pdPpXazRgtKsb5fHOwQs1rE04
|
||||||
|
VyJYW6QCToSH4WS1oKt6iI4ma4uivn8rnkZFdw3mpcLp2ofcoeV3YPKX6pN/RiJC
|
||||||
|
if+g8gCaFywOxy2pjXOLPZeFJSXFqc4UOymbhESUyDnMfk4/RvnubMiv3jINo4Ow
|
||||||
|
4Tv7tRzAdMlMrx3hEhi142oQuyl1kc4WQOM9cAV0bd+62ga3EYSnsWTnC9AaFtWk
|
||||||
|
eGC5w/7knHJ5QZ9tKApkG3/29vJXY7WwCRUROEHqkvQhRDP0uqRPBdR48iG87Dwq
|
||||||
|
ePa6TodkFaVfyHS/OUZzRiTn6MOSyQQFg0QIIwIDAQABAoIBAQCsmGebSJU2lwl4
|
||||||
|
0oAeZ6E9hG0LagFsSL66QpkHxO9w5bflWRbzCw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MRFj39/bOLmv9Wmct+3ArKiLtftlqkmAJTF+w7fJCiqH0s31A+OChi9PMcy
|
||||||
|
oV2PBC0CgYAXOm08kFOQA+bPBdLAte8Ga89frh6asH/Z8ucfsz9/zMMG/hhq5nF3
|
||||||
|
7TItY9Pblc2Fp805J13G96zWLX4YGyLwXXkYs+Ae7QoqjonTw7/mUDARY1Zxs9m/
|
||||||
|
a1C8EDKapCw5hAhizEFOUQKOygL8Ipn+tmEUkORYdZ8Q8cWFCv9nIw==
|
||||||
|
-----END RSA PRIVATE KEY-----"
|
||||||
|
]);
|
||||||
|
PrivateKey::create([
|
||||||
|
"id" => 3,
|
||||||
|
"name" => "development-gitlab-app",
|
||||||
|
"description" => "This is the key for using the development Gitlab app",
|
||||||
|
"private_key" => "asdf"
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public function run(): void
|
|||||||
{
|
{
|
||||||
$root_team = Team::find(1);
|
$root_team = Team::find(1);
|
||||||
$private_key_1 = PrivateKey::find(1);
|
$private_key_1 = PrivateKey::find(1);
|
||||||
$server_1 = Server::create([
|
Server::create([
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'name' => "testing-host",
|
'name' => "testing-host",
|
||||||
'description' => "This is a test docker container",
|
'description' => "This is a test docker container",
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<h3>{{ $application->name }}</h3>
|
<h3>{{ $application->name }}</h3>
|
||||||
<p>Application: {{ $application }}</p>
|
<p>Application: {{ $application }}</p>
|
||||||
<p>Destination Class: {{ $application->destination->getMorphClass() }}</p>
|
<p>Destination Class: {{ $application->destination->getMorphClass() }}</p>
|
||||||
|
<p>Source Class: {{ $application->source->getMorphClass() }}</p>
|
||||||
@empty
|
@empty
|
||||||
<li>No application found</li>
|
<li>No application found</li>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
Loading…
Reference in New Issue
Block a user