How can I host more than 1 Discourse forum on 1 VPS?

Hello! I as wondering if I can host more than one Discourse on 1 VPS. Since i’m a beginner, can I please have clear, step-by-step instructions? Thanks.

Yes you can!

However, this is an advanced topic you will need to know these basic concepts:

  • What is a reverse proxy?
  • What reverse proxy should I use?
  • How do I configure a virtual host on a reverse proxy?
  • How do I configure a virtual host as a reverse proxy to my web app?
  • How do I configure a web app to work with a reverse proxy?
  • How do I set up SSL when using a reverse proxy.

@Aiden12114, are you familiar with these concepts?

If so, you are good to go, for sure!

5 Likes

Sadly, I have no idea what any of that means :rofl:

You have two options:

  • Multisite - more complicated Multisite configuration with Docker
  • Multiple containers - slightly complicated (requires a reverse proxy etc as mentioned above), more expensive.
    Follow the instructions for setting up Discourse without the ./discourse-setup script (cp samples/standalone.yml containers/app2.yml) and rename the volumes to something other than standalone.
2 Likes

I think it is important to share a few technical facts to anyone interested or making a decision about this:

  • A single Discourse container with multiple “sites” per container, or
  • Multiple containers for each Discourse “site”.

If you use the “single container, multisite” approach, and you have 5 Discourse sites up and running (or even 10), when you rebuild your container, or have a problem with the container for any reason, you will have 5 (or 10) Discourse sites failing (or down) at the same time. This is because you have one container supporting all the “sites”.

If you use the “multiple container” approach, and you have 5 Discourse sites up and running (or 10), when you rebuild a container for one of your sites, or have a problem with a site container for any reason, you will have 1 Discourse site failing (or down). This is because you have one container supporting one “site” (or two if you are running separate data and app containers, per site, like we do).

In addition, because how Docker overlays and shares all of the read-only layers for each container (when using the Discourse recommended Docker storage driver, overlay2) between containers; only a thin read-write overlay layer is unique per container (for log files, the cache, etc), using multiple containers does not take very much additional disk space due to how the OverlayFS works.

For more on this interesting topic of how the Docker overlay driver works (and shares libs between containers), kindly refer to:

Obviously, the choice is up to each sys admin which approach to take. Based on our analysis, we have chosen to always go with the multi-container approach; for the reasons outline above (and some reasons yet discussed).

HTH

2 Likes