Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration through environment #7

Closed
andyshinn opened this issue Sep 22, 2015 · 31 comments
Closed

Configuration through environment #7

andyshinn opened this issue Sep 22, 2015 · 31 comments

Comments

@andyshinn
Copy link

@andyshinn andyshinn commented Sep 22, 2015

Any plans to do configuration through environment? I'd love the ability to configure with something like:

docker run \
  -e DOCKER_ENDPOINT="unix:///tmp/docker.sock" \
  -e DOCKER_DOMAIN="docker.localhost" \
  -e DOCKER_WATCH=true \
  -v /var/run/docker.sock:/tmp/docker.sock \
  emilevauge/traefik
@vdemeester

This comment has been minimized.

Copy link
Member

@vdemeester vdemeester commented Sep 22, 2015

@andyshinn cool idea yeah, it's kinda in our head to add a possibility to configure the docker image in some way 😉

@emilevauge

This comment has been minimized.

Copy link
Member

@emilevauge emilevauge commented Sep 22, 2015

Hi
It's in my roadmap to integrate https://github.com/spf13/viper.

@andyshinn

This comment has been minimized.

Copy link
Author

@andyshinn andyshinn commented Sep 22, 2015

Oh yea, Viper looks like a cool solution. Would definitely help!

@flrngel

This comment was marked as off-topic.

Copy link

@flrngel flrngel commented Sep 23, 2015

👍

@BrianAdams

This comment was marked as off-topic.

Copy link

@BrianAdams BrianAdams commented Dec 16, 2015

+1

@stongo

This comment has been minimized.

Copy link
Contributor

@stongo stongo commented Apr 2, 2016

+1

Does the configuration file currently inject environment variables?
Also let me know if you want help on this issue. It's something I would rather see sooner than later so willing to contribute.

@emilevauge

This comment has been minimized.

Copy link
Member

@emilevauge emilevauge commented Apr 2, 2016

Could you use flags instead?

@stongo

This comment has been minimized.

Copy link
Contributor

@stongo stongo commented Apr 2, 2016

Sure I can add flags for all config items instead of using ENV vars.
Would be glad to submit PR

@emilevauge

This comment has been minimized.

Copy link
Member

@emilevauge emilevauge commented Apr 2, 2016

Flags are already here in fact :)

@stongo

This comment has been minimized.

Copy link
Contributor

@stongo stongo commented Apr 2, 2016

For all settings found in config file? Is there a flag to disable the
config file requirement?
On Apr 2, 2016 11:56 AM, "Emile Vauge" notifications@github.com wrote:

Flags are already here in fact :)


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#7 (comment)

@stongo

This comment has been minimized.

Copy link
Contributor

@stongo stongo commented Apr 2, 2016

Flags still don't give the same advantage as environment variables in a container runtime for passing secrets and dynamic configuration

@emilevauge

This comment has been minimized.

Copy link
Member

@emilevauge emilevauge commented Apr 2, 2016

Right, what do you mean by dynamic configuration?

@stongo

This comment has been minimized.

Copy link
Contributor

@stongo stongo commented Apr 2, 2016

Anything environment specific where traefik should find itself scheduled.

Are all config items currently flags and can a config file requirement be
disabled?
On Apr 2, 2016 12:37 PM, "Emile Vauge" notifications@github.com wrote:

Right, what do you mean by dynamic configuration?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#7 (comment)

@emilevauge

This comment has been minimized.

Copy link
Member

@emilevauge emilevauge commented Apr 4, 2016

@stongo: almost everything can be set using flags.
You can just give traefik an empty traefik.toml file and configure it using flags.
FYI, we are in the process of refactoring flags in order to simplify their maintenance.

@stongo

This comment has been minimized.

Copy link
Contributor

@stongo stongo commented Apr 12, 2016

Great to hear it's on the roadmap! Thanks for the advice

@RX14

This comment was marked as off-topic.

Copy link

@RX14 RX14 commented May 25, 2016

I find the deeply-nested TOML files to be really unreadable, so YAML or HCL support with viper would be brilliant.

@gjonespf

This comment has been minimized.

Copy link

@gjonespf gjonespf commented Sep 9, 2016

Key use cases for viper et al for me I think would be doing things like:

  • Turning on and off acme per frontend
  • Specifying auth redirects per frontend
  • Specifying SSL key/cert files per frontend

looking at trying to do this atm, and it looks quite difficult as is. Not sure if consul/etcd stores support key/cert changes, and ACME looks like config only from what I can see - or perhaps I've just not seen the right example yet.

So keen to see this in the roadmap. Where is the roadmap, btw? 😉

@errm

This comment has been minimized.

Copy link
Member

@errm errm commented Sep 12, 2016

As I understand we have switched to https://github.com/containous/staert, I think this issue could now be closed? right @emilevauge?

@cocap10

This comment has been minimized.

Copy link
Contributor

@cocap10 cocap10 commented Sep 12, 2016

So far, environment variables are not handled by https://github.com/containous/staert. But it could be a nice improvement ... WDYT @emilevauge ?

@stealthybox

This comment has been minimized.

Copy link

@stealthybox stealthybox commented Jan 12, 2017

^
Environment variables are a very good way of persisting simple configuration information across a cluster.
Swarm Mode allows you to update the environment variables of existing services.
This would be a really great addition to staert.

@stealthybox

This comment was marked as off-topic.

Copy link

@stealthybox stealthybox commented Jan 12, 2017

would staert be able to support YAML inputs?

I agree with @RX14's comment on YAML or HCL being more readable than TOML in many cases.
YAML / JSON config file options would definitely make the file backend more approachable.

@RX14

This comment was marked as off-topic.

Copy link

@RX14 RX14 commented Jan 12, 2017

The only reason i'm not using traefik is because the examples in https://docs.traefik.io/toml/ - especially as you go further down the page - hurt my eyes to read.

TOML doesn't strike me as a format which handles nesting very well. I'm sure it looks beautiful for non-nested files but I have to say if I have to configure 10 sites using that i'm going to want to gouge my eyes out.

@InAnimaTe

This comment was marked as off-topic.

Copy link

@InAnimaTe InAnimaTe commented Feb 21, 2017

I completely and utterly agree with @RX14

In terms of usability and inviting stature to new users, I think it would be much cleaner to adopt something like which could handle yaml or easier formats (similar to the Caddyfile).

I think ideally, a lot of us in k8s land would want to use a configset which when updated, sees Traefik automatically reload configuration.

@errm

This comment was marked as off-topic.

Copy link
Member

@errm errm commented Feb 22, 2017

Agreed, having traefik loading confine directly from a k8s config map would be nice, could you open a new issue for that @InAnimaTe ?

@InAnimaTe

This comment was marked as off-topic.

Copy link

@InAnimaTe InAnimaTe commented Feb 24, 2017

@errm done. #1188

thomasleveil added a commit to thomasleveil/traefik that referenced this issue Nov 19, 2017
See containous#7

rules:

- environment variables starting with `TRAEFIK_` will be considered
- environment variables must be named after the traefik command line option, replacing any dots `.` with underscores `_`

examples:

|                                                                   |                                              |
|-------------------------------------------------------------------|----------------------------------------------|
| `TRAEFIK_DEBUG= /docker-entrypoint.sh`                            | `/traefik --debug`                           |
| `TRAEFIK_WEB= /docker-entrypoint.sh`                              | `/traefik --web`                             |
| `TRAEFIK_DOCKER_DOMAIN=docker.localhost /docker-entrypoint.sh`    | `/traefik --docker.domain=docker.localhost   |
| `TRAEFIK_LOGLEVEL=DEBUG /docker-entrypoint.sh`                    | `/traefik --loglevel=DEBUG`                  |
| `TRAEFIK_DOCKER_EXPOSEDBYDEFAULT=false /docker-entrypoint.sh`     | `/traefik --docker.exposedbydefault=false    |
@serbrech serbrech mentioned this issue Mar 11, 2018
1 of 9 tasks complete
@mrmachine

This comment was marked as off-topic.

Copy link

@mrmachine mrmachine commented Mar 29, 2018

I was excited to find traefik as a potential replacement for the now deprecated dockercloud-haproxy, until I saw that I need to provide a config file and even worse, it's TOML. My eyes are bleeding.

@Yajo

This comment has been minimized.

Copy link

@Yajo Yajo commented Mar 29, 2018

I felt the same, but then I discovered that every option you can set in the toml file, you can set it by a CLI option. It's not so beautiful, but after all it lets you basically the same benefits as those you wanted from the env variables.

@DanielJoyce

This comment was marked as off-topic.

Copy link

@DanielJoyce DanielJoyce commented Nov 2, 2018

The config file format is seriously chatty and bad, with remplating. Our plan is to use remarshaller to munge stuff together then spit out toml. :/

@Ashtonian

This comment has been minimized.

Copy link

@Ashtonian Ashtonian commented Mar 24, 2019

An example found digging in the docs, using flags in case anyone has trouble finding it. https://docs.traefik.io/v1.7/user-guide/cluster-docker-consul/

version: "3"
services:
  traefik:
    image: traefik:1.7
    command:
      - "--api"
      - "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
      - "--entrypoints=Name:https Address::443 TLS"
      - "--defaultentrypoints=http,https"
      - "--acme"
      - "--acme.storage=/etc/traefik/acme/acme.json"
      - "--acme.entryPoint=https"
      - "--acme.httpChallenge.entryPoint=http"
      - "--acme.onHostRule=true"
      - "--acme.onDemand=false"
      - "--acme.email=contact@mydomain.ca"
      - "--docker"
      - "--docker.swarmMode"
      - "--docker.domain=mydomain.ca"
      - "--docker.watch"
@dantebarba

This comment has been minimized.

Copy link

@dantebarba dantebarba commented Jun 6, 2019

An example found digging in the docs, using flags in case anyone has trouble finding it. https://docs.traefik.io/v1.7/user-guide/cluster-docker-consul/

version: "3"
services:
  traefik:
    image: traefik:1.7
    command:
      - "--api"
      - "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https"
      - "--entrypoints=Name:https Address::443 TLS"
      - "--defaultentrypoints=http,https"
      - "--acme"
      - "--acme.storage=/etc/traefik/acme/acme.json"
      - "--acme.entryPoint=https"
      - "--acme.httpChallenge.entryPoint=http"
      - "--acme.onHostRule=true"
      - "--acme.onDemand=false"
      - "--acme.email=contact@mydomain.ca"
      - "--docker"
      - "--docker.swarmMode"
      - "--docker.domain=mydomain.ca"
      - "--docker.watch"

What happens if I just want to replace acme.email for example and keep using the rest of the toml file?. Can I just set --acme.email and it will override the toml?

@ldez ldez mentioned this issue Jun 6, 2019
2 of 2 tasks complete
@traefiker traefiker added this to the 2.0 milestone Jun 17, 2019
@traefiker traefiker closed this Jun 17, 2019
@traefiker

This comment has been minimized.

Copy link

@traefiker traefiker commented Jun 17, 2019

Closed by #4935.

@containous containous locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
You can’t perform that action at this time.