From 00ec226f25965fc82a2d6d699ed15a9e649a70e4 Mon Sep 17 00:00:00 2001 From: Raul Sanchez Date: Sat, 7 Jan 2017 01:29:08 +0100 Subject: [PATCH 1/2] Feat: Added priority, traefik.path.strip, traefik.path.prefix and traefik.path.prefix.strip service labels to autoconfigure traefik --- templates/traefik/5/README.md | 28 +++++++++++++++++--------- templates/traefik/5/docker-compose.yml | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/templates/traefik/5/README.md b/templates/traefik/5/README.md index 7eb92ba..fa4be43 100644 --- a/templates/traefik/5/README.md +++ b/templates/traefik/5/README.md @@ -15,10 +15,10 @@ - false: Enable http enpoints and disable https ones. - true: Enable http and https endpoints. - only: Enable https endpoints and redirect http to https. -- acme_enable = false # Enable/Disable acme traefik support. -- acme_email = "test@traefik.io" # acme user email -- acme_ondemand = true # acme ondemand parameter. -- acme_onhostrule = true # acme onHostRule parameter. +- acme_enable = false # Enable/Disable acme traefik support. +- acme_email = "test@traefik.io" # acme user email +- acme_ondemand = true # acme ondemand parameter. +- acme_onhostrule = true # acme onHostRule parameter. - ssl_key # Paste your ssl key. *Required if you enable https - ssl_crt # Paste your ssl crt. *Required if you enable https - refresh_interval = 10s # Interval to refresh traefik rules.toml from rancher-metadata. @@ -31,12 +31,19 @@ Traefik labels has to be added in your services, in order to get included in tra - true: the service will be published as *service_name.stack_name.traefik_domain* - stack: the service will be published as *stack_name.traefik_domain*. WARNING: You could have collisions inside services within your stack - false: the service will not be published -- traefik.alias = < alias > # Alternate names to route rule. Multiple values separated by ",". WARNING: You could have collisions BE CAREFULL -- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," -- traefik.path = < path > # Path to route rule. Multiple paths separated by "," -- traefik.port = < port > # Port to expose throught traefik -- traefik.acme = < true | false > # Enable/disable ACME traefik feature - +- traefik.alias = < alias > # Alternate names to route rule. Multiple values separated by ",". WARNING: You could have collisions BE CAREFULL +- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," +- traefik.port = < port > # Port to expose throught traefik +- traefik.acme = < true | false > # Enable/disable ACME traefik feature +- traefik.path = < path > # Path rule. Multiple values separated by "," +- traefik.path.strip = < path > # Path strip rule. Multiple values separated by "," +- traefik.path.prefix = < path > # Path prefix rule. Multiple values separated by "," +- traefik.path.prefix.strip = < path > # Path prefix strip rule. Multiple values separated by "," + +Details for configuring the traefik rules can be found at: https://docs.traefik.io/basics/#frontends + +WARNING: Only services with healthy state are added to traefik, so health checks are mandatory. + ### Usage: Select Traefik from catalog. @@ -61,3 +68,4 @@ Traefik labels has to be added in your services, in order to get included in tra - https://${traefik.alias}.${traefik.domain}:${https_port} Note: To access the services, you need to create A or CNAMES dns entries for every one. + diff --git a/templates/traefik/5/docker-compose.yml b/templates/traefik/5/docker-compose.yml index 9da5403..cb94b18 100644 --- a/templates/traefik/5/docker-compose.yml +++ b/templates/traefik/5/docker-compose.yml @@ -33,7 +33,7 @@ traefik-conf: io.rancher.container.start_once: 'true' tty: true log_opt: {} - image: rawmind/rancher-traefik:0.3.4-14 + image: rawmind/rancher-traefik:0.3.4-15 net: none volumes: - /opt/tools From f1060f3936895dd5b5ae227848384c052195bed0 Mon Sep 17 00:00:00 2001 From: Raul Sanchez Date: Sat, 28 Jan 2017 02:02:11 +0100 Subject: [PATCH 2/2] Added traefik.protocol and traefik.domain.regexp service labels. Fix acme syntax issue --- templates/traefik/5/README.md | 7 +++++-- templates/traefik/5/docker-compose.yml | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/traefik/5/README.md b/templates/traefik/5/README.md index fa4be43..64fa02f 100644 --- a/templates/traefik/5/README.md +++ b/templates/traefik/5/README.md @@ -31,8 +31,11 @@ Traefik labels has to be added in your services, in order to get included in tra - true: the service will be published as *service_name.stack_name.traefik_domain* - stack: the service will be published as *stack_name.traefik_domain*. WARNING: You could have collisions inside services within your stack - false: the service will not be published -- traefik.alias = < alias > # Alternate names to route rule. Multiple values separated by ",". WARNING: You could have collisions BE CAREFULL -- traefik.domain = < domain > # Domain names to route rule. Multiple values separated by "," +- traefik.priority = # Override for frontend priority. 5 by default +- traefik.protocol = < http | https > # Override the default http protocol +- traefik.alias = < alias > # Alternate names to route rule. Multiple values separated by ",". WARNING: You could have collisions BE CAREFULL +- traefik.domain = < domain.name > # Domain names to route rules. Multiple domains separated by "," +- traefik.domain.regexp = < domain.regexp > # Domain name regexp rule. Multiple domains separated by "," - traefik.port = < port > # Port to expose throught traefik - traefik.acme = < true | false > # Enable/disable ACME traefik feature - traefik.path = < path > # Path rule. Multiple values separated by "," diff --git a/templates/traefik/5/docker-compose.yml b/templates/traefik/5/docker-compose.yml index cb94b18..d879727 100644 --- a/templates/traefik/5/docker-compose.yml +++ b/templates/traefik/5/docker-compose.yml @@ -12,7 +12,7 @@ traefik: io.rancher.container.hostname_override: container_name tty: true log_opt: {} - image: rawmind/alpine-traefik:1.1.2 + image: rawmind/alpine-traefik:1.1.2-1 environment: - CONF_INTERVAL=${refresh_interval} - TRAEFIK_HTTP_PORT=${http_port} @@ -33,7 +33,7 @@ traefik-conf: io.rancher.container.start_once: 'true' tty: true log_opt: {} - image: rawmind/rancher-traefik:0.3.4-15 + image: rawmind/rancher-traefik:0.3.4-18 net: none volumes: - /opt/tools