# Discourse double branch offices installation

**URL:** https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595
**Category:** Self-hosting
**Created:** [September 22, 2017, 5:55pm UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595 "2017-09-22T17:55:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Julian\_Somoza](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@Julian\_Somoza](https://meta.discourse.org/u/Julian_Somoza)
#### Post date: [September 22, 2017, 5:55pm UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595/1 "2017-09-22T17:55:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [September 22, 2017, 6:11pm UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595/2 "2017-09-22T18:11:14Z")

</div>

Hi,

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

---

<div class="post-metadata">

### Author: ![Julian\_Somoza](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@Julian\_Somoza](https://meta.discourse.org/u/Julian_Somoza)
#### Post date: [September 22, 2017, 7:02pm UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595/3 "2017-09-22T19:02:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [September 22, 2017, 7:55pm UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595/4 "2017-09-22T19:55:56Z")

</div>

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](https://github.com/discourse/discourse/blob/master/config/discourse_defaults.conf#L46))
- 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!

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [September 23, 2017, 1:08am UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595/5 "2017-09-23T01:08:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Julian\_Somoza](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@Julian\_Somoza](https://meta.discourse.org/u/Julian_Somoza)
#### Post date: [September 25, 2017, 2:39pm UTC](https://meta.discourse.org/t/discourse-double-branch-offices-installation/70595/6 "2017-09-25T14:39:16Z")

</div>

Yes but I need High Availability…
