Discourse behind Traefik šŸ­

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:

labels:
      - 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
    networks:
         - 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.

ok the correct way to insert labels is:

labels:
  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

networks:
 - web

seems to be ignored

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

4 Likes

OK problem solved!

edit you app.yml add traefik labels like this:

expose:
     - "80"
     - "443"

labels:
      - 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!

6 Likes

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

6 Likes

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ā€

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

docker_args:
  - "--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.

8 Likes

This worked very well!
Thank you very much

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.