@@ -13,6 +13,7 @@ APP_ENV=local
 | 
				
			|||||||
APP_KEY=
 | 
					APP_KEY=
 | 
				
			||||||
APP_DEBUG=true
 | 
					APP_DEBUG=true
 | 
				
			||||||
APP_URL=http://localhost
 | 
					APP_URL=http://localhost
 | 
				
			||||||
 | 
					APP_PORT=8000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DB_CONNECTION=pgsql
 | 
					DB_CONNECTION=pgsql
 | 
				
			||||||
DB_HOST=postgres
 | 
					DB_HOST=postgres
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ use App\Enums\ProcessStatus;
 | 
				
			|||||||
use Illuminate\Process\ProcessResult;
 | 
					use Illuminate\Process\ProcessResult;
 | 
				
			||||||
use Illuminate\Support\Facades\DB;
 | 
					use Illuminate\Support\Facades\DB;
 | 
				
			||||||
use Illuminate\Support\Facades\Process;
 | 
					use Illuminate\Support\Facades\Process;
 | 
				
			||||||
 | 
					use Illuminate\Support\Facades\Storage;
 | 
				
			||||||
use Spatie\Activitylog\Models\Activity;
 | 
					use Spatie\Activitylog\Models\Activity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RunRemoteProcess
 | 
					class RunRemoteProcess
 | 
				
			||||||
@@ -69,13 +70,15 @@ class RunRemoteProcess
 | 
				
			|||||||
        $command = $this->activity->getExtraProperty('command');
 | 
					        $command = $this->activity->getExtraProperty('command');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $delimiter = 'EOF-COOLIFY-SSH';
 | 
					        $delimiter = 'EOF-COOLIFY-SSH';
 | 
				
			||||||
 | 
					        Storage::disk('local')->makeDirectory('.ssh');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $ssh_command = "ssh "
 | 
					        $ssh_command = "ssh "
 | 
				
			||||||
            . "-i {$private_key_location} "
 | 
					            . "-i {$private_key_location} "
 | 
				
			||||||
            . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
 | 
					            . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
 | 
				
			||||||
            . '-o PasswordAuthentication=no '
 | 
					            . '-o PasswordAuthentication=no '
 | 
				
			||||||
            . '-o RequestTTY=no '
 | 
					            . '-o RequestTTY=no '
 | 
				
			||||||
            . "-o LogLevel=ERROR "
 | 
					            . '-o LogLevel=ERROR '
 | 
				
			||||||
 | 
					            . '-o ControlMaster=auto -o ControlPersist=yes -o ControlPersist=1m -o ControlPath=/var/www/html/storage/app/.ssh/ssh_mux_%h_%p_%r '
 | 
				
			||||||
            . "-p {$port} "
 | 
					            . "-p {$port} "
 | 
				
			||||||
            . "{$user}@{$destination} "
 | 
					            . "{$user}@{$destination} "
 | 
				
			||||||
            . " 'bash -se' << \\$delimiter" . PHP_EOL
 | 
					            . " 'bash -se' << \\$delimiter" . PHP_EOL
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								app/Http/Controllers/HomeController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/Http/Controllers/HomeController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class HomeController extends Controller
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function show()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $projects = session('currentTeam')->projects;
 | 
				
			||||||
 | 
					        return view('home', ['projects' => $projects]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										15
									
								
								app/Models/Application.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								app/Models/Application.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Application extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function environment()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->belongsTo(Environment::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function destination()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->morphTo();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										15
									
								
								app/Models/Database.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								app/Models/Database.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Database extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function environment()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->belongsTo(Environment::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function destination()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->morphTo();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										20
									
								
								app/Models/Environment.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								app/Models/Environment.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Environment extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function applications()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->hasMany(Application::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function databases()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->hasMany(Database::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function services()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->hasMany(Service::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										11
									
								
								app/Models/Kubernetes.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								app/Models/Kubernetes.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Illuminate\Database\Eloquent\Factories\HasFactory;
 | 
				
			||||||
 | 
					use Illuminate\Database\Eloquent\Model;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Kubernetes extends Model
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use HasFactory;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -4,13 +4,8 @@ namespace App\Models;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class PrivateKey extends BaseModel
 | 
					class PrivateKey extends BaseModel
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function private_keyables()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->hasMany(PrivateKeyable::class);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function servers()
 | 
					    public function servers()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->morphedByMany(Server::class, 'private_keyable');
 | 
					        return $this->hasMany(Server::class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								app/Models/Project.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								app/Models/Project.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Project extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function environments() {
 | 
				
			||||||
 | 
					        return $this->hasMany(Environment::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function settings() {
 | 
				
			||||||
 | 
					        return $this->hasOne(ProjectSetting::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								app/Models/ProjectSetting.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								app/Models/ProjectSetting.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ProjectSetting extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -4,8 +4,8 @@ namespace App\Models;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class Server extends BaseModel
 | 
					class Server extends BaseModel
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function privateKeys()
 | 
					    public function privateKey()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->morphToMany(PrivateKey::class, 'private_keyable');
 | 
					        return $this->belongsTo(PrivateKey::class);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										16
									
								
								app/Models/Service.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								app/Models/Service.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Service extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function environment()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->belongsTo(Environment::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function destination()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->morphTo();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										11
									
								
								app/Models/StandaloneDocker.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								app/Models/StandaloneDocker.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class StandaloneDocker extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function applications()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->morphMany(Application::class, 'destination');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										11
									
								
								app/Models/SwarmDocker.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								app/Models/SwarmDocker.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Models;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SwarmDocker extends BaseModel
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function applications()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->morphMany(Application::class, 'destination');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -10,4 +10,10 @@ class Team extends BaseModel
 | 
				
			|||||||
    protected $fillable = [
 | 
					    protected $fillable = [
 | 
				
			||||||
        'name',
 | 
					        'name',
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					    public function projects() {
 | 
				
			||||||
 | 
					        return $this->hasMany(Project::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    public function servers() {
 | 
				
			||||||
 | 
					        return $this->hasMany(Server::class);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ if (!function_exists('remoteProcess')) {
 | 
				
			|||||||
        checkTeam($found_server->team_id);
 | 
					        checkTeam($found_server->team_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $temp_file = 'id.rsa_'.'root'.'@'.$found_server->ip;
 | 
					        $temp_file = 'id.rsa_'.'root'.'@'.$found_server->ip;
 | 
				
			||||||
        Storage::disk('local')->put($temp_file, $found_server->privateKeys->first()->private_key, 'private');
 | 
					        Storage::disk('local')->put($temp_file, $found_server->privateKey->private_key, 'private');
 | 
				
			||||||
        $private_key_location = '/var/www/html/storage/app/'.$temp_file;
 | 
					        $private_key_location = '/var/www/html/storage/app/'.$temp_file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return resolve(DispatchRemoteProcess::class, [
 | 
					        return resolve(DispatchRemoteProcess::class, [
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ return new class extends Migration
 | 
				
			|||||||
            $table->integer('port')->default(22);
 | 
					            $table->integer('port')->default(22);
 | 
				
			||||||
            $table->string('user')->default('root');
 | 
					            $table->string('user')->default('root');
 | 
				
			||||||
            $table->foreignId('team_id');
 | 
					            $table->foreignId('team_id');
 | 
				
			||||||
 | 
					            $table->foreignId('private_key_id');
 | 
				
			||||||
            $table->timestamps();
 | 
					            $table->timestamps();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,6 @@ return new class extends Migration
 | 
				
			|||||||
            $table->string('name');
 | 
					            $table->string('name');
 | 
				
			||||||
            $table->string('description')->nullable();
 | 
					            $table->string('description')->nullable();
 | 
				
			||||||
            $table->longText('private_key');
 | 
					            $table->longText('private_key');
 | 
				
			||||||
            $table->nullableMorphs('private_keys_morph');
 | 
					 | 
				
			||||||
            $table->timestamps();
 | 
					            $table->timestamps();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					<?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('projects', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					            $table->string('name');
 | 
				
			||||||
 | 
					            $table->string('description')->nullable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->foreignId('team_id');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('projects');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -11,11 +11,13 @@ return new class extends Migration
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function up(): void
 | 
					    public function up(): void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Schema::create('private_keyables', function (Blueprint $table) {
 | 
					        Schema::create('project_settings', function (Blueprint $table) {
 | 
				
			||||||
            $table->id();
 | 
					            $table->id();
 | 
				
			||||||
            $table->unsignedBigInteger('private_key_id');
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
            $table->unsignedBigInteger('private_keyable_id');
 | 
					            $table->string('wildcard_domain')->nullable();
 | 
				
			||||||
            $table->string('private_keyable_type');
 | 
					
 | 
				
			||||||
 | 
					            $table->foreignId('project_id');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $table->timestamps();
 | 
					            $table->timestamps();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -25,6 +27,6 @@ return new class extends Migration
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function down(): void
 | 
					    public function down(): void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Schema::dropIfExists('private_keyables');
 | 
					        Schema::dropIfExists('project_settings');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					<?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('environments', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					            $table->string('name')->unique();
 | 
				
			||||||
 | 
					            $table->foreignId('project_id');
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('environments');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					<?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('applications', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					            $table->string('name');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->morphs('destination');
 | 
				
			||||||
 | 
					            $table->foreignId('environment_id');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('applications');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					<?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('databases', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					            $table->string('name');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->morphs('destination');
 | 
				
			||||||
 | 
					            $table->foreignId('environment_id');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('databases');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					<?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('services', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					            $table->string('name');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->morphs('destination');
 | 
				
			||||||
 | 
					            $table->foreignId('environment_id');
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('services');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					<?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('standalone_dockers', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->foreignId('server_id');
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('standalone_dockers');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					<?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('swarm_dockers', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->string('uuid')->unique();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $table->foreignId('server_id');
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('swarm_dockers');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					<?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('kubernetes', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->id();
 | 
				
			||||||
 | 
					            $table->timestamps();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::dropIfExists('kubernetes');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										37
									
								
								database/seeders/ApplicationSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								database/seeders/ApplicationSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Application;
 | 
				
			||||||
 | 
					use App\Models\Environment;
 | 
				
			||||||
 | 
					use App\Models\StandaloneDocker;
 | 
				
			||||||
 | 
					use App\Models\SwarmDocker;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ApplicationSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the database seeds.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $environment_1 = Environment::find(1);
 | 
				
			||||||
 | 
					        $standalone_docker_1 = StandaloneDocker::find(1);
 | 
				
			||||||
 | 
					        $swarm_docker_1 = SwarmDocker::find(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Application::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'name' => 'My first application',
 | 
				
			||||||
 | 
					            'environment_id' => $environment_1->id,
 | 
				
			||||||
 | 
					            'destination_id' => $standalone_docker_1->id,
 | 
				
			||||||
 | 
					            'destination_type' => StandaloneDocker::class,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					        Application::create([
 | 
				
			||||||
 | 
					            'id' => 2,
 | 
				
			||||||
 | 
					            'name' => 'My second application (Swarm)',
 | 
				
			||||||
 | 
					            'environment_id' => $environment_1->id,
 | 
				
			||||||
 | 
					            'destination_id' => $swarm_docker_1->id,
 | 
				
			||||||
 | 
					            'destination_type' => SwarmDocker::class,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										24
									
								
								database/seeders/DBSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								database/seeders/DBSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Database;
 | 
				
			||||||
 | 
					use App\Models\Environment;
 | 
				
			||||||
 | 
					use App\Models\StandaloneDocker;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class DBSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $environment_1 = Environment::find(1);
 | 
				
			||||||
 | 
					        $standalone_docker_1 = StandaloneDocker::find(1);
 | 
				
			||||||
 | 
					        Database::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'name'=> "My first database",
 | 
				
			||||||
 | 
					            'environment_id' => $environment_1->id,
 | 
				
			||||||
 | 
					            'destination_id' => $standalone_docker_1->id,
 | 
				
			||||||
 | 
					            'destination_type' => StandaloneDocker::class,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
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
 | 
				
			||||||
@@ -12,8 +13,17 @@ class DatabaseSeeder extends Seeder
 | 
				
			|||||||
            $this->call([
 | 
					            $this->call([
 | 
				
			||||||
                UserSeeder::class,
 | 
					                UserSeeder::class,
 | 
				
			||||||
                TeamSeeder::class,
 | 
					                TeamSeeder::class,
 | 
				
			||||||
                ServerSeeder::class,
 | 
					 | 
				
			||||||
                PrivateKeySeeder::class,
 | 
					                PrivateKeySeeder::class,
 | 
				
			||||||
 | 
					                ServerSeeder::class,
 | 
				
			||||||
 | 
					                ProjectSeeder::class,
 | 
				
			||||||
 | 
					                ProjectSettingSeeder::class,
 | 
				
			||||||
 | 
					                EnvironmentSeeder::class,
 | 
				
			||||||
 | 
					                StandaloneDockerSeeder::class,
 | 
				
			||||||
 | 
					                SwarmDockerSeeder::class,
 | 
				
			||||||
 | 
					                KubernetesSeeder::class,
 | 
				
			||||||
 | 
					                ApplicationSeeder::class,
 | 
				
			||||||
 | 
					                DBSeeder::class,
 | 
				
			||||||
 | 
					                ServiceSeeder::class,
 | 
				
			||||||
            ]);
 | 
					            ]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										29
									
								
								database/seeders/EnvironmentSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								database/seeders/EnvironmentSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Environment;
 | 
				
			||||||
 | 
					use App\Models\Project;
 | 
				
			||||||
 | 
					use Illuminate\Database\Console\Seeds\WithoutModelEvents;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class EnvironmentSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the database seeds.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $project_1 = Project::find(1);
 | 
				
			||||||
 | 
					        Environment::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'name' => 'production',
 | 
				
			||||||
 | 
					            'project_id' => $project_1->id,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					        Environment::create([
 | 
				
			||||||
 | 
					            'id' => 2,
 | 
				
			||||||
 | 
					            'name' => 'staging',
 | 
				
			||||||
 | 
					            'project_id' => $project_1->id,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										17
									
								
								database/seeders/KubernetesSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								database/seeders/KubernetesSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Illuminate\Database\Console\Seeds\WithoutModelEvents;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class KubernetesSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the database seeds.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -14,9 +14,7 @@ class PrivateKeySeeder extends Seeder
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function run(): void
 | 
					    public function run(): void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $server = Server::find(1);
 | 
					        PrivateKey::create([
 | 
				
			||||||
        $server2 = Server::find(2);
 | 
					 | 
				
			||||||
        $private_key = PrivateKey::create([
 | 
					 | 
				
			||||||
            "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,9 +24,7 @@ hwAAAAtzc2gtZWQyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevA
 | 
				
			|||||||
AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV
 | 
					AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV
 | 
				
			||||||
uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
 | 
					uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
 | 
				
			||||||
-----END OPENSSH PRIVATE KEY-----
 | 
					-----END OPENSSH PRIVATE KEY-----
 | 
				
			||||||
",
 | 
					"
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
        $server->privateKeys()->attach($private_key);
 | 
					 | 
				
			||||||
        $server2->privateKeys()->attach($private_key);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										21
									
								
								database/seeders/ProjectSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								database/seeders/ProjectSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Project;
 | 
				
			||||||
 | 
					use App\Models\Team;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ProjectSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $root_team = Team::find(1);
 | 
				
			||||||
 | 
					        Project::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'name' => "My first project",
 | 
				
			||||||
 | 
					            'description' => "This is a test project in development",
 | 
				
			||||||
 | 
					            'team_id' => $root_team->id,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										20
									
								
								database/seeders/ProjectSettingSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								database/seeders/ProjectSettingSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Project;
 | 
				
			||||||
 | 
					use App\Models\ProjectSetting;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ProjectSettingSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $first_project = Project::find(1);
 | 
				
			||||||
 | 
					        ProjectSetting::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'wildcard_domain' => 'testing-host.localhost',
 | 
				
			||||||
 | 
					            'project_id' => $first_project->id,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -2,10 +2,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Database\Seeders;
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\PrivateKey;
 | 
				
			||||||
use App\Models\Server;
 | 
					use App\Models\Server;
 | 
				
			||||||
use App\Models\Team;
 | 
					use App\Models\Team;
 | 
				
			||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
 | 
					use Illuminate\Database\Console\Seeds\WithoutModelEvents;
 | 
				
			||||||
use Illuminate\Database\Seeder;
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					use Illuminate\Support\Facades\DB;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ServerSeeder extends Seeder
 | 
					class ServerSeeder extends Seeder
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -15,12 +17,14 @@ class ServerSeeder extends Seeder
 | 
				
			|||||||
    public function run(): void
 | 
					    public function run(): void
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $root_team = Team::find(1);
 | 
					        $root_team = Team::find(1);
 | 
				
			||||||
        Server::create([
 | 
					        $private_key_1 = PrivateKey::find(1);
 | 
				
			||||||
 | 
					        $server_1 = 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",
 | 
				
			||||||
            'ip' => "coolify-testing-host",
 | 
					            'ip' => "coolify-testing-host",
 | 
				
			||||||
            'team_id' => $root_team->id,
 | 
					            'team_id' => $root_team->id,
 | 
				
			||||||
 | 
					            'private_key_id' => $private_key_1->id,
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
        Server::create([
 | 
					        Server::create([
 | 
				
			||||||
            'id' => 2,
 | 
					            'id' => 2,
 | 
				
			||||||
@@ -28,6 +32,8 @@ class ServerSeeder extends Seeder
 | 
				
			|||||||
            'description' => "This is a test docker container",
 | 
					            'description' => "This is a test docker container",
 | 
				
			||||||
            'ip' => "coolify-testing-host-2",
 | 
					            'ip' => "coolify-testing-host-2",
 | 
				
			||||||
            'team_id' => $root_team->id,
 | 
					            'team_id' => $root_team->id,
 | 
				
			||||||
 | 
					            'private_key_id' => $private_key_1->id,
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								database/seeders/ServiceSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								database/seeders/ServiceSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Environment;
 | 
				
			||||||
 | 
					use App\Models\Service;
 | 
				
			||||||
 | 
					use App\Models\StandaloneDocker;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ServiceSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the database seeds.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $environment_1 = Environment::find(1);
 | 
				
			||||||
 | 
					        $standalone_docker_1 = StandaloneDocker::find(1);
 | 
				
			||||||
 | 
					        Service::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'name'=> "My first database",
 | 
				
			||||||
 | 
					            'environment_id' => $environment_1->id,
 | 
				
			||||||
 | 
					            'destination_id' => $standalone_docker_1->id,
 | 
				
			||||||
 | 
					            'destination_type' => StandaloneDocker::class,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										24
									
								
								database/seeders/StandaloneDockerSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								database/seeders/StandaloneDockerSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Destination;
 | 
				
			||||||
 | 
					use App\Models\Server;
 | 
				
			||||||
 | 
					use App\Models\StandaloneDocker;
 | 
				
			||||||
 | 
					use Illuminate\Database\Console\Seeds\WithoutModelEvents;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class StandaloneDockerSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the database seeds.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $server_1 = Server::find(1);
 | 
				
			||||||
 | 
					        StandaloneDocker::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'server_id' => $server_1->id,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								database/seeders/SwarmDockerSeeder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								database/seeders/SwarmDockerSeeder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Database\Seeders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Destination;
 | 
				
			||||||
 | 
					use App\Models\Server;
 | 
				
			||||||
 | 
					use App\Models\StandaloneDocker;
 | 
				
			||||||
 | 
					use App\Models\SwarmDocker;
 | 
				
			||||||
 | 
					use Illuminate\Database\Console\Seeds\WithoutModelEvents;
 | 
				
			||||||
 | 
					use Illuminate\Database\Seeder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SwarmDockerSeeder extends Seeder
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the database seeds.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function run(): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $server_1 = Server::find(1);
 | 
				
			||||||
 | 
					        SwarmDocker::create([
 | 
				
			||||||
 | 
					            'id' => 1,
 | 
				
			||||||
 | 
					            'server_id' => $server_1->id,
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,10 +1,10 @@
 | 
				
			|||||||
<nav>
 | 
					<nav>
 | 
				
			||||||
    <a href="/">Home</a>
 | 
					 | 
				
			||||||
    @guest
 | 
					    @guest
 | 
				
			||||||
        <a href="/login">Login</a>
 | 
					        <a href="/login">Login</a>
 | 
				
			||||||
        <a href="/register">Register</a>
 | 
					        <a href="/register">Register</a>
 | 
				
			||||||
    @endguest
 | 
					    @endguest
 | 
				
			||||||
    @auth
 | 
					    @auth
 | 
				
			||||||
 | 
					        <a href="/">Home</a>
 | 
				
			||||||
        <a href="/demo">Demo</a>
 | 
					        <a href="/demo">Demo</a>
 | 
				
			||||||
        <a href="/profile">Profile</a>
 | 
					        <a href="/profile">Profile</a>
 | 
				
			||||||
        <form action="/logout" method="POST">
 | 
					        <form action="/logout" method="POST">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,9 +2,43 @@
 | 
				
			|||||||
    <h1>
 | 
					    <h1>
 | 
				
			||||||
        Coolify v4 🎉
 | 
					        Coolify v4 🎉
 | 
				
			||||||
    </h1>
 | 
					    </h1>
 | 
				
			||||||
    @guest
 | 
					    <h1>Projects</h1>
 | 
				
			||||||
        <p>
 | 
					    <ul>
 | 
				
			||||||
            To see the demo, please <a href='/login'>login<a> or <a href='/register'>register<a>.
 | 
					        @forelse ($projects as $project)
 | 
				
			||||||
        </p>
 | 
					            <h2>{{ $project->name }}</h2>
 | 
				
			||||||
    @endguest
 | 
					            <p>Project Settings:{{ $project->settings }}</p>
 | 
				
			||||||
 | 
					            <h2>Environments</h2>
 | 
				
			||||||
 | 
					            @forelse ($project->environments as $environment)
 | 
				
			||||||
 | 
					                <h1>Environment: {{ $environment->name }}</h1>
 | 
				
			||||||
 | 
					                <h2>Applications</h2>
 | 
				
			||||||
 | 
					                @forelse ($environment->applications as $application)
 | 
				
			||||||
 | 
					                    <h3>{{ $application->name }}</h3>
 | 
				
			||||||
 | 
					                    <p>Application: {{ $application }}</p>
 | 
				
			||||||
 | 
					                    <p>Destination Class: {{ $application->destination->getMorphClass() }}</p>
 | 
				
			||||||
 | 
					                @empty
 | 
				
			||||||
 | 
					                    <li>No application found</li>
 | 
				
			||||||
 | 
					                @endforelse
 | 
				
			||||||
 | 
					                <h2>Databases</h2>
 | 
				
			||||||
 | 
					                @forelse ($environment->databases as $database)
 | 
				
			||||||
 | 
					                    <h3>{{ $database->name }}</h3>
 | 
				
			||||||
 | 
					                    <p>Database: {{ $database }}</p>
 | 
				
			||||||
 | 
					                    <p>Destination Class: {{ $database->destination->getMorphClass() }}</p>
 | 
				
			||||||
 | 
					                @empty
 | 
				
			||||||
 | 
					                    <li>No database found</li>
 | 
				
			||||||
 | 
					                @endforelse
 | 
				
			||||||
 | 
					                <h2>Services</h2>
 | 
				
			||||||
 | 
					                @forelse ($environment->services as $service)
 | 
				
			||||||
 | 
					                    <h3>{{ $service->name }}</h3>
 | 
				
			||||||
 | 
					                    <p>Service: {{ $service }}</p>
 | 
				
			||||||
 | 
					                    <p>Destination Class: {{ $service->destination->getMorphClass() }}</p>
 | 
				
			||||||
 | 
					                @empty
 | 
				
			||||||
 | 
					                    <li>No service found</li>
 | 
				
			||||||
 | 
					                @endforelse
 | 
				
			||||||
 | 
					            @empty
 | 
				
			||||||
 | 
					                <p>No environments found</p>
 | 
				
			||||||
 | 
					            @endforelse
 | 
				
			||||||
 | 
					        @empty
 | 
				
			||||||
 | 
					            <li>No projects found</li>
 | 
				
			||||||
 | 
					        @endforelse
 | 
				
			||||||
 | 
					    </ul>
 | 
				
			||||||
</x-layout>
 | 
					</x-layout>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Http\Controllers\HomeController;
 | 
				
			||||||
use Illuminate\Support\Facades\Route;
 | 
					use Illuminate\Support\Facades\Route;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
@@ -13,11 +14,10 @@ use Illuminate\Support\Facades\Route;
 | 
				
			|||||||
|
 | 
					|
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Route::get('/', function () {
 | 
					
 | 
				
			||||||
    return view('home');
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Route::middleware(['auth'])->group(function () {
 | 
					Route::middleware(['auth'])->group(function () {
 | 
				
			||||||
 | 
					    Route::get('/', [HomeController::class, 'show']);
 | 
				
			||||||
    Route::get('/profile', function () {
 | 
					    Route::get('/profile', function () {
 | 
				
			||||||
        return view('profile');
 | 
					        return view('profile');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user