Skip to content
Snippets Groups Projects
Commit e9517f69 authored by jurgenhaas's avatar jurgenhaas
Browse files

Update Traefik to 2.7

Add support for Traefik Hub
parent a1907848
No related branches found
No related tags found
1 merge request!2Merging develop into main
Pipeline #542704 passed
......@@ -49,6 +49,11 @@ class Traefik {
*/
protected $addon_portainer = FALSE;
/**
* @var string
*/
protected $hub_token = '';
/**
* Traefik constructor.
*
......@@ -82,6 +87,13 @@ class Traefik {
$this->addon_portainer = $addon_portainer;
}
/**
* @param string $hub_token
*/
public function setHubToken(string $hub_token): void {
$this->hub_token = $hub_token;
}
/**
* Update the Traefik container.
*/
......@@ -135,7 +147,7 @@ class Traefik {
'version' => '3.3',
'services' => [
'traefik' => [
'image' => 'traefik:2.6',
'image' => 'traefik:2.7',
'command' => [
'--api=true',
'--api.dashboard=true',
......@@ -202,6 +214,33 @@ class Traefik {
],
];
}
if ($this->hub_token) {
$config['services']['traefik']['command'][] = '--experimental.hub=true';
$config['services']['traefik']['command'][] = '--hub.tls.insecure=true';
$config['services']['traefik']['command'][] = '--metrics.prometheus.addrouterslabels=true';
$config['services']['traefik']['ports'][] = '9900:9900';
$config['services']['traefik']['ports'][] = '9901:9901';
$config['services']['hub-agent'] = [
'image' => 'ghcr.io/traefik/hub-agent-traefik:v0.7.0',
'command' => [
'run',
'--hub.token=' . $this->hub_token,
'--auth-server.advertise-url=http://hub-agent',
'--traefik.host=traefik',
'--traefik.tls.insecure=true',
],
'restart' => 'on-failure',
'networks' => [
'traefik-public',
],
'volumes' => [
'/var/run/docker.sock:/var/run/docker.sock:ro',
],
'depends_on' => [
'traefik',
],
];
}
return $config;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment