Discourse behind Traefik 🐁

AI-generated summary

A user, Cerix, seeks help installing Discourse behind Traefik, encountering issues with Docker labels and network configuration in the app.yml file. The error ā€œinvalid reference format: repository name must be lowercaseā€ arises when using the labels section. Cameron_D explains that app.yml isn’t a standard Docker Compose file and suggests using the docker_args section instead. Cerix later reports success by adding labels to app.yml and manually connecting the container to the network with docker network connect web app. huberfe initially struggles but then confirms Cameron_D’s docker_args approach works effectively.

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

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!

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

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.

This worked very well!
Thank you very much