wip: swarm

This commit is contained in:
Andras Bacsai
2023-11-28 18:42:09 +01:00
parent b4874c7df3
commit c41ffd6bfb
2 changed files with 36 additions and 16 deletions

View File

@@ -102,7 +102,6 @@ function generate_default_proxy_configuration(Server $server)
"--entrypoints.https.address=:443",
"--entrypoints.http.http.encodequerysemicolons=true",
"--entrypoints.https.http.encodequerysemicolons=true",
"--providers.docker=true",
"--providers.docker.exposedbydefault=false",
"--providers.file.directory=/traefik/dynamic/",
"--providers.file.watch=true",
@@ -128,6 +127,18 @@ function generate_default_proxy_configuration(Server $server)
$config['services']['traefik']['command'][] = "--accesslog.filepath=/traefik/access.log";
$config['services']['traefik']['command'][] = "--accesslog.bufferingsize=100";
}
if ($server->isSwarm()) {
$config['services']['traefik']['command'][] = "--providers.docker.swarmMode=true";
$config['services']['traefik']['deploy'] = [
"placement" => [
"constraints" => [
"node.role==manager",
],
],
];
} else {
$config['services']['traefik']['command'][] = "--providers.docker=true";
}
$config = Yaml::dump($config, 4, 2);
SaveConfiguration::run($server, $config);
return $config;