Discourse behind Traefik 🐭

(Cerix) #1

Hello guys, I’m trying to install Discourse behind Traefik which is used as reverse proxy,
The problem is that when creating the container I need to specify some parameters such as:

      - traefik.backend=discourse <== this must be the service name I do not know which one is the default, i think is "app"?
      - traefik.frontend.rule=Host:meta.mydomain.org
      - traefik.docker.network=web
      - traefik.port=80
         - web

I tried to insert these parameters in the app.yml file but when I run "./launcher rebuild app " I get error “invalid reference format: repository name must be lowercase”

I’m sorry, but I’m not a real docker and discourse expert, so if you can kindly help me I’d appreciate it.

(Cerix) #2

ok the correct way to insert labels is:

  traefik.port: "80"
  traefik.backend: "app"
  traefik.frontend.rule: "Host:meta.mydomain.org"
  traefik.docker.network: "web"

last problem is to start the container in a specific network does anyone have any advice?

if i add

 - web

seems to be ignored

(Cameron:D) #3

The app.yml isn’t a docker-compose file, you need to pass the labels through the docker-args parameter, something like:

./launcher start app --docker-args '-l "traefik.a.b=c" -l "traefik.x.y=z"'

I think. You can also add them in a new section in the app.yml file, but I’m not sure of the syntax (look at samples/web_only.yml, there’s a commented out docker_args section).

Edit: just re-read the docs and I see what you say about a labels section. I wonder why that doesn’t work

(Cerix) #4

OK problem solved!

edit you app.yml add traefik labels like this:

     - "80"
     - "443"

      - traefik.backend="app"
      - traefik.frontend.rule=Host:meta.mydomain.org
      - traefik.docker.network=web
      - traefik.port=80

after run:
$ ./launcher rebuil app

connect the container to your network:

$ docker network connect web app

Enjoy Discourse!

(Kane York) #5

@sam there’s been a couple people trying this, a yml section for docker network connect might be a good idea


If anyone with traefik would share how they setup their app.yml i’d appreciate it.

Trying @Cerix’s solution seems not to work. I tried multiple times now but can’t get it to run.

Getting: “invalid reference format: repository name must be lowercase”

(Cameron:D) #7

I never got the labels section working, so I just have a docker_args section that looks like this:

  - "--network=web"
  - "--expose=80"
  - "-l traefik.backend=forums"
  - "-l traefik.frontend.rule=Host:forums.domain.com,cf-cdn.domain.com"
  - "-l traefik.docker.network=web"
  - "-l traefik.port=80"

Not necessarily elegant, but it works.


This worked very well!
Thank you very much