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
Labels
Milestone

Comments

@andyshinn
Copy link

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
@emilevauge emilevauge added the kind/enhancement a new or improved feature. label Sep 22, 2015
@vdemeester
Copy link
Contributor

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

@emilevauge
Copy link
Member

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

@andyshinn
Copy link
Author

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

@flrngel

This comment has been minimized.

@BrianAdams

This comment has been minimized.

@stongo
Copy link
Contributor

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
Copy link
Member

Could you use flags instead?

@stongo
Copy link
Contributor

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
Copy link
Member

Flags are already here in fact :)

@stongo
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Member

Right, what do you mean by dynamic configuration?

@stongo
Copy link
Contributor

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
Copy link
Member

@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
Copy link
Contributor

stongo commented Apr 12, 2016

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

@RX14

This comment has been minimized.

@gjonespf
Copy link

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
Copy link
Contributor

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
Copy link

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
Copy link

^
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 has been minimized.

@RX14

This comment has been minimized.

@InAnimaTe

This comment has been minimized.

@errm

This comment has been minimized.

@InAnimaTe

This comment has been minimized.

thomasleveil added a commit to thomasleveil/traefik that referenced this issue Nov 19, 2017
See traefik#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    |
@mrmachine

This comment has been minimized.

@yajo
Copy link

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 has been minimized.

@ashtonian
Copy link

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
Copy link

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?

@traefiker traefiker added this to the 2.0 milestone Jun 17, 2019
@traefiker
Copy link
Contributor

Closed by #4935.

@traefik traefik 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.
Labels
Projects
None yet
Development

No branches or pull requests