An idiot attempts to set SELF_URL_PATH. The results will shock you

  • [y] I’m using stock docker compose setup, unmodified.
  • [n] I’m using docker compose setup, with modifications (modified .yml files, third party plugins/themes, etc.) - if so, describe your modifications in your post. Before reporting, see if your issue can be reproduced on the unmodified setup.
  • [n] I’m not using docker on my primary instance, but my issue can be reproduced on the aforementioned docker setup and/or official demo.

I’m attempting to restore my tt-rss instance onto TrueNAS Scale using the docker-compose app from TrueCharts.

I think I have it set up pretty well, except I cannot seem to wrap my little mind around a SELF_URL_PATH setting that allows me to use a root URL (app.com/ instead of app.com/tt-rss/).

I have Traefik set up to proxy/ingress the url, and am using the AddPrefix middleware to insert the /tt-rss path onto the root domain as it gets proxy’ed.

The .env file has:

TTRSS_SELF_URL_PATH=https://rss.csb.sh

I know this is dumb, but I’d appreciate any pointers anyone can give.

  • Tiny Tiny RSS version (including git commit id): c5cbe75b3cda53993a674f52d7a1bc9a03d505fb
  • Platform (i.e. Linux distro, Docker, PHP, PostgreSQL, etc) versions: TrueNAS-SCALE-22.12.3.1

https://git.tt-rss.org/fox/ttrss-docker-compose.wiki.git/tree/Home.md#how-do-i-make-it-run-without-tt-rss-in-the-url-ie-at-website-root

?

Thanks fox.

I think that’s a reasonable approach. I guess I got used to whatever the k8s-at-home image was doing to appear on the root of the URL.

For now I’ve just set it up with the /tt-rss/ path, and that works fine. I’m guessing that the “you’ll have to modify things a bit” of that FAQ is most easily accomplished editing the nginx reverse proxy, or the mountpoint of tt-rss in /var/www/html.

is most easily accomplished editing the nginx reverse proxy

Yes that’s the way to go, It’s quite easy to achieve.
Get a copy of the latest nginx config:

docker cp ttrss_web-nginx_1:/etc/nginx/nginx.conf ./

Update the nginx.conf file, modifying the root path and the location block paths like so:

worker_processes auto;
pid /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
        include /etc/nginx/mime.types;
        default_type  application/octet-stream;

        access_log /dev/stdout;
        error_log /dev/stderr warn;

        sendfile on;

        index index.php;

        upstream app {
                server ${APP_UPSTREAM}:9000;
        }

        server {
                listen 80;
                listen [::]:80;
                root /var/www/html/tt-rss/;

                location /cache {
                        aio threads;
                        internal;
                }

                location /backups {
                        internal;
                }

                location ~ \.php$ {
                        # regex to split $uri to $fastcgi_script_name and $fastcgi_path
                        fastcgi_split_path_info ^(.+?\.php)(/.*)$;

                        # Check that the PHP script exists before passing it
                        try_files $fastcgi_script_name =404;

                        # Bypass the fact that try_files resets $fastcgi_path_info
                        # see: http://trac.nginx.org/nginx/ticket/321
                        set $path_info $fastcgi_path_info;
                        fastcgi_param PATH_INFO $path_info;

                        fastcgi_index index.php;
                        include fastcgi.conf;

                        fastcgi_pass app;
                }

                location / {
                        try_files $uri $uri/ =404;
                }

        }
}

Mount the modified nginx.conf in your docker container:

web-nginx:
  [...]
  volumes:
    - ./nginx.conf:/etc/nginx/nginx.conf

Then set the TTRSS_SELF_URL_PATH=https://ttrss.example.tld/

1 Like

since we use that hacky envsubst thing they have going in the nginx container anyway, we might as well make use of it to sorta-kinda fix this long-standing highly important (for some, i suppose) issue.

https://gitlab.tt-rss.org/tt-rss/ttrss-docker-compose/-/commit/e1cdfbe1ff0df126624d741d0f92ae5a902b4ee5

https://gitlab.tt-rss.org/tt-rss/tt-rss/-/commit/3d255d861c1a146c4cae65a8e0e1ae51b19da70a

i wonder how badly this would break things :slight_smile:

e: seems to work fine on my instance :thinking:

2 Likes

@fox, this is not yet in the static dockerhub setup, is it? I just pulled that and gave it a glance, but could not find it.

It’s very much appreciated. I was actually getting around to switch over to the docker install, although dreading a bit having to help some of my users reconfigure their apps. This will make it more painless :slight_smile:

Thanks

it is, i’m using those exact same docker images.

not sure what you were looking for.

i put a redirect on /tt-rss/(anything) to /anything. won’t work with the android client though.

e: Docker look through the dockerfile if you don’t trust me :slight_smile:

Oh, I fully trust you, I assume a PEBCAK issue on my side.

Will look againt tonight when I have a reasonable CLI and report back :slight_smile:

Ah, fudge, just overlooked the bit about the android client. That makes it… less relevant for me, anyway. :frowning:
Will still test and try to figure out, later.

If you are OK with configuring and managing one more thing, you can always set up proxy on your server that will redirect to the new ttrss instance with any path you want. Never used it with ttrss specifically, but at work we had some luck with haproxy in similar situations

@fox, I am not sure what I am missing. Looking in the web container, I see this:

/ # env
APP_BASE=/tt-rss
SHLVL=1
HOME=/root
PKG_RELEASE=1
container=podman
APP_WEB_ROOT=/var/www/html
TERM=xterm
NGINX_VERSION=1.25.1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NJS_VERSION=0.7.12
PWD=/
APP_UPSTREAM=app
NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx

Although I my .env file I have

APP_WEB_ROOT=/var/www/html/tt-rss
APP_BASE=

It does seem like this doesn’t get picked up when creating the container. Thought for a second I need to prepend the entries with TTRSS_, but that didn’t make a difference either.

Did you set it in the docker-compose.yml as well?

(Or rather set the web-nginx service to also read the .env file?)

Do you mean this specific redirects or your change with the env settings? It works here on your Android client as well. (probably answered my own question here)

i had no problems testing this on my test environment, web-nginx reads .env by default (as all containers do) so there’s no need to put anything in docker-compose.yml.

so you’re not using docker then? next time you might want to mention something like that.

e: looking at compose file it seems that web-nginx doesn’t explicitly have env_file defined. .env should be included by default but you can try adding it and see if it fixes it.

My apologies - slipped my mind. I’ve symlinked the commands to their docker equivalents so long ago, didn’t even remember this machine runs podman instead of docker.

Yes, that did it - thanks @fox

1 Like

i’ll make a note to update the compose file so this works properly on podman.

https://gitlab.tt-rss.org/tt-rss/ttrss-docker-compose/-/commit/b0130552095eaffffcf7ce2935fe4ca374b69fec