High Availability 3 Server setup

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.

4 Likes

Yes, that how we run it at our hosting service.

  1. Yes
  2. Yes
  3. You should configure Using Object Storage for Uploads (S3 & Clones)
  4. No, they go to object storage as said in 3.
7 Likes

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?

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

cd /var/discourse
./launcher enter app
rails c
SiteSetting.force_https = true
2 Likes

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ā€™?

2 Likes

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

3 Likes

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?

Yup, launcher asks Docker to autorestart the containers.

2 Likes

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?

1 Like

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).
5 Likes

Iā€™d set ENV DISCOURSE_FORCE_HTTPS: true

6 Likes