diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 5ee5c3970..e06791bae 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -1,6 +1,6 @@ name: Bug report -description: 'Create a new bug report.' -title: '[Bug]: ' +description: "Create a new bug report." +title: "[Bug]: " body: - type: markdown attributes: @@ -35,3 +35,12 @@ body: description: Coolify's version (see top of your screen). validations: required: true + - type: checkboxes + attributes: + label: Cloud? + description: "Are you using the cloud version of Coolify?" + options: + - label: Yes + required: false + - label: No + required: false diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index f529f63b9..c6ee39524 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -6,6 +6,7 @@ use App\Jobs\CleanupInstanceStuffsJob; use App\Jobs\ContainerStatusJob; use App\Jobs\DatabaseBackupJob; +use App\Jobs\DockerCleanupJob; use App\Jobs\PullCoolifyImageJob; use App\Jobs\PullHelperImageJob; use App\Jobs\PullSentinelImageJob; @@ -87,6 +88,7 @@ private function check_resources($schedule) } foreach ($servers as $server) { $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer(); + $schedule->job(new DockerCleanupJob($server))->everyTenMinutes()->onOneServer(); } } diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php index d8175ffe9..bb8c44050 100644 --- a/app/Http/Controllers/Api/ApplicationsController.php +++ b/app/Http/Controllers/Api/ApplicationsController.php @@ -732,8 +732,10 @@ private function create_application(Request $request, $type) $application->environment_id = $environment->id; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -826,8 +828,10 @@ private function create_application(Request $request, $type) $application->source_id = $githubApp->id; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -916,8 +920,10 @@ private function create_application(Request $request, $type) $application->environment_id = $environment->id; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -996,8 +1002,10 @@ private function create_application(Request $request, $type) $application->git_branch = 'main'; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -1052,8 +1060,10 @@ private function create_application(Request $request, $type) $application->git_branch = 'main'; $application->save(); $application->refresh(); - $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->save(); + if (! $application->settings->is_container_label_readonly_enabled) { + $application->custom_labels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->save(); + } $application->isConfigurationChanged(true); if ($instantDeploy) { @@ -1494,8 +1504,10 @@ public function update_by_uuid(Request $request) $fqdn = str($fqdn)->replaceEnd(',', '')->trim(); $fqdn = str($fqdn)->replaceStart(',', '')->trim(); $application->fqdn = $fqdn; - $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); - $application->custom_labels = base64_encode($customLabels); + if (! $application->settings->is_container_label_readonly_enabled) { + $customLabels = str(implode('|coolify|', generateLabelsApplication($application)))->replace('|coolify|', "\n"); + $application->custom_labels = base64_encode($customLabels); + } $request->offsetUnset('domains'); } diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index ac48945f5..3024bf393 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -157,6 +157,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue private ?string $coolify_variables = null; + private bool $preserveRepository = true; + public $tries = 1; public function __construct(int $application_deployment_queue_id) @@ -187,6 +189,7 @@ public function __construct(int $application_deployment_queue_id) $this->server = $this->mainServer = $this->destination->server; $this->serverUser = $this->server->user; $this->is_this_additional_server = $this->application->additional_servers()->wherePivot('server_id', $this->server->id)->count() > 0; + $this->preserveRepository = $this->application->settings->is_preserve_repository_enabled; $this->basedir = $this->application->generateBaseDir($this->deployment_uuid); $this->workdir = "{$this->basedir}".rtrim($this->application->base_directory, '/'); @@ -296,13 +299,13 @@ public function handle(): void } else { $this->write_deployment_configurations(); } - $this->execute_remote_command( - [ - "docker rm -f {$this->deployment_uuid} >/dev/null 2>&1", - 'hidden' => true, - 'ignore_errors' => true, - ] - ); + // $this->execute_remote_command( + // [ + // "docker rm -f {$this->deployment_uuid} >/dev/null 2>&1", + // 'hidden' => true, + // 'ignore_errors' => true, + // ] + // ); // $this->execute_remote_command( // [ @@ -517,6 +520,8 @@ private function deploy_docker_compose_buildpack() $command .= " --env-file {$this->workdir}/{$this->env_filename}"; } $command .= " --project-name {$this->application->uuid} --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} up -d"; + ray($command); + $this->execute_remote_command( [executeInDocker($this->deployment_uuid, $command), 'hidden' => true], ); @@ -605,6 +610,28 @@ private function deploy_static_buildpack() private function write_deployment_configurations() { + if ($this->preserveRepository) { + if ($this->use_build_server) { + $this->server = $this->original_server; + } + if (str($this->configuration_dir)->isNotEmpty()) { + ray("docker cp {$this->deployment_uuid}:{$this->workdir} {$this->configuration_dir}"); + $this->execute_remote_command( + [ + "mkdir -p $this->configuration_dir", + ], + [ + "rm -rf $this->configuration_dir/{*,.*}", + ], + [ + "docker cp {$this->deployment_uuid}:{$this->workdir}/. {$this->configuration_dir}", + ], + ); + } + if ($this->use_build_server) { + $this->server = $this->build_server; + } + } if (isset($this->docker_compose_base64)) { if ($this->use_build_server) { $this->server = $this->original_server; @@ -1007,7 +1034,7 @@ private function rolling_update() if ((bool) $this->application->settings->is_consistent_container_name_enabled) { $this->application_deployment_queue->addLogEntry('Consistent container name feature enabled, rolling update is not supported.'); } - if (isset($this->application->settings->custom_internal_name)) { + if (str($this->application->settings->custom_internal_name)->isNotEmpty()) { $this->application_deployment_queue->addLogEntry('Custom internal name is set, rolling update is not supported.'); } if ($this->pull_request_id !== 0) { @@ -1523,7 +1550,9 @@ private function generate_compose_file() $this->application->custom_labels = base64_encode($labels->implode("\n")); $this->application->save(); } else { - $labels = collect(generateLabelsApplication($this->application, $this->preview)); + if (! $this->application->settings->is_container_label_readonly_enabled) { + $labels = collect(generateLabelsApplication($this->application, $this->preview)); + } } if ($this->pull_request_id !== 0) { $labels = collect(generateLabelsApplication($this->application, $this->preview)); diff --git a/app/Jobs/DockerCleanupJob.php b/app/Jobs/DockerCleanupJob.php index 785940ee6..f99a65b5d 100644 --- a/app/Jobs/DockerCleanupJob.php +++ b/app/Jobs/DockerCleanupJob.php @@ -12,7 +12,6 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; -use RuntimeException; class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue { @@ -20,47 +19,48 @@ class DockerCleanupJob implements ShouldBeEncrypted, ShouldQueue public $timeout = 300; - public ?int $usageBefore = null; + public int|string|null $usageBefore = null; public function __construct(public Server $server) {} public function handle(): void { try { - $isInprogress = false; - $this->server->applications()->each(function ($application) use (&$isInprogress) { - if ($application->isDeploymentInprogress()) { - $isInprogress = true; + // $isInprogress = false; + // $this->server->applications()->each(function ($application) use (&$isInprogress) { + // if ($application->isDeploymentInprogress()) { + // $isInprogress = true; - return; - } - }); + // return; + // } + // }); // if ($isInprogress) { // throw new RuntimeException('DockerCleanupJob: ApplicationDeploymentQueue is not empty, skipping...'); // } if (! $this->server->isFunctional()) { return; } + if ($this->server->settings->is_force_cleanup_enabled) { + Log::info('DockerCleanupJob force cleanup on '.$this->server->name); + CleanupDocker::run(server: $this->server, force: true); + + return; + } + $this->usageBefore = $this->server->getDiskUsage(); - ray('Usage before: '.$this->usageBefore); if ($this->usageBefore >= $this->server->settings->cleanup_after_percentage) { - ray('Cleaning up '.$this->server->name); - CleanupDocker::run($this->server); + CleanupDocker::run(server: $this->server, force: false); $usageAfter = $this->server->getDiskUsage(); if ($usageAfter < $this->usageBefore) { $this->server->team?->notify(new DockerCleanup($this->server, 'Saved '.($this->usageBefore - $usageAfter).'% disk space.')); - // ray('Saved ' . ($this->usageBefore - $usageAfter) . '% disk space on ' . $this->server->name); - // send_internal_notification('DockerCleanupJob done: Saved ' . ($this->usageBefore - $usageAfter) . '% disk space on ' . $this->server->name); Log::info('DockerCleanupJob done: Saved '.($this->usageBefore - $usageAfter).'% disk space on '.$this->server->name); } else { Log::info('DockerCleanupJob failed to save disk space on '.$this->server->name); } } else { - ray('No need to clean up '.$this->server->name); Log::info('No need to clean up '.$this->server->name); } } catch (\Throwable $e) { - // send_internal_notification('DockerCleanupJob failed with: '.$e->getMessage()); ray($e->getMessage()); throw $e; } diff --git a/app/Jobs/ServerStatusJob.php b/app/Jobs/ServerStatusJob.php index bddafe2ba..ac9182eca 100644 --- a/app/Jobs/ServerStatusJob.php +++ b/app/Jobs/ServerStatusJob.php @@ -3,7 +3,6 @@ namespace App\Jobs; use App\Models\Server; -use App\Notifications\Server\HighDiskUsage; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeEncrypted; use Illuminate\Contracts\Queue\ShouldQueue; @@ -44,7 +43,6 @@ public function handle() } try { if ($this->server->isFunctional()) { - $this->cleanup(notify: false); $this->remove_unnecessary_coolify_yaml(); if ($this->server->isSentinelEnabled()) { $this->server->checkSentinel(); @@ -56,45 +54,7 @@ public function handle() return handleError($e); } - try { - // $this->check_docker_engine(); - } catch (\Throwable $e) { - // Do nothing - } - } - private function check_docker_engine() - { - $version = instant_remote_process([ - 'docker info', - ], $this->server, false); - if (is_null($version)) { - $os = instant_remote_process([ - 'cat /etc/os-release | grep ^ID=', - ], $this->server, false); - $os = str($os)->after('ID=')->trim(); - if ($os === 'ubuntu') { - try { - instant_remote_process([ - 'systemctl start docker', - ], $this->server); - } catch (\Throwable $e) { - ray($e->getMessage()); - - return handleError($e); - } - } else { - try { - instant_remote_process([ - 'service docker start', - ], $this->server); - } catch (\Throwable $e) { - ray($e->getMessage()); - - return handleError($e); - } - } - } } private function remove_unnecessary_coolify_yaml() @@ -108,28 +68,4 @@ private function remove_unnecessary_coolify_yaml() ], $this->server, false); } } - - public function cleanup(bool $notify = false): void - { - $this->disk_usage = $this->server->getDiskUsage(); - if ($this->disk_usage >= $this->server->settings->cleanup_after_percentage) { - if ($notify) { - if ($this->server->high_disk_usage_notification_sent) { - ray('high disk usage notification already sent'); - - return; - } else { - $this->server->high_disk_usage_notification_sent = true; - $this->server->save(); - $this->server->team?->notify(new HighDiskUsage($this->server, $this->disk_usage, $this->server->settings->cleanup_after_percentage)); - } - } else { - DockerCleanupJob::dispatchSync($this->server); - $this->cleanup(notify: true); - } - } else { - $this->server->high_disk_usage_notification_sent = false; - $this->server->save(); - } - } } diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php index 91828d42c..7dfd9bad4 100644 --- a/app/Livewire/Project/Application/General.php +++ b/app/Livewire/Project/Application/General.php @@ -84,6 +84,8 @@ class General extends Component 'application.settings.is_static' => 'boolean|required', 'application.settings.is_build_server_enabled' => 'boolean|required', 'application.settings.is_container_label_escape_enabled' => 'boolean|required', + 'application.settings.is_container_label_readonly_enabled' => 'boolean|required', + 'application.settings.is_preserve_repository_enabled' => 'boolean|required', 'application.watch_paths' => 'nullable', 'application.redirect' => 'string|required', ]; @@ -119,6 +121,8 @@ class General extends Component 'application.settings.is_static' => 'Is static', 'application.settings.is_build_server_enabled' => 'Is build server enabled', 'application.settings.is_container_label_escape_enabled' => 'Is container label escape enabled', + 'application.settings.is_container_label_readonly_enabled' => 'Is container label readonly', + 'application.settings.is_preserve_repository_enabled' => 'Is preserve repository enabled', 'application.watch_paths' => 'Watch paths', 'application.redirect' => 'Redirect', ]; @@ -143,7 +147,7 @@ public function mount() $this->ports_exposes = $this->application->ports_exposes; $this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled; $this->customLabels = $this->application->parseContainerLabels(); - if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') { + if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE' && ! $this->application->settings->is_container_label_readonly_enabled) { $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->application->custom_labels = base64_encode($this->customLabels); $this->application->save(); @@ -290,6 +294,9 @@ public function getWildcardDomain() public function resetDefaultLabels() { + if ($this->application->settings->is_container_label_readonly_enabled) { + return; + } $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->ports_exposes = $this->application->ports_exposes; $this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled; @@ -350,7 +357,7 @@ public function submit($showToaster = true) $this->checkFqdns(); $this->application->save(); - if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') { + if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE' && ! $this->application->settings->is_container_label_readonly_enabled) { $this->customLabels = str(implode('|coolify|', generateLabelsApplication($this->application)))->replace('|coolify|', "\n"); $this->application->custom_labels = base64_encode($this->customLabels); $this->application->save(); diff --git a/app/Livewire/Project/New/PublicGitRepository.php b/app/Livewire/Project/New/PublicGitRepository.php index 867d398df..b29fe8cab 100644 --- a/app/Livewire/Project/New/PublicGitRepository.php +++ b/app/Livewire/Project/New/PublicGitRepository.php @@ -25,11 +25,11 @@ class PublicGitRepository extends Component public $query; - public bool $branch_found = false; + public bool $branchFound = false; - public string $selected_branch = 'main'; + public string $selectedBranch = 'main'; - public bool $is_static = false; + public bool $isStatic = false; public ?string $publish_directory = null; @@ -62,7 +62,7 @@ class PublicGitRepository extends Component protected $rules = [ 'repository_url' => 'required|url', 'port' => 'required|numeric', - 'is_static' => 'required|boolean', + 'isStatic' => 'required|boolean', 'publish_directory' => 'nullable|string', 'build_pack' => 'required|string', 'base_directory' => 'nullable|string', @@ -72,7 +72,7 @@ class PublicGitRepository extends Component protected $validationAttributes = [ 'repository_url' => 'repository', 'port' => 'port', - 'is_static' => 'static', + 'isStatic' => 'static', 'publish_directory' => 'publish directory', 'build_pack' => 'build pack', 'base_directory' => 'base directory', @@ -106,17 +106,17 @@ public function updatedBuildPack() $this->port = 3000; } elseif ($this->build_pack === 'static') { $this->show_is_static = false; - $this->is_static = false; + $this->isStatic = false; $this->port = 80; } else { $this->show_is_static = false; - $this->is_static = false; + $this->isStatic = false; } } public function instantSave() { - if ($this->is_static) { + if ($this->isStatic) { $this->port = 80; $this->publish_directory = '/dist'; } else { @@ -126,12 +126,7 @@ public function instantSave() $this->dispatch('success', 'Application settings updated!'); } - public function load_any_git() - { - $this->branch_found = true; - } - - public function load_branch() + public function loadBranch() { try { if (str($this->repository_url)->startsWith('git@')) { @@ -155,15 +150,21 @@ public function load_branch() return handleError($e, $this); } try { - $this->branch_found = false; - $this->get_git_source(); - $this->get_branch(); - $this->selected_branch = $this->git_branch; + $this->branchFound = false; + $this->getGitSource(); + $this->getBranch(); + $this->selectedBranch = $this->git_branch; } catch (\Throwable $e) { - if (! $this->branch_found && $this->git_branch == 'main') { + if ($this->rate_limit_remaining == 0) { + $this->selectedBranch = $this->git_branch; + $this->branchFound = true; + + return; + } + if (! $this->branchFound && $this->git_branch == 'main') { try { $this->git_branch = 'master'; - $this->get_branch(); + $this->getBranch(); } catch (\Throwable $e) { return handleError($e, $this); } @@ -173,13 +174,16 @@ public function load_branch() } } - private function get_git_source() + private function getGitSource() { $this->repository_url_parsed = Url::fromString($this->repository_url); $this->git_host = $this->repository_url_parsed->getHost(); $this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2); - $this->git_branch = $this->repository_url_parsed->getSegment(4) ?? 'main'; - + if ($this->repository_url_parsed->getSegment(3) === 'tree') { + $this->git_branch = str($this->repository_url_parsed->getPath())->after('tree/')->value(); + } else { + $this->git_branch = 'main'; + } if ($this->git_host == 'github.com') { $this->git_source = GithubApp::where('name', 'Public GitHub')->first(); @@ -189,17 +193,17 @@ private function get_git_source() $this->git_source = 'other'; } - private function get_branch() + private function getBranch() { if ($this->git_source === 'other') { - $this->branch_found = true; + $this->branchFound = true; return; } if ($this->git_source->getMorphClass() === 'App\Models\GithubApp') { ['rate_limit_remaining' => $this->rate_limit_remaining, 'rate_limit_reset' => $this->rate_limit_reset] = githubApi(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches/{$this->git_branch}"); $this->rate_limit_reset = Carbon::parse((int) $this->rate_limit_reset)->format('Y-M-d H:i:s'); - $this->branch_found = true; + $this->branchFound = true; } } @@ -287,7 +291,7 @@ public function submit() } $application = Application::create($application_init); - $application->settings->is_static = $this->is_static; + $application->settings->is_static = $this->isStatic; $application->settings->save(); $fqdn = generateFqdn($destination->server, $application->uuid); diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.php index 5616123a5..c2a55afcb 100644 --- a/app/Livewire/Server/Form.php +++ b/app/Livewire/Server/Form.php @@ -37,6 +37,7 @@ class Form extends Component 'server.settings.is_swarm_manager' => 'required|boolean', 'server.settings.is_swarm_worker' => 'required|boolean', 'server.settings.is_build_server' => 'required|boolean', + 'server.settings.is_force_cleanup_enabled' => 'required|boolean', 'server.settings.concurrent_builds' => 'required|integer|min:1', 'server.settings.dynamic_timeout' => 'required|integer|min:1', 'server.settings.is_metrics_enabled' => 'required|boolean', diff --git a/app/Models/Service.php b/app/Models/Service.php index 2fc0778e6..8336b90c8 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -24,6 +24,7 @@ 'destination_id' => ['type' => 'integer', 'description' => 'The unique identifier of the destination where the service is running.'], 'connect_to_docker_network' => ['type' => 'boolean', 'description' => 'The flag to connect the service to the predefined Docker network.'], 'is_container_label_escape_enabled' => ['type' => 'boolean', 'description' => 'The flag to enable the container label escape.'], + 'is_container_label_readonly_enabled' => ['type' => 'boolean', 'description' => 'The flag to enable the container label readonly.'], 'config_hash' => ['type' => 'string', 'description' => 'The hash of the service configuration.'], 'service_type' => ['type' => 'string', 'description' => 'The type of the service.'], 'created_at' => ['type' => 'string', 'description' => 'The date and time when the service was created.'], diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index 21e946a9a..0aa5c6b74 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -48,9 +48,13 @@ function format_docker_command_output_to_json($rawOutput): Collection $outputLines = collect($outputLines); } - return $outputLines - ->reject(fn ($line) => empty($line)) - ->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR)); + try { + return $outputLines + ->reject(fn ($line) => empty($line)) + ->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR)); + } catch (\Throwable $e) { + return collect([]); + } } function format_docker_labels_to_json(string|array $rawOutput): Collection diff --git a/config/sentry.php b/config/sentry.php index 33c7a4795..f65c89760 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.315', + 'release' => '4.0.0-beta.316', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 76a71a716..8821278c1 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ boolean('is_container_label_readonly_enabled')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('application_settings', function (Blueprint $table) { + $table->dropColumn('is_container_label_readonly_enabled'); + }); + } +}; diff --git a/database/migrations/2024_07_18_110424_create_application_settings_is_preserve_repository_enabled.php b/database/migrations/2024_07_18_110424_create_application_settings_is_preserve_repository_enabled.php new file mode 100644 index 000000000..25dd0ef16 --- /dev/null +++ b/database/migrations/2024_07_18_110424_create_application_settings_is_preserve_repository_enabled.php @@ -0,0 +1,28 @@ +boolean('is_preserve_repository_enabled')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('application_settings', function (Blueprint $table) { + $table->dropColumn('is_preserve_repository_enabled'); + }); + } +}; diff --git a/database/migrations/2024_07_18_123458_add_force_cleanup_server.php b/database/migrations/2024_07_18_123458_add_force_cleanup_server.php new file mode 100644 index 000000000..a33665bd0 --- /dev/null +++ b/database/migrations/2024_07_18_123458_add_force_cleanup_server.php @@ -0,0 +1,28 @@ +boolean('is_force_cleanup_enabled')->default(false)->after('is_sentinel_enabled'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('server_settings', function (Blueprint $table) { + $table->dropColumn('is_force_cleanup_enabled'); + }); + } +}; diff --git a/resources/views/livewire/project/application/advanced.blade.php b/resources/views/livewire/project/application/advanced.blade.php index 19cb64a05..dc3f135db 100644 --- a/resources/views/livewire/project/application/advanced.blade.php +++ b/resources/views/livewire/project/application/advanced.blade.php @@ -16,12 +16,13 @@ - @if ($application->build_pack === 'dockercompose') +

Docker Compose

diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 42742a863..232900a5d 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -30,13 +30,7 @@ @endif - @if ($application->could_set_build_commands()) -
- -
- @endif + @if ($application->build_pack === 'dockercompose') @if ( !is_null($parsedServices) && @@ -57,6 +51,7 @@ @endforeach @endif @endif + @endif @if ($application->build_pack !== 'dockercompose') @@ -129,99 +124,152 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" @endif @endif - - @if ($application->build_pack !== 'dockerimage') -

Build

- @if ($application->build_pack !== 'dockercompose') -
- -
- @endif - @if ($application->could_set_build_commands()) - @if ($application->build_pack === 'nixpacks') -
- - - -
-
Nixpacks will detect the required configuration automatically. - Framework - Specific Docs -
- @endif - @endif - @if ($application->build_pack === 'dockercompose') -
-
- - -
-
The following commands are for advanced use cases. Only modify them if you - know what are - you doing.
-
- - -
-
- @else -
- - @if ($application->build_pack === 'dockerfile' && !$application->dockerfile) - - @endif - - @if ($application->build_pack === 'dockerfile') - - @endif - @if ($application->could_set_build_commands()) - @if ($application->settings->is_static) - - @else - - @endif - @endif - -
- @if ($this->application->is_github_based() && !$this->application->is_public_repository()) -
- -
- @endif +
+

Build

+ @if ($application->build_pack === 'dockerimage') + @else + @if ($application->could_set_build_commands()) + @if ($application->build_pack === 'nixpacks') +
+ + + +
+
Nixpacks will detect the required configuration + automatically. + Framework + Specific Docs +
+ @endif + @endif +
+
+ +
+
+ @if ($application->build_pack === 'dockercompose') +
+
+ + +
+
+ +
+
The following commands are for advanced use cases. Only + modify them if you + know what are + you doing.
+
+ + +
+
+ @else +
+ + @if ($application->build_pack === 'dockerfile' && !$application->dockerfile) + + @endif + + @if ($application->build_pack === 'dockerfile') + + @endif + @if ($application->could_set_build_commands()) + @if ($application->settings->is_static) + + @else + + @endif + @endif + +
+ @if ($this->application->is_github_based() && !$this->application->is_public_repository()) +
+ +
+ @endif + + + @if ($application->build_pack !== 'dockercompose') +
+ +
+ @endif + @if ($application->could_set_build_commands()) +
+ +
+ @endif + @endif +
+
+
+
@endif - @else - - @endif +
@if ($application->build_pack === 'dockercompose') Reload Compose File @@ -235,10 +283,13 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" label="Docker Compose Content" helper="You need to modify the docker compose file." monacoEditorLanguage="yaml" useMonacoEditor /> @endif -
+
+
@endif @@ -264,10 +315,13 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry" -
+
+
diff --git a/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php b/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php index e395d186e..d1f5d1bef 100644 --- a/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php +++ b/resources/views/livewire/project/new/github-private-repository-deploy-key.blade.php @@ -48,8 +48,7 @@ class="loading loading-xs dark:text-warning loading-spinner"> @if ($current_step === 'repository')

Select a repository

- +
diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.php index b9803d24f..01cd67575 100644 --- a/resources/views/livewire/project/new/public-git-repository.blade.php +++ b/resources/views/livewire/project/new/public-git-repository.blade.php @@ -1,7 +1,7 @@

Create a new Application

Deploy any public Git repositories.
- +
@@ -11,15 +11,12 @@ Check repository
- @if (!$branch_found) -
-
- For example application deployments, checkout Coolify - Examples. -
- @endif - @if ($branch_found) +
+ For example application deployments, checkout Coolify + Examples. +
+ @if ($branchFound) @if ($rate_limit_remaining && $rate_limit_reset)
Rate Limit
@@ -42,7 +39,7 @@ - @if ($is_static) + @if ($isStatic) @endif @@ -57,10 +54,10 @@ class='dark:text-warning'>{{ Str::start($base_directory . $docker_compose_location, '/') }} @endif @if ($show_is_static) -
-
@endif diff --git a/resources/views/livewire/project/service/edit-compose.blade.php b/resources/views/livewire/project/service/edit-compose.blade.php index 2632fc0ea..3b1e1a3bc 100644 --- a/resources/views/livewire/project/service/edit-compose.blade.php +++ b/resources/views/livewire/project/service/edit-compose.blade.php @@ -3,11 +3,7 @@ prevent name collision.
To see the actual volume names, check the Deployable Compose file, or go to Storage menu.
-
- -
+
@@ -17,6 +13,11 @@
+
+ +
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php index 5cba620dd..e10dec0d4 100644 --- a/resources/views/livewire/server/form.blade.php +++ b/resources/views/livewire/server/form.blade.php @@ -136,13 +136,32 @@ class="w-full mt-8 mb-4 font-bold box-without-bg bg-coollabs hover:bg-coollabs-1 @if ($server->isFunctional())

Settings

-
- - - +
+
+ @if ($server->settings->is_force_cleanup_enabled) +
+ +
+ @else + +
+ +
+ @endif +
+
+ + +

Sentinel

diff --git a/resources/views/livewire/source/github/create.blade.php b/resources/views/livewire/source/github/create.blade.php index 97942fbdb..e93b23b78 100644 --- a/resources/views/livewire/source/github/create.blade.php +++ b/resources/views/livewire/source/github/create.blade.php @@ -13,7 +13,7 @@ this.activeAccordion = (this.activeAccordion == id) ? '' : id } }" class="relative w-full py-2 mx-auto overflow-hidden text-sm font-normal rounded-md"> -
+