do not use traefik host now
This commit is contained in:
parent
3ba9f399b8
commit
80c63e5701
@ -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 @@ public function __invoke(Server $server): Activity
|
||||
$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 @@ public function __invoke(Server $server): Activity
|
||||
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);
|
||||
// }
|
||||
}
|
||||
|
@ -59,10 +59,10 @@ function getProxyConfiguration(Server $server)
|
||||
"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",
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user