# High Availability 3 Server setup

**URL:** <https://meta.discourse.org/t/high-availability-3-server-setup/180251>\
**Category:** Self-hosting\
**Tags:** hosting\
**Created:** [February 18, 2021, 8:02pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251 "2021-02-18T20:02:32Z")\
**Posts on this page:** 11\
**Page:** 1

## AI-generated summary

The discussion revolves around setting up a high availability 3 server setup for Discourse behind a standalone load balancer. [andy212](/t/-/180251/1) asks if Discourse supports running multiple containers on different machines, and [Falco](/t/-/180251/2) confirms it does.

[Falco](/t/-/180251/2) also advises [andy212](/t/-/180251/1) to configure object storage for uploaded logos and other files, and provides a link to the relevant guide.

When [andy212](/t/-/180251/3) encounters an issue with SSL termination on the load balancer, [Falco](/t/-/180251/4) provides a solution by setting `SiteSetting.force_https = true` in the rails console.

[andy212](/t/-/180251/5) asks how to achieve this in the `app.yml` file, and [Falco](/t/-/180251/6) points to an example in the sample file.

[andy212](/t/-/180251/7) also asks if the docker container is monitored and if it will restart if it stops, and [riking](/t/-/180251/8) confirms that `launcher` asks Docker to autorestart the containers.

Later, [andy212](/t/-/180251/11) asks about running multiple machines with the same setup, and [riking](/t/-/180251/12) provides two options: using `./launcher start-command app` or copying the `app.yml` over and running `launcher start`.

Additionally, [pfaffman](/t/-/180251/14) suggests setting the `DISCOURSE_FORCE_HTTPS` environment variable to `true` to make Discourse aware of HTTPS links.

<div class="post-metadata">

**Author:** ![andy212](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@andy212](https://meta.discourse.org/u/andy212)\
**Post date:** [February 18, 2021, 8:02pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/1 "2021-02-18T20:02:32Z")

</div>

Does Discourse support multiple machines (each with a single docker container) behind a standalone load balancer?

I require a Discourse setup to handle the failure of a server, so my standard response is to configure 3 servers behind a load balancer (with the LB handling the SSL certificate).

I have configured standalone external postgres and redis servers for Discourse. (This is all on Google Cloud Platform). I am using the Discourse launcher to configure the web-only docker container.

1. Does Discourse support running multiple containers when each container is on a different machine?
2. Should I just copy the created docker container from the first machine to the other machines?
3. How are uploaded logos handled?
4. Are uploaded logos, favicons, etc stored in the database?

Many thanks for help.

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 18, 2021, 8:32pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/2 "2021-02-18T20:32:07Z")

</div>

> [@andy212](#):
>
> Does Discourse support multiple machines (each with a single docker container) behind a standalone load balancer?

Yes, that how we run it at [our hosting service](https://discourse.org/buy).

1. Yes
2. Yes
3. You should configure [Using Object Storage for Uploads (S3 & Clones)](https://meta.discourse.org/t/using-object-storage-for-uploads-s3-clones/148916)
4. No, they go to object storage as said in 3.

---

<div class="post-metadata">

**Author:** ![andy212](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@andy212](https://meta.discourse.org/u/andy212)\
**Post date:** [February 18, 2021, 8:41pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/3 "2021-02-18T20:41:49Z")

</div>

Thanks Rafael. Much appreciated.

I have run into an issue with the SSL terminated on the load balancer. Discourse specifies all it’s links as HTTP.

Is there a way to make Discourse aware that it’s links should be https?

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 18, 2021, 8:48pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/4 "2021-02-18T20:48:31Z")

</div>

Yes, drop to a rails console and set it to https with:

```plaintext
cd /var/discourse
./launcher enter app
rails c
SiteSetting.force_https = true

```

---

<div class="post-metadata">

**Author:** ![andy212](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@andy212](https://meta.discourse.org/u/andy212)\
**Post date:** [February 18, 2021, 8:52pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/5 "2021-02-18T20:52:37Z")

</div>

Excellent. Thanks again.

I presume that I could to the app.yml  
` - exec: rails c "SiteSetting.force_https = true"`

I have no idea about rails. In my command above, should it be ‘rails c’ or ‘rails r’?

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 18, 2021, 8:57pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/6 "2021-02-18T20:57:50Z")

</div>

We do have an example of changing site settings on bootstrap in our sample file:

> <https://github.com/discourse/discourse_docker/blob/master/samples/standalone.yml#L105>

---

<div class="post-metadata">

**Author:** ![andy212](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@andy212](https://meta.discourse.org/u/andy212)\
**Post date:** [February 19, 2021, 12:55am UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/7 "2021-02-19T00:55:58Z")

</div>

Yep, that is where I copied my command from.

One last question. Is the docker container monitored? If the docker container stops for any reason, has `launcher` setup anything to restart it?

---

<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:** [February 19, 2021, 1:22am UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/8 "2021-02-19T01:22:45Z")

</div>

Yup, `launcher` asks Docker to autorestart the containers.

---

<div class="post-metadata">

**Author:** ![andy212](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@andy212](https://meta.discourse.org/u/andy212)\
**Post date:** [February 19, 2021, 5:52am UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/11 "2021-02-19T05:52:49Z")

</div>

Okay. So I have now have a working discourse on a single machine. I have two other machines. The docker guest /shared volume is pointed to an NFS directory to allow all machines to access the uploads (esp. logos, etc).

I have copied the docker images to the machines 2 and 3 (`docker save -o app-image local_discourse/app` and then `docker load -i app-image`.

I was under the impression that a simple `./launcher start app` would work, but it attempts to check containers/app.yml.

Will I run into problems if I allow the app.yml to be checked (and changes made) to the DB from machine 2 and 3?

Is there a better way to have three machines running a single setup?

---

<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:** [February 19, 2021, 10:44am UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/12 "2021-02-19T10:44:32Z")

</div>

You have two options:

- Use – I think it’s `./launcher start-command app` – on the fully set up machine (the “build machine”) to obtain a complete Docker command line
- Copy the app.yml over, and do what you just attempted (launcher start).

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [February 19, 2021, 4:21pm UTC](https://meta.discourse.org/t/high-availability-3-server-setup/180251/14 "2021-02-19T16:21:38Z")

</div>

> [@andy212](#):
>
> Is there a way to make Discourse aware that it’s links should be https?

I’d set ENV `DISCOURSE_FORCE_HTTPS: true`
