This commit is contained in:
Andras Bacsai
2023-05-30 15:52:17 +02:00
parent 6e72889294
commit 0f50d1accd
36 changed files with 715 additions and 273 deletions

View File

@@ -41,8 +41,6 @@ return new class extends Migration
$table->string('base_directory')->default('/');
$table->string('publish_directory')->nullable();
$table->schemalessAttributes('extra_attributes');
$table->string('health_check_path')->default('/');
$table->string('health_check_port')->nullable();
$table->string('health_check_host')->default('localhost');
@@ -65,6 +63,7 @@ return new class extends Migration
$table->integer('limits_cpu_shares')->default(1024);
$table->string('status')->default('exited');
$table->string('preview_url_template')->default('{{pr_id}}.{{domain}}');
$table->nullableMorphs('destination');
$table->nullableMorphs('source');

View File

@@ -0,0 +1,34 @@
<?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('application_previews', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->integer('pull_request_id');
$table->string('fqdn')->unique()->nullable();
$table->string('status')->default('exited');
$table->foreignId('application_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('application_previews');
}
};

View File

@@ -14,8 +14,10 @@ return new class extends Migration
Schema::create('application_deployment_queues', function (Blueprint $table) {
$table->id();
$table->string('application_id');
$table->string('deployment_uuid')->unique();
$table->integer('pull_request_id')->default(0);
$table->schemalessAttributes('extra_attributes');
$table->boolean('force_rebuild')->default(false);
$table->string('commit')->default('HEAD');
$table->string('status')->default('queued');
$table->timestamps();
});

View File

@@ -0,0 +1,25 @@
<?php
namespace Database\Seeders;
use App\Models\Application;
use App\Models\ApplicationPreview;
use App\Models\Environment;
use App\Models\GithubApp;
use App\Models\StandaloneDocker;
use Illuminate\Database\Seeder;
class ApplicationPreviewSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $application_1 = Application::find(1);
// ApplicationPreview::create([
// 'application_id' => $application_1->id,
// 'pull_request_id' => 1
// ]);
}
}

View File

@@ -26,6 +26,7 @@ class ApplicationSeeder extends Seeder
Application::create([
'name' => 'coollabsio/coolify-examples:nodejs-fastify',
'fqdn' => 'http://foo.com',
'repository_project_id' => 603035348,
'git_repository' => 'coollabsio/coolify-examples',
'git_branch' => 'nodejs-fastify',
@@ -36,17 +37,7 @@ class ApplicationSeeder extends Seeder
'destination_id' => $standalone_docker_1->id,
'destination_type' => StandaloneDocker::class,
'source_id' => $github_public_source->id,
'source_type' => GithubApp::class,
'previews' => [
ApplicationPreview::from([
'pullRequestId' => 1,
'branch' => 'nodejs-fastify'
]),
ApplicationPreview::from([
'pullRequestId' => 2,
'branch' => 'nodejs-fastify'
])
]
'source_type' => GithubApp::class
]);
}
}

View File

@@ -26,6 +26,7 @@ class DatabaseSeeder extends Seeder
GitlabAppSeeder::class,
ApplicationSeeder::class,
ApplicationSettingsSeeder::class,
ApplicationPreviewSeeder::class,
DBSeeder::class,
ServiceSeeder::class,
EnvironmentVariableSeeder::class,