Success - New Multisite Install on Dedicated server using ServerPilot, Nginx and Apache

We run multiple Discourse apps easily (on the same server) with one container for the data and one container for the app, for each “domain instance” we run.

In addition, for each “domain instance” we run two applications containers. This means there is zero downtime when we rebuild a container.

Why?

Because when “container a” is running, we rebuild “container b”; and after “container b” has rebuilt, we wait about 1 minute and we reconfigure the reverse proxy to proxy to the unix socket for “container b” and run (in the apache2 case) service apache2 restart.

This means there is basically zero downtime (maybe a few millseconds) when switching containers.

I have been following this thread in awe at how difficult (or complicated) many people are making something which is basically very simple.

Production Discourse runs in a Docker container; and the good Discourse team has provided the core templates to expose Discourse either a TCP/IP socket or UNIX domain socket (per application instance). In addition, the good meta team has provided the core template to run the data (PostgreSQL) container separately from the application (Rails, JS) container.

The exact same concept applies for any node.js application which runs in a container. These configurations (reverse proxies to containers) are basic Docker tasks which apply to any web applications which runs in a container, Discourse just happens to be one of them, and one of the best as we all know :slight_smile:

Sometimes I think the excellent team at meta Discourse makes spinning up their container so easy with their well done wrapper scripts, that users fail to understand that the underlying fundamentals of running a web-based Docker application behind a reverse proxy is really quite simple.

We can run just about “as many Discourse applications” as we like, as virtual hosts, no different than a webmaster would run 20 “old fashioned LAMP web apps” in the same server. The only difference is that instead of a virtual host to a directory of PHP files, there is a virtual host to (in our case) a UNIX domain docket. Docker makes this very efficient by sharing core libs and overlays between containers!

In addition, because networking between containers is built-in to Docker, it is very easy to set up Discourse (as an application container) to work with a PostgreSQL (data) container; which is provided for all users as a example template by the good meta team, for those who want to enjoy running Discourse in more “interesting” ways (configurations).

My advice, for what little it is worth, is to understand that Discourse is simply a web app running in a container behind a reverse proxy, like any web app. We also run our private Docker registry (more than one actually) in the same manner as well; a Docker application behind the same reverse proxy to port 5000 (the default Docker registry port).

Discourse, in their wisdom to make life easy for users (and Discourse accessible to non-sys admin gurus), provides the capability to expose the web applications directly (without a reverse proxy) in their OOTB configuration. In addition, setting up a reverse proxy outside the Docker container is the same for all of these Dockerized web applications. The meta team provides those templates as well (such great support if you think about it!).

In closing, it is very easy to run one, twenty, or more dockerized applications behind a reverse proxy. They are just containers (and all of them could be a different Discourse forum) and the choice of how to expose the containers are up the user (the sys admin) and so are the choices of how to set up persistant storage volumes including databases.

I think that this is so simple and the meta team has made it so simple for everyone; but one of the side-effects by making it so simple, is that people forgot (or do not learn) the fundamentals of how easy and elegant the dockerized configuration (behind a reverse proxy) actually is (independent of Discourse).

Hope this helps in some small way.

All the best!