Discourse High Availability

AI-generated summary

The discussion revolves around achieving High Availability (HA) for Discourse installations, with users seeking guidance on scaling, load balancing, and containerized setups. jakimfett initially inquired about HAProxy/nginx configurations and distributed hosting via Docker or multiple Discourse instances connected to a shared HA database, later finding relevant documentation on multi-container setups here and compiling fragmented resources including port exposure avoidance here, nginx load balancing here, HTTP/2 setup, and offline page configuration. Assma raised four key questions: whether Discourse supports replicated web and DB services within containers, recommended load balancers for web services, preferred PostgreSQL replication methods for containerized DBs, and Redis HA strategies. pfaffman responded that PostgreSQL failover can be handled with any preferred method, and while CDCK hosting uses HAProxy, any load balancer can be used with /srv/status as a health check endpoint. The conversation reflects community interest in moving beyond standalone setups toward scalable, resilient architectures, with users actively compiling and sharing documentation to fill gaps in official guides.

Has anyone played with a HAProxy/nginx/etc?

I could have sworn there was a how-to guide for a way to do distributed hosting, either via Docker or via multiple instances of Discourse all hitting a single high availability database server, but I can’t seem to find a guide for it.

Any thoughts? I’m currently serving a small single Discourse site, but am interested in learning as much as I can about scaling and load balancing of Discourse.

Found it, less than fifteen minutes after I posted. I’ll put any info on snags or clarifications that might be helpful into the conversation here.

The documentation is very fragmented. I’m going to attempt to pull it all together here.

Any chance I could get some input from @nx2zdk or @jspdng?

Info on avoiding port exposure:

Load balancing with nginx:

Enabling http2 on Debian:

Offline page setup:

I couldn’t find close answers elsewhere.
I understood that Standalone installation of Discourse is recommended for its simplicity and robustness in standard environments. However, to provide High Availability, ones are suggesting bursting standalone mode into multiple containers (29413), others redesign fully separate deployments.

  1. Question1: Since HA is about duplicating services (web and db) with reliable failover, does Discourse propose such solution where both web-services and DBs are replicated inside containers?
  2. Question2: For web-services, a load-balancer would be needed to ensure charges equity between instances. What are Discourse experts and community recommendations?
  3. Question3: For containerised-DB HA, what is the most preferable way to manage postgreSQL replication?
  4. Question4: Same question for Redis.

There are a bunch of ways to deal with postgres failover. You can use whatever you like.

CDCK hosting uses HA-proxy, last I thought I knew. You can use any load balancer you like and (mostly) use /srv/status as a ready indicator.