Configurazione server High Availability 3

Discourse supporta più macchine (ciascuna con un singolo container Docker) dietro un load balancer autonomo?

Ho bisogno di una configurazione di Discourse che gestisca il guasto di un server, quindi la mia risposta standard è configurare 3 server dietro un load balancer (con il LB che gestisce il certificato SSL).

Ho configurato server PostgreSQL e Redis esterni autonomi per Discourse. (Tutto questo è su Google Cloud Platform). Sto utilizzando il launcher di Discourse per configurare il container Docker dedicato solo al web.

  1. Discourse supporta l’esecuzione di più container quando ogni container si trova su una macchina diversa?
  2. Dovrei semplicemente copiare il container Docker creato dalla prima macchina sulle altre macchine?
  3. Come vengono gestiti i loghi caricati?
  4. I loghi caricati, i favicon, ecc. sono archiviati nel database?

Grazie mille per l’aiuto.

5 Mi Piace

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 Mi Piace

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 Mi Piace

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 Mi Piace

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

3 Mi Piace

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 Mi Piace

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 Mi Piace

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 Mi Piace

I’d set ENV DISCOURSE_FORCE_HTTPS: true

6 Mi Piace