From f766600fd85fea6492acbb0585489afdd5305534 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 25 May 2023 12:00:09 +0200 Subject: [PATCH] fixes --- .../Livewire/Project/Application/Deploy.php | 4 +- .../Livewire/Project/Application/Status.php | 3 + app/Http/Livewire/Server/PrivateKey.php | 4 +- app/Http/Livewire/Settings/Form.php | 58 +++++++++++++++++++ app/Jobs/ApplicationDeploymentJob.php | 4 +- app/Jobs/ContainerStatusJob.php | 2 +- app/Jobs/ContainerStopJob.php | 39 ------------- app/Providers/AppServiceProvider.php | 1 + bootstrap/helpers/proxy.php | 3 + bootstrap/helpers/remoteProcess.php | 10 ++-- bootstrap/helpers/storage.php | 38 ++++++++++++ config/filesystems.php | 3 +- .../2014_10_12_000000_create_users_table.php | 2 +- ...01_create_personal_access_tokens_table.php | 2 +- .../2023_03_20_112811_create_teams_table.php | 2 +- ...23_03_20_112812_create_team_user_table.php | 2 +- ..._112813_create_instance_settings_table.php | 2 +- ...2023_03_24_140711_create_servers_table.php | 2 +- ...24_140712_create_server_settings_table.php | 2 +- ...03_24_140853_create_private_keys_table.php | 2 +- ...023_03_27_075351_create_projects_table.php | 2 +- ...7_075443_create_project_settings_table.php | 2 +- ...03_27_075444_create_environments_table.php | 2 +- ...03_27_081716_create_applications_table.php | 2 +- ...1717_create_application_settings_table.php | 2 +- ...23_03_27_083620_create_databases_table.php | 2 +- ...023_03_27_083621_create_services_table.php | 2 +- ...085020_create_standalone_dockers_table.php | 2 +- ...3_27_085022_create_swarm_dockers_table.php | 2 +- ...3_03_28_062150_create_kubernetes_table.php | 2 +- .../2023_03_28_083722_create_gits_table.php | 2 +- ..._03_28_083723_create_github_apps_table.php | 2 +- ..._03_28_083726_create_gitlab_apps_table.php | 2 +- ..._create_local_persistent_volumes_table.php | 2 +- ...548_create_environment_variables_table.php | 2 +- ..._05_17_104039_create_failed_jobs_table.php | 2 +- ...te_application_deployment_queues_table.php | 2 +- database/seeders/ProductionSeeder.php | 3 +- docker-compose.prod.yml | 4 +- docker-compose.yml | 1 + scripts/run | 3 + 41 files changed, 151 insertions(+), 79 deletions(-) delete mode 100644 app/Jobs/ContainerStopJob.php create mode 100644 bootstrap/helpers/storage.php diff --git a/app/Http/Livewire/Project/Application/Deploy.php b/app/Http/Livewire/Project/Application/Deploy.php index a935b2ad8..68c0a343e 100644 --- a/app/Http/Livewire/Project/Application/Deploy.php +++ b/app/Http/Livewire/Project/Application/Deploy.php @@ -53,6 +53,8 @@ public function deploy(bool $force = false) public function stop() { - dispatch(new ContainerStopJob($this->application->id, $this->destination->server)); + instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server); + $this->application->status = get_container_status(server: $this->application->destination->server, container_id: $this->application->uuid); + $this->application->save(); } } diff --git a/app/Http/Livewire/Project/Application/Status.php b/app/Http/Livewire/Project/Application/Status.php index 47008f305..a326d7c38 100644 --- a/app/Http/Livewire/Project/Application/Status.php +++ b/app/Http/Livewire/Project/Application/Status.php @@ -9,6 +9,9 @@ class Status extends Component { public Application $application; + protected $listeners = [ + 'applicationStatusChanged' => 'pollingStatus', + ]; public function pollingStatus() { $this->application->refresh(); diff --git a/app/Http/Livewire/Server/PrivateKey.php b/app/Http/Livewire/Server/PrivateKey.php index bafaa89c2..c969d11d2 100644 --- a/app/Http/Livewire/Server/PrivateKey.php +++ b/app/Http/Livewire/Server/PrivateKey.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Storage; use Livewire\Component; +use LocalStorage; class PrivateKey extends Component { @@ -19,8 +20,7 @@ public function setPrivateKey($private_key_id) 'private_key_id' => $private_key_id ]); // Delete the old ssh mux file to force a new one to be created - Storage::disk('local')->delete(".ssh/ssh_mux_{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}"); - + LocalStorage::ssh_mux()->delete("{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}"); return redirect()->route('server.show', $this->parameters['server_uuid']); } public function mount() diff --git a/app/Http/Livewire/Settings/Form.php b/app/Http/Livewire/Settings/Form.php index 0c4dcf5a8..15169096f 100644 --- a/app/Http/Livewire/Settings/Form.php +++ b/app/Http/Livewire/Settings/Form.php @@ -2,8 +2,12 @@ namespace App\Http\Livewire\Settings; +use App\Enums\ActivityTypes; use App\Models\InstanceSettings as ModelsInstanceSettings; +use App\Models\Server; use Livewire\Component; +use Spatie\Url\Url; +use Symfony\Component\Yaml\Yaml; class Form extends Component { @@ -44,5 +48,59 @@ public function submit() } $this->validate(); $this->settings->save(); + if (isset($this->settings->fqdn)) { + if (config('app.env') == 'local') { + $server = Server::findOrFail(1); + $dynamic_config_path = '/data/coolify/proxy/dynamic'; + } else { + $server = Server::findOrFail(0); + $dynamic_config_path = '/traefik/dynamic'; + } + $url = Url::fromString($this->settings->fqdn); + $host = $url->getHost(); + $schema = $url->getScheme(); + $entryPoints = [ + 0 => 'http', + ]; + if ($schema === 'https') { + $entryPoints[] = 'https'; + } + $traefik_dynamic_conf = [ + 'http' => + [ + 'routers' => + [ + 'coolify' => + [ + 'entryPoints' => $entryPoints, + 'service' => 'coolify', + 'rule' => "Host(`{$host}`)", + ], + ], + 'services' => + [ + 'coolify' => + [ + 'loadBalancer' => + [ + 'servers' => + [ + 0 => + [ + 'url' => 'http://coolify:80', + ], + ], + ], + ], + ], + ], + ]; + $yaml = Yaml::dump($traefik_dynamic_conf); + $base64 = base64_encode($yaml); + remote_process([ + "mkdir -p $dynamic_config_path", + "echo '$base64' | base64 -d > $dynamic_config_path/coolify.yaml", + ], $server, ActivityTypes::INLINE->value); + } } } diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index b96355d28..9692f6fe3 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -18,6 +18,8 @@ use Spatie\Activitylog\Models\Activity; use Symfony\Component\Yaml\Yaml; use Illuminate\Support\Str; +use LocalStorage; +use Log; use Spatie\Url\Url; class ApplicationDeploymentJob implements ShouldQueue @@ -203,7 +205,7 @@ public function handle(): void $this->fail(); } finally { if (isset($this->docker_compose)) { - Storage::disk('deployments')->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose); + LocalStorage::deployments()->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose); } $this->execute_now(["docker rm -f {$this->deployment_uuid} >/dev/null 2>&1"], hideFromOutput: true); } diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 4264c1dd4..ce513b2bd 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -21,7 +21,7 @@ public function __construct( public string|null $application_id = null, ) { if ($this->application_id) { - $this->application = Application::find($this->application_id)->first(); + $this->application = Application::find($this->application_id); } } public function uniqueId(): string diff --git a/app/Jobs/ContainerStopJob.php b/app/Jobs/ContainerStopJob.php deleted file mode 100644 index d44851d9a..000000000 --- a/app/Jobs/ContainerStopJob.php +++ /dev/null @@ -1,39 +0,0 @@ -application_id; - } - public function handle(): void - { - try { - $application = Application::find($this->application_id)->first(); - instant_remote_process(["docker rm -f {$application->uuid}"], $this->server); - $application->status = get_container_status(server: $application->destination->server, container_id: $application->uuid); - $application->save(); - } catch (\Exception $e) { - Log::error($e->getMessage()); - } - } -} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 015584d9e..f01e3b461 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Queue; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Str; +use LocalStorage; class AppServiceProvider extends ServiceProvider { diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php index 28ee9740b..f1a897e1b 100644 --- a/bootstrap/helpers/proxy.php +++ b/bootstrap/helpers/proxy.php @@ -7,6 +7,9 @@ function getProxyConfiguration(Server $server) { $proxy_path = config('coolify.proxy_config_path'); + if (config('app.env') === 'local') { + $proxy_path = $proxy_path . '/testing-host-1/'; + } $networks = collect($server->standaloneDockers)->map(function ($docker) { return $docker['network']; })->unique(); diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 5d0666951..eb4c6f406 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -46,19 +46,20 @@ function remote_process( function save_private_key_for_server(Server $server) { $temp_file = "id.root@{$server->ip}"; - Storage::disk('ssh-keys')->put($temp_file, $server->privateKey->private_key); - return '/var/www/html/storage/app/ssh-keys/' . $temp_file; + LocalStorage::ssh_keys()->put($temp_file, $server->privateKey->private_key); + return '/var/www/html/storage/app/private/ssh/keys/' . $temp_file; } function generate_ssh_command(string $private_key_location, string $server_ip, string $user, string $port, string $command, bool $isMux = true) { - Storage::disk('local')->makeDirectory('.ssh'); + LocalStorage::ssh_keys(); + LocalStorage::ssh_mux(); $delimiter = 'EOF-COOLIFY-SSH'; $ssh_command = "ssh "; if ($isMux && config('coolify.mux_enabled')) { - $ssh_command .= '-o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/var/www/html/storage/app/.ssh/ssh_mux_%h_%p_%r '; + $ssh_command .= '-o ControlMaster=auto -o ControlPersist=1m -o ControlPath=/var/www/html/storage/app/private/ssh/mux/%h_%p_%r '; } $ssh_command .= "-i {$private_key_location} " . '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ' @@ -85,6 +86,7 @@ function instant_remote_process(array $command, Server $server, $throwError = tr $output = trim($process->output()); $exitCode = $process->exitCode(); if ($exitCode !== 0) { + Log::info($process->errorOutput()); if (!$throwError) { return null; } diff --git a/bootstrap/helpers/storage.php b/bootstrap/helpers/storage.php new file mode 100644 index 000000000..488be38c3 --- /dev/null +++ b/bootstrap/helpers/storage.php @@ -0,0 +1,38 @@ + 'local', + 'root' => storage_path("app/private/deployments"), + 'visibility' => 'private', + ]); + $storage->makeDirectory('.'); + return $storage; + } + public static function ssh_keys() + { + $storage = Storage::build([ + 'driver' => 'local', + 'root' => storage_path("app/private/ssh/keys"), + 'visibility' => 'private' + ]); + $storage->makeDirectory('.'); + return $storage; + } + public static function ssh_mux() + { + $storage = Storage::build([ + 'driver' => 'local', + 'root' => storage_path("app/private/ssh/mux"), + 'visibility' => 'private', + ]); + $storage->makeDirectory('.'); + return $storage; + } +} diff --git a/config/filesystems.php b/config/filesystems.php index 5b579dc62..c19374b53 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -29,7 +29,6 @@ */ 'disks' => [ - 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), @@ -39,7 +38,7 @@ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', 'throw' => false, ], diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index ff7a7e716..05ae5c747 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('users', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->boolean('is_root_user')->default(false); $table->string('name')->default('Your Name Here'); diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index 954f7518f..73b428ada 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('personal_access_tokens', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->morphs('tokenable'); $table->string('name'); $table->string('token', 64)->unique(); diff --git a/database/migrations/2023_03_20_112811_create_teams_table.php b/database/migrations/2023_03_20_112811_create_teams_table.php index 77e7b840f..815392b1f 100644 --- a/database/migrations/2023_03_20_112811_create_teams_table.php +++ b/database/migrations/2023_03_20_112811_create_teams_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('teams', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); $table->boolean('personal_team')->default(false); diff --git a/database/migrations/2023_03_20_112812_create_team_user_table.php b/database/migrations/2023_03_20_112812_create_team_user_table.php index 3e2787630..7b0956352 100644 --- a/database/migrations/2023_03_20_112812_create_team_user_table.php +++ b/database/migrations/2023_03_20_112812_create_team_user_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('team_user', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->foreignId('team_id'); $table->foreignId('user_id'); $table->string('role')->nullable(); diff --git a/database/migrations/2023_03_20_112813_create_instance_settings_table.php b/database/migrations/2023_03_20_112813_create_instance_settings_table.php index a6e241bb0..77fc68853 100644 --- a/database/migrations/2023_03_20_112813_create_instance_settings_table.php +++ b/database/migrations/2023_03_20_112813_create_instance_settings_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('instance_settings', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('fqdn')->nullable(); $table->string('wildcard_domain')->nullable(); $table->string('redirect_url')->nullable(); diff --git a/database/migrations/2023_03_24_140711_create_servers_table.php b/database/migrations/2023_03_24_140711_create_servers_table.php index 84e2ab6ba..a8a964e8e 100644 --- a/database/migrations/2023_03_24_140711_create_servers_table.php +++ b/database/migrations/2023_03_24_140711_create_servers_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('servers', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); $table->string('description')->nullable(); diff --git a/database/migrations/2023_03_24_140712_create_server_settings_table.php b/database/migrations/2023_03_24_140712_create_server_settings_table.php index 30ede3870..5cad56b50 100644 --- a/database/migrations/2023_03_24_140712_create_server_settings_table.php +++ b/database/migrations/2023_03_24_140712_create_server_settings_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('server_settings', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->boolean('is_part_of_swarm')->default(false); diff --git a/database/migrations/2023_03_24_140853_create_private_keys_table.php b/database/migrations/2023_03_24_140853_create_private_keys_table.php index 2795f6b0e..176af3938 100644 --- a/database/migrations/2023_03_24_140853_create_private_keys_table.php +++ b/database/migrations/2023_03_24_140853_create_private_keys_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('private_keys', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); $table->string('description')->nullable(); diff --git a/database/migrations/2023_03_27_075351_create_projects_table.php b/database/migrations/2023_03_27_075351_create_projects_table.php index 432496268..a8010757a 100644 --- a/database/migrations/2023_03_27_075351_create_projects_table.php +++ b/database/migrations/2023_03_27_075351_create_projects_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('projects', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); $table->string('description')->nullable(); diff --git a/database/migrations/2023_03_27_075443_create_project_settings_table.php b/database/migrations/2023_03_27_075443_create_project_settings_table.php index 40e8bed1f..06bf554dc 100644 --- a/database/migrations/2023_03_27_075443_create_project_settings_table.php +++ b/database/migrations/2023_03_27_075443_create_project_settings_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('project_settings', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('wildcard_domain')->nullable(); diff --git a/database/migrations/2023_03_27_075444_create_environments_table.php b/database/migrations/2023_03_27_075444_create_environments_table.php index f9514dcce..a8cd055e0 100644 --- a/database/migrations/2023_03_27_075444_create_environments_table.php +++ b/database/migrations/2023_03_27_075444_create_environments_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('environments', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('name'); $table->foreignId('project_id'); $table->timestamps(); diff --git a/database/migrations/2023_03_27_081716_create_applications_table.php b/database/migrations/2023_03_27_081716_create_applications_table.php index b180ca8b9..fdfc68cff 100644 --- a/database/migrations/2023_03_27_081716_create_applications_table.php +++ b/database/migrations/2023_03_27_081716_create_applications_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('applications', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->integer('repository_project_id')->nullable(); $table->string('uuid')->unique(); $table->string('name'); diff --git a/database/migrations/2023_03_27_081717_create_application_settings_table.php b/database/migrations/2023_03_27_081717_create_application_settings_table.php index 0e7e386a2..eeb65dfe1 100644 --- a/database/migrations/2023_03_27_081717_create_application_settings_table.php +++ b/database/migrations/2023_03_27_081717_create_application_settings_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('application_settings', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->boolean('is_static')->default(false); $table->boolean('is_git_submodules_allowed')->default(true); $table->boolean('is_git_lfs_allowed')->default(true); diff --git a/database/migrations/2023_03_27_083620_create_databases_table.php b/database/migrations/2023_03_27_083620_create_databases_table.php index bfafb9c0c..d60d66a28 100644 --- a/database/migrations/2023_03_27_083620_create_databases_table.php +++ b/database/migrations/2023_03_27_083620_create_databases_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('databases', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); diff --git a/database/migrations/2023_03_27_083621_create_services_table.php b/database/migrations/2023_03_27_083621_create_services_table.php index 12bb77b1b..812e7901f 100644 --- a/database/migrations/2023_03_27_083621_create_services_table.php +++ b/database/migrations/2023_03_27_083621_create_services_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('services', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); diff --git a/database/migrations/2023_03_27_085020_create_standalone_dockers_table.php b/database/migrations/2023_03_27_085020_create_standalone_dockers_table.php index f7f430099..635b1f6c5 100644 --- a/database/migrations/2023_03_27_085020_create_standalone_dockers_table.php +++ b/database/migrations/2023_03_27_085020_create_standalone_dockers_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('standalone_dockers', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('name'); $table->string('uuid')->unique(); $table->string('network'); diff --git a/database/migrations/2023_03_27_085022_create_swarm_dockers_table.php b/database/migrations/2023_03_27_085022_create_swarm_dockers_table.php index ea85640ba..79af98cb7 100644 --- a/database/migrations/2023_03_27_085022_create_swarm_dockers_table.php +++ b/database/migrations/2023_03_27_085022_create_swarm_dockers_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('swarm_dockers', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('name'); $table->string('uuid')->unique(); diff --git a/database/migrations/2023_03_28_062150_create_kubernetes_table.php b/database/migrations/2023_03_28_062150_create_kubernetes_table.php index 365380e1f..1b46a63fa 100644 --- a/database/migrations/2023_03_28_062150_create_kubernetes_table.php +++ b/database/migrations/2023_03_28_062150_create_kubernetes_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('kubernetes', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->timestamps(); diff --git a/database/migrations/2023_03_28_083722_create_gits_table.php b/database/migrations/2023_03_28_083722_create_gits_table.php index cb7a8de1d..56eb2586e 100644 --- a/database/migrations/2023_03_28_083722_create_gits_table.php +++ b/database/migrations/2023_03_28_083722_create_gits_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('gits', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->enum('type', ['github', 'gitlab', 'bitbucket', 'custom']); $table->string('api_url'); diff --git a/database/migrations/2023_03_28_083723_create_github_apps_table.php b/database/migrations/2023_03_28_083723_create_github_apps_table.php index 27f193912..a41dabee7 100644 --- a/database/migrations/2023_03_28_083723_create_github_apps_table.php +++ b/database/migrations/2023_03_28_083723_create_github_apps_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('github_apps', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); diff --git a/database/migrations/2023_03_28_083726_create_gitlab_apps_table.php b/database/migrations/2023_03_28_083726_create_gitlab_apps_table.php index 24db88d86..c93ca8e19 100644 --- a/database/migrations/2023_03_28_083726_create_gitlab_apps_table.php +++ b/database/migrations/2023_03_28_083726_create_gitlab_apps_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('gitlab_apps', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); diff --git a/database/migrations/2023_04_03_111012_create_local_persistent_volumes_table.php b/database/migrations/2023_04_03_111012_create_local_persistent_volumes_table.php index e6f6c2e4a..4e610e620 100644 --- a/database/migrations/2023_04_03_111012_create_local_persistent_volumes_table.php +++ b/database/migrations/2023_04_03_111012_create_local_persistent_volumes_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('local_persistent_volumes', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->string('name'); $table->string('mount_path'); diff --git a/database/migrations/2023_05_04_194548_create_environment_variables_table.php b/database/migrations/2023_05_04_194548_create_environment_variables_table.php index 758e74227..8493acd0d 100644 --- a/database/migrations/2023_05_04_194548_create_environment_variables_table.php +++ b/database/migrations/2023_05_04_194548_create_environment_variables_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('environment_variables', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('key'); $table->string('value')->nullable(); diff --git a/database/migrations/2023_05_17_104039_create_failed_jobs_table.php b/database/migrations/2023_05_17_104039_create_failed_jobs_table.php index 249da8171..08606bda4 100644 --- a/database/migrations/2023_05_17_104039_create_failed_jobs_table.php +++ b/database/migrations/2023_05_17_104039_create_failed_jobs_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->text('connection'); $table->text('queue'); diff --git a/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php b/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php index 47796c02b..372984c8b 100644 --- a/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php +++ b/database/migrations/2023_05_24_083426_create_application_deployment_queues_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('application_deployment_queues', function (Blueprint $table) { - $table->id(); + $table->bigIncrements('id'); $table->string('application_id'); $table->integer('pull_request_id')->default(0); $table->schemalessAttributes('metadata'); diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 5ce8f8892..630cb08ca 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -14,6 +14,7 @@ use App\Models\Team; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\Storage; +use LocalStorage; class ProductionSeeder extends Seeder { @@ -56,7 +57,7 @@ public function run(): void // Save SSH Keys for the Coolify Host $coolify_key_name = "id.root@host.docker.internal"; - $coolify_key = Storage::disk('local')->get("ssh-keys/{$coolify_key_name}"); + $coolify_key = LocalStorage::ssh_keys()->get("{$coolify_key_name}"); if ($coolify_key) { $private_key = PrivateKey::find(0); diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 2d088d90a..b0362cc32 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -7,9 +7,7 @@ services: source: /data/coolify/source/.env target: /var/www/html/.env read_only: true - - /data/coolify/deployments:/var/www/html/storage/app/deployments - - /data/coolify/ssh-keys:/var/www/html/storage/app/ssh-keys - - /data/coolify/proxy:/var/www/html/storage/app/proxy + - /data/coolify:/var/www/html/storage/app/ environment: - APP_ENV=production - APP_DEBUG diff --git a/docker-compose.yml b/docker-compose.yml index e84ce3220..ecd3f8b7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,7 @@ services: - coolify depends_on: - postgres + - redis postgres: image: postgres:15-alpine diff --git a/scripts/run b/scripts/run index d0537d85f..546580828 100755 --- a/scripts/run +++ b/scripts/run @@ -60,6 +60,9 @@ function coolify { function coolify:root { bash vendor/bin/spin exec coolify bash } +function coolify:proxy { + docker exec -ti coolify-proxy sh +} function redis { docker exec -ti coolify-redis redis-cli