diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index d6c4b5ccf..eeabb185f 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -97,7 +97,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted if ($this->pull_request_id !== 0) { $this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id); if ($this->application->fqdn) { - $preview_fqdn = getOnlyFqdn(data_get($this->preview, 'fqdn')); + $preview_fqdn = getFqdnWithoutPort(data_get($this->preview, 'fqdn')); $template = $this->application->preview_url_template; $url = Url::fromString($this->application->fqdn); $host = $url->getHost(); @@ -284,9 +284,20 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted private function rolling_update() { - $this->start_by_compose_file(); - $this->health_check(); - $this->stop_running_container(); + if (count($this->application->ports_mappings_array) > 0){ + $this->execute_remote_command( + ["echo -n 'Application has ports mapped to the host system, rolling update is not supported. Stopping current container.'"], + ); + $this->stop_running_container(force: true); + $this->start_by_compose_file(); + } else { + $this->execute_remote_command( + ["echo -n 'Rolling update started.'"], + ); + $this->start_by_compose_file(); + $this->health_check(); + $this->stop_running_container(); + } } private function health_check() { @@ -529,7 +540,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted 'restart' => RESTART_MODE, 'environment' => $environment_variables, 'labels' => generateLabelsApplication($this->application, $this->preview), - // 'expose' => $ports, + 'expose' => $ports, 'networks' => [ $this->destination->network, ], @@ -704,10 +715,10 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); } } - private function stop_running_container() + private function stop_running_container(bool $force = false) { if ($this->currently_running_container_name) { - if ($this->newVersionIsHealthy) { + if ($this->newVersionIsHealthy || $force) { $this->execute_remote_command( ["echo -n 'Removing old version of your application.'"], [executeInDocker($this->deployment_uuid, "docker rm -f $this->currently_running_container_name >/dev/null 2>&1"), "hidden" => true], @@ -724,7 +735,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf"); private function start_by_compose_file() { $this->execute_remote_command( - ["echo -n 'Rolling update started.'"], + ["echo -n 'Starting application (could take a while).'"], [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} up -d >/dev/null"), "hidden" => true], ); } diff --git a/app/Models/Service.php b/app/Models/Service.php index 4b66fdf19..ae590f13f 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -377,7 +377,7 @@ class Service extends BaseModel } else { $number = 0; } - $fqdn = getOnlyFqdn(data_get($fqdns, $number, $fqdns->first())); + $fqdn = getFqdnWithoutPort(data_get($fqdns, $number, $fqdns->first())); $environments = collect(data_get($service, 'environment')); $environments = $environments->map(function ($envValue) use ($value, $fqdn) { $envValue = Str::of($envValue)->replace($value, $fqdn); @@ -393,7 +393,7 @@ class Service extends BaseModel } else { $number = 0; } - $fqdn = getOnlyFqdn(data_get($fqdns, $number, $fqdns->first())); + $fqdn = getFqdnWithoutPort(data_get($fqdns, $number, $fqdns->first())); $url = Url::fromString($fqdn)->getHost(); $environments = collect(data_get($service, 'environment')); $environments = $environments->map(function ($envValue) use ($value, $url) { diff --git a/app/View/Components/Services/Links.php b/app/View/Components/Services/Links.php index 69fefa7a2..b2cc8618d 100644 --- a/app/View/Components/Services/Links.php +++ b/app/View/Components/Services/Links.php @@ -19,7 +19,7 @@ class Links extends Component if ($application->fqdn) { $fqdns = collect(Str::of($application->fqdn)->explode(',')); $fqdns->map(function ($fqdn) { - $this->links->push(getOnlyFqdn($fqdn)); + $this->links->push(getFqdnWithoutPort($fqdn)); }); } if ($application->ports) { diff --git a/bootstrap/helpers/docker.php b/bootstrap/helpers/docker.php index 6d8e2e024..27fa96fb8 100644 --- a/bootstrap/helpers/docker.php +++ b/bootstrap/helpers/docker.php @@ -147,7 +147,7 @@ function fqdnLabelsForTraefik(Collection $domains, $container_name, $is_force_ht { $labels = collect([]); $labels->push('traefik.enable=true'); - foreach($domains as $domain) { + foreach ($domains as $domain) { $url = Url::fromString($domain); $host = $url->getHost(); $path = $url->getPath(); @@ -216,9 +216,8 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview } else { $domains = Str::of(data_get($application, 'fqdn'))->explode(','); } - if ($application->destination->server->proxy->type === ProxyTypes::TRAEFIK_V2->value) { - $labels = $labels->merge(fqdnLabelsForTraefik($domains, $container_name, $application->settings->is_force_https_enabled)); - } + // Add Traefik labels no matter which proxy is selected + $labels = $labels->merge(fqdnLabelsForTraefik($domains, $container_name, $application->settings->is_force_https_enabled)); } return $labels->all(); } diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 0d76d46ea..e5a2a5863 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -189,7 +189,7 @@ function validateServer(Server $server, bool $throwError = false) ]; } $server->settings->is_reachable = true; - + instant_remote_process(["docker ps"], $server, $throwError); $dockerVersion = instant_remote_process(["docker version|head -2|grep -i version| awk '{print $2}'"], $server, $throwError); if (!$dockerVersion) { $dockerVersion = null; diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index cb1a758a9..63f7fb8b1 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -100,7 +100,8 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n return "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds."; } if (isset($livewire)) { - return $livewire->emit('error', $message); + $livewire->emit('error', $message); + throw new RuntimeException($message); } throw new RuntimeException($message); @@ -240,11 +241,13 @@ function base_ip(): string } return "localhost"; } -function getOnlyFqdn(String $fqdn) { +function getFqdnWithoutPort(String $fqdn) +{ $url = Url::fromString($fqdn); $host = $url->getHost(); $scheme = $url->getScheme(); - return "$scheme://$host"; + $path = $url->getPath(); + return "$scheme://$host$path"; } /** * If fqdn is set, return it, otherwise return public ip. diff --git a/config/sentry.php b/config/sentry.php index 39c920a43..3a1955646 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // 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.44', + 'release' => '4.0.0-beta.45', // 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 34ed5e7bd..462d9f013 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ explode(',') as $fqdn)
  • + target="_blank" href="{{ getFqdnWithoutPort($fqdn) }}"> @@ -28,7 +28,7 @@ - {{ getOnlyFqdn($fqdn) }} + {{ getFqdnWithoutPort($fqdn) }}
  • @endforeach @@ -38,7 +38,7 @@ @if (data_get($preview, 'fqdn'))
  • + target="_blank" href="{{ getFqdnWithoutPort(data_get($preview, 'fqdn')) }}"> diff --git a/resources/views/components/version.blade.php b/resources/views/components/version.blade.php index 28d5f6206..3ed4586da 100644 --- a/resources/views/components/version.blade.php +++ b/resources/views/components/version.blade.php @@ -1,2 +1,2 @@ -merge(['class' => 'text-xs cursor-pointer opacity-20 hover:opacity-100 hover:text-white']) }} +merge(['class' => 'text-xs cursor-pointer opacity-20 hover:opacity-100 hover:text-white z-50']) }} href="https://github.com/coollabsio/coolify/releases/tag/v{{ config('version') }}">v{{ config('version') }} diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index e825b5493..00c8b7b87 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -2,7 +2,7 @@ @section('body') @parent -
    +
    diff --git a/resources/views/layouts/subscription.blade.php b/resources/views/layouts/subscription.blade.php index 2feb5199b..1ece2d7ee 100644 --- a/resources/views/layouts/subscription.blade.php +++ b/resources/views/layouts/subscription.blade.php @@ -2,7 +2,7 @@ @section('body') @parent @if (isSubscriptionOnGracePeriod()) -
    +
    diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index a0089079a..ca3fb7a6e 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -26,6 +26,14 @@ @endif @endif
    + @if (!$application->dockerfile) +
    + + + + +
    + @endif @if ($application->settings->is_static) @@ -54,6 +62,7 @@ @if ($application->dockerfile) @endif +

    Network

    @if ($application->settings->is_static) @@ -63,7 +72,7 @@ helper="A comma separated list of ports your application uses. The first port will be used as default healthcheck port if nothing defined in the Healthcheck menu. Be sure to set this correctly." /> @endif + helper="A comma separated list of ports you would like to map to the host system. Useful when you do not want to use domains.

    Example:
    3000:3000,3002:3002

    Rolling update is not supported if you have a port mapped to the host." />

    Advanced

    diff --git a/resources/views/source/all.blade.php b/resources/views/source/all.blade.php index 9c82fec0c..e04c948ae 100644 --- a/resources/views/source/all.blade.php +++ b/resources/views/source/all.blade.php @@ -1,5 +1,10 @@ -

    Sources

    +
    +

    Sources

    +
    + + Add + +
    All Sources
    @forelse ($sources as $source) diff --git a/versions.json b/versions.json index 5032537ad..2be8e98ba 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.36" }, "v4": { - "version": "4.0.0-beta.44" + "version": "4.0.0-beta.45" } } }