From 80c63e5701ee054fa93d7605eff2d47494bdc4a0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 25 May 2023 21:28:10 +0200 Subject: [PATCH] do not use traefik host now --- app/Actions/Proxy/InstallProxy.php | 34 ++++++++++++------------------ bootstrap/helpers/proxy.php | 2 +- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/app/Actions/Proxy/InstallProxy.php b/app/Actions/Proxy/InstallProxy.php index 562523aa7..8e447ae07 100644 --- a/app/Actions/Proxy/InstallProxy.php +++ b/app/Actions/Proxy/InstallProxy.php @@ -2,12 +2,9 @@ namespace App\Actions\Proxy; -use App\Enums\ActivityTypes; -use App\Models\InstanceSettings; use App\Models\Server; use Spatie\Activitylog\Models\Activity; use Illuminate\Support\Str; -use Spatie\Url\Url; class InstallProxy { @@ -37,16 +34,16 @@ class InstallProxy $server->extra_attributes->last_applied_proxy_settings = Str::of($docker_compose_yml_base64)->pipe('md5')->value; $server->save(); - $env_file_base64 = base64_encode( - $this->getEnvContents() - ); + // $env_file_base64 = base64_encode( + // $this->getEnvContents() + // ); $activity = remote_process([ ...$create_networks_command, "echo 'Docker networks created...'", "mkdir -p $proxy_path", "cd $proxy_path", "echo '$docker_compose_yml_base64' | base64 -d > $proxy_path/docker-compose.yml", - "echo '$env_file_base64' | base64 -d > $proxy_path/.env", + // "echo '$env_file_base64' | base64 -d > $proxy_path/.env", "echo 'Docker compose file created...'", "echo 'Pulling docker image...'", 'docker compose pull -q', @@ -60,18 +57,15 @@ class InstallProxy return $activity; } - protected function getEnvContents() - { - $instance_fqdn = InstanceSettings::get()->fqdn ?? config('app.url'); - $url = Url::fromString($instance_fqdn); - $data = [ - 'TRAEFIK_DASHBOARD_HOST' => $url->getHost(), - 'LETS_ENCRYPT_EMAIL' => '', - ]; + // protected function getEnvContents() + // { + // $data = [ + // 'LETS_ENCRYPT_EMAIL' => '', + // ]; - return collect($data) - ->map(fn ($v, $k) => "{$k}={$v}") - ->push(PHP_EOL) - ->implode(PHP_EOL); - } + // return collect($data) + // ->map(fn ($v, $k) => "{$k}={$v}") + // ->push(PHP_EOL) + // ->implode(PHP_EOL); + // } } diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.php index f1a897e1b..7290ac834 100644 --- a/bootstrap/helpers/proxy.php +++ b/bootstrap/helpers/proxy.php @@ -59,10 +59,10 @@ if (!function_exists('getProxyConfiguration')) { "labels" => [ "traefik.enable=true", "traefik.http.routers.traefik.entrypoints=http", - 'traefik.http.routers.traefik.rule=Host(`${TRAEFIK_DASHBOARD_HOST}`)', "traefik.http.routers.traefik.middlewares=traefik-basic-auth@file", "traefik.http.routers.traefik.service=api@internal", "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", ],