Discourse double branch offices installation

AI 生成的摘要

The discussion revolves around setting up a Discourse double-branch office installation to achieve high availability. Julian_Somoza wants to install a replica of their Discourse in a second branch office to ensure access when the fiber link between the offices goes down. joffreyjaffeux suggests a read-only replica, which Julian_Somoza finds acceptable.

Riking provides a detailed, albeit untested, approach to set up the replica using Postgres streaming replication, a Redis sentinel cluster, and editing Discourse configuration files. However, they acknowledge potential problems and the need for code changes.

Joffreyjaffeux proposes an alternative, simpler solution involving automatic daily backups and restoration. But Julian_Somoza emphasizes the need for high availability, which this solution might not provide.

Hi to everyone!

We have 2 branch offices in different cities connected by fiber optic… We have something similar to a MAN network, but sometimes the fiber link goes down and we lost the communication.

I want to install a replica of my discourse in the other branch office, this way when the fiber goes down they dont lost the access to the discourse.

Is posible make something like this? How can I manage the synchronization when the link come back?

Thanks so much in advance.

Hi,

Would it be acceptable to have the second link to be a read-only replica ? It would probably make things a lot easier.

That sound good… It’s posible? Where can I found information about this? Thanks!

I think it would be something like this:

  • split the Postgres database and Redis server out of the container (see howto about using an existing database server)
  • set up streaming replication for Postgres and a sentinel cluster for Redis (a 1-1-1 cluster, with the 3rd “C” server cloud somewhere)
  • set DISCOURSE_REDIS_SENTINELS in office A to the addresses of sentinels A,C
  • copy the web_only.yml to a server in office B
  • set DISCOURSE_DB_REPLICA_{HOST,PORT} to the office B replica, but DB_HOST/PORT to the office A (discourse/config/discourse_defaults.conf at main · discourse/discourse · GitHub)
  • set DISCOURSE_REDIS_HOST/PORT to the office B Redis server
  • set DISCOURSE_REDIS_SENTINELS in office B to sentinels B,C

Aaand there’s more to cover that I haven’t got into yet, like synchronizing uploads/backups (use S3 I guess?)

Now that I’m writing this down, I’m not actually sure that anyone has actually done this before. You might run into problems that require code changes.

edit: after reading about redis sentinel some more, I think my above advice is at least a little bit wrong. So, good luck!

I think I would probably start with an easier solution and just configure an automatic backup restoration everyday or more frequently depending on how much time a restore would take.

Yes but I need High Availability…