High Availability


(Rob Spencer) #1

Hey guys,

I just wanted to bounce some ideas around for HA…

I have prod server running discourse under nginx, which I need to install some plugins on. For various reasons, I can’t afford any downtime. There is also a test server running the same setup.

My plan is:

  1. Enable readonly mode in prod.
  2. Backup and restore to test, (restore from tombstone for the images)
  3. Update nginx on the prod box to repoint to test.
  4. Install plugins and rebuild
  5. Update nginx to point back to prod
  6. Disable readonly mode in prod
  7. Shutdown test app

How does that sound? What am I missing?

Happy to turn this into a How To… if there’s value in that :slight_smile:

Cheers

Rob


(Rob Spencer) #2

Cancel the above :slight_smile:

Looks like Docker is the thing I’m after.


(Jay Pfaffman) #3

You can minimize downtime rebuilding with a two container setup.


(Rob Spencer) #4

Just looking into this now.

I’m guessing I just create a second dir called /var/discourseB or something, then build a single container in that?

Is there a way to duplicate a container?

Will nginx run in both containers?


(Jay Pfaffman) #5

You create separate data and web containers. You can search here and look in the samples directory in /var/discourse


(Rob Spencer) #6

It looks like there’s a huge gap in the documentation between installing Discourse following this guide: discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub

and running separate containers using this guide: How to run separate web and data containers?

How do I get one of the samples installed into a container?


(Rob Spencer) #7

Looks like you copy a sample into the containers folder, the run

./launcher rebuild <new container>

You can also copy an existing container for example

cp containers/app.yml containers/app2.yml

then rebuild this new app2 container with

./launch rebuild app2

(Rob Spencer) #8

The only thing I need to figure out now is how to make the outer nginx point to the right container, as the inner nginx is sitting in the shared container.


(Jay Pfaffman) #9

See How to move from standalone container to separate web and data containers

With your solution you could just put each instance on a different port and configure Nginx to use whichever one is available.