Tiny Tiny RSS (TT-RSS) behind Traefik Reverse Proxy

I almost despaired when trying to get the popular RSS server Tiny Tiny RSS working with Traefik. I’ve also tested other RSS reader, but none have pleased me as much as ttrss.

Since I got it working after a long time of testing, I would like to show you here how I got it working.

In my example, the docker configuration files are located unter /opt/containers/.

So first we navigate to this path and clone the GIT repository:

cd /opt/containers

git clone https://git.tt-rss.org/fox/ttrss-docker-compose.git ttrss && cd ttrss

Then we copy the configuration file and adjust the content:

cp .env-dist .env

nano .env

TTRSS_DB_USER=postgres
TTRSS_DB_NAME=postgres
TTRSS_DB_PASS=

TTRSS_SELF_URL_PATH=https://ttrss.example.com/tt-rss

HTTP_PORT=127.0.0.1:8280

So this means in my case I’ve created a subdomain ttrss.example.com which will then be used by traefik to set up the certificate etc.

Now we need to configure the docker compose file.

nano /opt/containers/ttrss/docker-compose.yml

version: '3'

services:
  db:
    image: postgres:12-alpine
    restart: always
    environment:
      - POSTGRES_USER=${TTRSS_DB_USER}
      - POSTGRES_PASSWORD=${TTRSS_DB_PASS}
      - POSTGRES_DB=${TTRSS_DB_NAME}
    volumes:
      - ./db:/var/lib/postgresql/data

  app:
    build:
      context:
        ./app
    restart: always
    env_file:
      - .env
    volumes:
      - ./app:/var/www/html
      - ./config.d:/opt/tt-rss/config.d:ro
    depends_on:
      - db
    networks:
      - default
      - proxy

  backups:
    build:
      context:
        ./app
    restart: always
    env_file:
      - .env
    volumes:
      - ./backups:/backups
      - ./app:/var/www/html
    depends_on:
      - db
    command: /opt/tt-rss/dcron.sh -f

  updater:
    build:
      context:
        ./app
    restart: always
    env_file:
      - .env
    volumes:
      - ./app:/var/www/html
      - ./config.d:/opt/tt-rss/config.d:ro
    depends_on:
      - app
    command: /opt/tt-rss/updater.sh
	
  web-nginx:
    build: ./web-nginx
    restart: always
    ports:
      - ${HTTP_PORT}:80
    volumes:
      - ./app:/var/www/html:ro
    depends_on:
      - app
    networks:
      - proxy
      - default
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.ttrss.entrypoints=http"
      - "traefik.http.routers.ttrss.rule=Host(`ttrss.example.com`)"
      - "traefik.http.services.ttrss.loadbalancer.server.port=80"
      - "traefik.http.middlewares.ttrss-secured.redirectscheme.scheme=https"
      - "traefik.http.routers.ttrss-secured.rule=Host(`ttrss.example.com`)"
      - "traefik.http.routers.ttrss-secured.entrypoints=https"
      - "traefik.http.routers.ttrss-secured.tls.certresolver=production"

volumes:
  db:
  app:
  certs:
  backups:

networks:
  proxy:
    external: true

Publish the configuration file:

source .env

…and start the container:

docker compose up

Now the website should be reachable over https://ttrss.example.com/tt-rss/.

Normally you wouldn’t have to attach the app container to the proxy network. But when I missed that, I always got an error message. So this is kind of a „workaround“, but it was the only way to get it runnig. If you know about a better solution, please let me know.

That’s the error message I got:

502 Bad Gateway nginx/1.21.6

In the logfile of the docker container:

ttrss-web-nginx-1 | 2022/06/06 15:23:29 [error] 32#32: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: , request: "POST /tt-rss/backend.php HTTP/1.1", upstream: "fastcgi://172.19.0.6:9000", host: "ttrss.example.com"

3 Gedanken zu „Tiny Tiny RSS (TT-RSS) behind Traefik Reverse Proxy

  1. Hi,

    I was following your example very, very closely. But for some weird reason I get an error:
    web-nginx_1 | 2022/05/18 18:50:55 [error] 27#27: *41 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: „GET /tt-rss/index.php HTTP/1.1“, upstream: „fastcgi://172.20.0.5:9000“, host: „localhost“
    web-nginx_1 | 127.0.0.1 – – [18/May/2022:18:50:55 +0000] „GET /tt-rss/index.php HTTP/1.1“ 502 157 „-“ „curl/7.80.0“

    I guess it means that web-nginx can’t talk to app, because it requests the index.php on the proxy network, not the internal one.

    That does not happen if I expose the port directly without traefik.

    What am I doing wrong?

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.