Load Balancing TT RSS With HAProxy

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
Tuxinator94
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 30 Aug 2013, 13:32

Load Balancing TT RSS With HAProxy

Postby Tuxinator94 » 09 Aug 2014, 22:19

Hi all,

I have got TT RSS running using Docker and I have been trying to put it behind a HAProxy in Layer 7 configuration. The problem is going through HAProxy it constantly refreshes the page where it has nothing but the loading bar when it does a call to backend.php. I believe this happens on a polled basis but also when RESTful post calls are sent to the sever as well.

The above only happens when there are multiple backend servers are involved. When I only have 1 server setup in HAProxy, the issue goes away.

Here is my HAProxy settings:

Code: Select all

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon
        maxconn 1024

        # Default SSL material locations
        ca-base /etc/ssl/certs
        crt-base /etc/ssl/private

        # Default ciphers to use on SSL-enabled listening sockets.
        # For more information, see ciphers(1SSL).
        ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        option redispatch
        timeout connect 5000
        timeout client  50000
        timeout server  50000
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http
        option forwardfor
        option http-server-close

frontend www-http
        bind *:80
        reqadd X-Forwarded-Proto:\ http
        option forwardfor
        # Define hosts
        acl other hdr(host) -i mydomain.com
        acl ttrss_match hdr(host) -i rss.mydomain.com

        # Set rules based on host matches
        use_backend ttrss if ttrss_match
        default_backend other

backend ttrss
        cookie TTRSS_ID prefix
        server ttrss1 10.0.0.2:80 cookie ttrss1 check
        server ttrss2 10.0.0.3:80 cookie ttrss2 check

backend other
        cookie OTHER_ID prefix
        server other1 10.0.0.4:80 cookie other1 check
        server other2 10.0.0.5:80 cookie other2 check

Tuxinator94
Bear Rating Trainee
Bear Rating Trainee
Posts: 4
Joined: 30 Aug 2013, 13:32

Re: Load Balancing TT RSS With HAProxy

Postby Tuxinator94 » 09 Aug 2014, 23:15

I've managed to solve it by changing the cookies from PREFIX to INSERT. The final config looks like this:

Code: Select all

global
        log /dev/log    local0
        log /dev/log    local1 notice
        chroot /var/lib/haproxy
        stats socket /run/haproxy/admin.sock mode 660 level admin
        stats timeout 30s
        user haproxy
        group haproxy
        daemon
        maxconn 1024

        # Default SSL material locations
        ca-base /etc/ssl/certs
        crt-base /etc/ssl/private

        # Default ciphers to use on SSL-enabled listening sockets.
        # For more information, see ciphers(1SSL).
        ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        option redispatch
        timeout connect 5000
        timeout client  50000
        timeout server  50000
        errorfile 400 /etc/haproxy/errors/400.http
        errorfile 403 /etc/haproxy/errors/403.http
        errorfile 408 /etc/haproxy/errors/408.http
        errorfile 500 /etc/haproxy/errors/500.http
        errorfile 502 /etc/haproxy/errors/502.http
        errorfile 503 /etc/haproxy/errors/503.http
        errorfile 504 /etc/haproxy/errors/504.http
        option forwardfor
        option http-server-close

frontend www-http
        bind *:80
        reqadd X-Forwarded-Proto:\ http
        option forwardfor
        # Define hosts
        acl other hdr(host) -i mydomain.com
        acl ttrss_match hdr(host) -i rss.mydomain.com

        # Set rules based on host matches
        use_backend ttrss if ttrss_match
        default_backend other

backend ttrss
        cookie TTRSS_ID insert
        server ttrss1 10.0.0.2:80 cookie ttrss1 check
        server ttrss2 10.0.0.3:80 cookie ttrss2 check

backend other
        cookie OTHER_ID insert
        server other1 10.0.0.4:80 cookie other1 check
        server other2 10.0.0.5:80 cookie other2 check

User avatar
mySocialFeeds.com
BANNED_USERS
BANNED_USERS
Posts: 4
Joined: 23 Jul 2016, 08:01

Re: Load Balancing TT RSS With HAProxy

Postby mySocialFeeds.com » 23 Sep 2016, 22:04

Great advice.

Using Tiny Tiny Proxy with Galera MariaDb 10.1 Cluster and HaProxy 1.6 too. Doing some static content caching with Varnish and Redis keeps database transactions incredible fast.

And to be honest I do not know a lot about all these great services but with a bit of trial-and-error and spending some time it runs now for a few months and lot's of people are wondering how it is possible to run TTRss with 'cheap' equipment, and experiencing really great speeds.

Your story helped for sure too. Thanks and enjoy your weekend!

chymian
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 24 Sep 2016, 19:38

Re: Load Balancing TT RSS With HAProxy

Postby chymian » 24 Sep 2016, 19:44

And to be honest I do not know a lot about all these great services but with a bit of trial-and-error and spending some time it runs now for a few months


@mySocialFeeds.com

hey MSF,
would you be so kind and post a how-to and/or the config files.
did you tie it all up in a docker?

TIA
chymian

User avatar
mySocialFeeds.com
BANNED_USERS
BANNED_USERS
Posts: 4
Joined: 23 Jul 2016, 08:01

Re: Load Balancing TT RSS With HAProxy

Postby mySocialFeeds.com » 31 Dec 2016, 21:28

@chymian Sorry I wasn't available for responding. But alive and kicking again.

When you like to know something please let me know. Built a lot of extra's so much more information to share.

User avatar
mySocialFeeds.com
BANNED_USERS
BANNED_USERS
Posts: 4
Joined: 23 Jul 2016, 08:01

Re: Load Balancing TT RSS With HAProxy

Postby mySocialFeeds.com » 31 Dec 2016, 21:30

@chymian So many people started to use my 'own' setup of Tiny Tiny Rss and I wanted to make it a bit easier to find online so registered <link removed> for it. Hopefully it is not a problem for the community but it was free and many people find my feed reader this way.

JustAMacUser
Bear Rating Overlord
Bear Rating Overlord
Posts: 373
Joined: 20 Aug 2013, 23:13

Re: Load Balancing TT RSS With HAProxy

Postby JustAMacUser » 31 Dec 2016, 22:03

@mySocialFeeds.com

Seriously? How are you not just leveraging the forums to market yourself?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Load Balancing TT RSS With HAProxy

Postby fox » 31 Dec 2016, 22:20

gonna ban this sick filth

e: bye!

randompherret
Bear Rating Trainee
Bear Rating Trainee
Posts: 36
Joined: 04 Jul 2013, 08:11

Re: Load Balancing TT RSS With HAProxy

Postby randompherret » 01 Jan 2017, 02:05



Return to “Support”

Who is online

Users browsing this forum: No registered users and 7 guests