diff --git a/Traefik.php b/Traefik.php index bd8d8b33d77e91aacc149e116d59fdeaa4de7345..8f5b607dab2dafb64ba2cc27c8b2473375fd9b10 100644 --- a/Traefik.php +++ b/Traefik.php @@ -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; } diff --git a/composer.json b/composer.json index 3e8093a35fee87cf8798d1ed3aa2735599958495..cf6d22254be23846bbbabedf18d556029882aaed 100644 --- a/composer.json +++ b/composer.json @@ -8,14 +8,20 @@ "authors": [ { "name": "Jürgen Haas", - "email": "juergen@paragon-es.de", - "homepage": "https://www.paragon-es.de", + "email": "juergen.haas@lakedrops.com", + "homepage": "https://www.lakedrops.com", + "role": "Drupal Expert" + }, + { + "name": "Daniel Speicher", + "email": "daniel.speicher@lakedrops.com", + "homepage": "https://www.lakedrops.com", "role": "Drupal Expert" }, { "name": "Richard Papp", - "email": "richard.papp@boromino.com", - "homepage": "http://www.boromino.com", + "email": "richard.papp@lakedrops.com", + "homepage": "https://www.lakedrops.com", "role": "Drupal Expert" } ], @@ -31,7 +37,10 @@ }, "require-dev": { "composer/composer": "^1||^2", - "phpunit/phpunit": "^8.4" + "drupal/coder": "^8.3", + "phpunit/phpunit": "^9.5", + "roave/security-advisories": "dev-master", + "squizlabs/php_codesniffer": "^3.7" }, "minimum-stability": "dev", "prefer-stable": true, @@ -39,5 +48,10 @@ "psr-4": { "LakeDrops\\DockerTraefik\\": "" } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } }