Update application and proxy configuration

This commit is contained in:
Andras Bacsai 2024-01-15 10:49:39 +01:00
parent 0f5559bc61
commit da71353bfa
3 changed files with 18 additions and 7 deletions

View File

@ -39,7 +39,7 @@ class Heading extends Component
} else { } else {
dispatch(new ServerStatusJob($this->application->destination->server)); dispatch(new ServerStatusJob($this->application->destination->server));
} }
if ($showNotification) $this->dispatch('success', "Application ({$this->application->name}) status updated."); if ($showNotification) $this->dispatch('success', "Application status updated.");
} }
public function force_deploy_without_cache() public function force_deploy_without_cache()

View File

@ -229,11 +229,12 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
$http_label = "http-{$loop}-{$uuid}"; $http_label = "http-{$loop}-{$uuid}";
$https_label = "https-{$loop}-{$uuid}"; $https_label = "https-{$loop}-{$uuid}";
$labels->push("traefik.http.middlewares.gzip.compress=true");
$labels->push("traefik.http.routers.{$https_label}.middlewares=gzip");
if ($schema === 'https') { if ($schema === 'https') {
// Set labels for https // Set labels for https
$labels->push("traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)"); $labels->push("traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
$labels->push("traefik.http.routers.{$https_label}.entryPoints=https"); $labels->push("traefik.http.routers.{$https_label}.entryPoints=https");
$labels->push("traefik.http.routers.{$https_label}.middlewares=gzip");
if ($port) { if ($port) {
$labels->push("traefik.http.routers.{$https_label}.service={$https_label}"); $labels->push("traefik.http.routers.{$https_label}.service={$https_label}");
$labels->push("traefik.http.services.{$https_label}.loadbalancer.server.port=$port"); $labels->push("traefik.http.services.{$https_label}.loadbalancer.server.port=$port");
@ -254,13 +255,13 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
$labels->push("traefik.http.routers.{$http_label}.service={$http_label}"); $labels->push("traefik.http.routers.{$http_label}.service={$http_label}");
} }
if ($is_force_https_enabled) { if ($is_force_https_enabled) {
$labels->push("traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https");
$labels->push("traefik.http.routers.{$http_label}.middlewares=redirect-to-https"); $labels->push("traefik.http.routers.{$http_label}.middlewares=redirect-to-https");
} }
} else { } else {
// Set labels for http // Set labels for http
$labels->push("traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)"); $labels->push("traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
$labels->push("traefik.http.routers.{$http_label}.entryPoints=http"); $labels->push("traefik.http.routers.{$http_label}.entryPoints=http");
$labels->push("traefik.http.routers.{$http_label}.middlewares=gzip");
if ($port) { if ($port) {
$labels->push("traefik.http.services.{$http_label}.loadbalancer.server.port=$port"); $labels->push("traefik.http.services.{$http_label}.loadbalancer.server.port=$port");
$labels->push("traefik.http.routers.{$http_label}.service={$http_label}"); $labels->push("traefik.http.routers.{$http_label}.service={$http_label}");

View File

@ -103,9 +103,6 @@ function generate_default_proxy_configuration(Server $server)
"traefik.http.routers.traefik.entrypoints=http", "traefik.http.routers.traefik.entrypoints=http",
"traefik.http.routers.traefik.service=api@internal", "traefik.http.routers.traefik.service=api@internal",
"traefik.http.services.traefik.loadbalancer.server.port=8080", "traefik.http.services.traefik.loadbalancer.server.port=8080",
// Global Middlewares
"traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https",
"traefik.http.middlewares.gzip.compress=true",
]; ];
$config = [ $config = [
"version" => "3.8", "version" => "3.8",
@ -198,10 +195,23 @@ function setup_dynamic_configuration()
$traefik_dynamic_conf = [ $traefik_dynamic_conf = [
'http' => 'http' =>
[ [
'middlewares' => [
'redirect-to-https' => [
'redirectscheme' => [
'scheme' => 'https',
],
],
'gzip' => [
'compress' => true,
],
],
'routers' => 'routers' =>
[ [
'coolify-http' => 'coolify-http' =>
[ [
'middlewares' => [
0 => 'gzip',
],
'entryPoints' => [ 'entryPoints' => [
0 => 'http', 0 => 'http',
], ],
@ -251,7 +261,7 @@ function setup_dynamic_configuration()
if ($schema === 'https') { if ($schema === 'https') {
$traefik_dynamic_conf['http']['routers']['coolify-http']['middlewares'] = [ $traefik_dynamic_conf['http']['routers']['coolify-http']['middlewares'] = [
0 => 'redirect-to-https@docker', 0 => 'redirect-to-https',
]; ];
$traefik_dynamic_conf['http']['routers']['coolify-https'] = [ $traefik_dynamic_conf['http']['routers']['coolify-https'] = [