[REQUEST] Traefik reverse proxy


Recommended Posts

37 minutes ago, ChaOConnor said:

I realized I have no idea how to install a docker that doesn't have a template.  Should I create a template for it? (How do I do that?)  Thanks!

Enable docker hub searching in community applications, then search for and install it using the apps tab as normal. You may have to adjust some settings, but with an app this simple it'll probably work with little to no tweaking.

  • Upvote 1
Link to comment
17 hours ago, ChaOConnor said:

I guess I don't have any good reason other than I hold the LinuxServer.io team's work in high regard and they're base is very stable.  I use all their apps almost exclusively.

 

I should try Treafik's, good point.  Thanks.

I am trying to set this up too, but I am having a little difficulty also...

Not sure what I need to do to get the letsencrypt going or what to set for the front/backends...

If you have any success please post...

Edited by airbillion
Link to comment

I managed to get the management GUI to work. I can't figure out how to get it to connect to the Docker daemon so that it will list and watch the containers.

 

I had to drop the default config file in /mnt/user/appdata/traefik/traefik.toml and enable a few things.

 

I added a port mapping for 8080:8080 and a folder mapping for /mnt/usr/share/appdata/traefik:/etc/traefik/

 

Here's the default one that's about 1000 lines: https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml

 

/etc/traefik/traefik.toml


debug = false
traefikLogsFile = "/etc/traefik/traefik.log"
logLevel = "INFO"

[web]
address = ":8080"

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "docker.localhost"
watch = true
exposedbydefault = true

Edited by brando56894
Link to comment
On 8/22/2017 at 4:26 PM, hernandito said:

Does this allow you to setup reverse proxies for all Dockers like nzbget, plex, couch, etc?

 

Yep, apparently it will dynamically create reverse proxies for you or you can set them up yourself.

 

On 8/22/2017 at 4:26 PM, hernandito said:

Can you do all the proxy configuration in a GUI?

 

It appears that way, but I can't get Traefik to connect to the Docker socket, so it doesn't show anything.

 

Edit: I forgot to map /var/run/docker.sock inside the container, so that's why it won't connect! D'oh! I'll give it another try when I get home and it should work as expected.

 

Edit 2: yep just map /var/run/docker.sock to the same inside the container and it works as expected.

Edited by brando56894
Link to comment
On 8/23/2017 at 0:33 AM, brando56894 said:

 

Yep, apparently it will dynamically create reverse proxies for you or you can set them up yourself.

 

 

It appears that way, but I can't get Traefik to connect to the Docker socket, so it doesn't show anything.

 

Edit: I forgot to map /var/run/docker.sock inside the container, so that's why it won't connect! D'oh! I'll give it another try when I get home and it should work as expected.

 

Edit 2: yep just map /var/run/docker.sock to the same inside the container and it works as expected.

 

Is this working well for you?

 

Are all the reverse proxies working correctly.....and have you tried it with letsencrypt yet?

 

This looks like a good all in one solution, but I just want to know how it compares to the nginx letsencrypt...

 

Thanks!

Link to comment
  • 6 months later...

after spending another few hours I managed to get it to run - however when using "exposedbydefault = false" and in the responding docker containers the variables:

  • traefik.frontend.rule
  • traefik.backend
  • traefik.enable
  • traefik.port

no container can be viewed. any hints? I think the issue that I'm supposed to set the traefik container as well as the other responding docker containers on to the same network - could this be the issue? anyways when using "bridge" mode I would assume they are already on the same network so there shouldn't be the need for it.

 

there is a blog post available by Linuxserver.io at: https://www.linuxserver.io/2018/02/03/using-traefik-as-a-reverse-proxy-with-docker/ following that my certificates are generated. however using the exposedbydefault flag I still can't manage to view the assigned docker apps. and with it set to true I receive 404 on all pages.

 

anyone figured it out how to set it correctly?

Edited by twok
progress2
Link to comment
  • 4 weeks later...

I decided to mess around with this tonight a bit, and was able to get basic proxying working fine after skimming their docs.

Didn't try the letsencrypt yet as I would have to mess with my current running nginx server and ports.

Hope this helps those that had issues:

 

 

For reference, here is the toml config i threw together.

on my test dockers I added this to the extra parameters field: -l=traefik.enable=true

 

### Globals ###
debug = false
logLevel = "INFO"

### Entrypoints ###
defaultEntryPoints = ["http", "https"]

[entryPoints]
  [entryPoints.http]
    address = ":80"
    [entryPoints.http.redirect]
      entryPoint = "https"
  [entryPoints.https]
    address = ":443"
    [entryPoints.https.tls]
	
  [entryPoints.webui]
    address=":8080"
    [entryPoints.webui.auth]
      [entryPoints.webui.auth.basic]
         users = ["admin:$apr1$0DIFsecrethashU6aJdI2XG1"]

### Logging ###
[traefikLog]
filepath = "/etc/traefik/traefik.log"
	
### Web Dashboard ###
[api]
entrypoint = "webui"
	
### Backends ###
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "my.domain.com"
watch = true
exposedbydefault = false

Docker settings were simple with just the ports and required paths:

 

Ports:
443
80
8080

Paths:
/var/run/docker.sock:/var/run/docker.sock
/etc/traefik/:/mnt/cache/.Programs/traefik/

 

Link to comment

@ninthwalker

Could you also explain what you did about the Traefik Labels on the Dockers you got Proxy to work? Are the labels just added as extra parameters? Also, what about the Network parameter.....can we just use "bridge" for both Traefik and other containers? Or do we need to actually create a new network?

 

--label traefik.enable=true --label traefik.port=8080 --label traefik.docker.network=bridge --label traefik.frontend.rule=Host:traefik.example.com

 

traefik looks like next-gen nginx........I Just wish there was a more user-friendly setup for it :(

Edited by Stupifier
Link to comment

@Stupifier

i left the dockers I tested with in the bridge network. 

 

Only thing i added to existng dockers for them to be picked up by traefik was add the one label to extra parameters. 

 

-l=‘traefik.enable=true’

 

@hernandito

traefik is a proxy only. Not a webserver. 

For that you still need nginx/Apache or check out caddy. 

Edited by ninthwalker
Link to comment
[mention=79664]Stupifier[/mention]
i left the dockers I tested with in the bridge network. 
 
Only thing i added to existng dockers for them to be picked up by traefik was add the one label to extra parameters. 
 
-l=‘traefik.enable=true’
 
[mention=6274]hernandito[/mention]
traefik is a proxy only. Not a webserver. 
For that you still need nginx/Apache or check out caddy. 
If you get this all figured out including the LetsEncrypt certs, hopefully we'll see an UnRAID Template for all us noobs :)
Link to comment

Not sure if i’ll be doing anything more to be honest. My nginx setup is on a seperate  Server and runs pretty good/automated already for everything. 

 

Fooled around with Traefik, and while the auto-proxy for each docker is cool, I don’t know if it would benefit me much.

 

good luck!

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.