# Two standalone instances on one server?

**URL:** https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551
**Category:** Self-hosting
**Created:** [April 6, 2017, 2:33pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551 "2017-04-06T14:33:37Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [April 6, 2017, 2:33pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/1 "2017-04-06T14:33:37Z")

</div>

I’d like to create a second instance of Discourse on my server, which is completely self-contained. It will be another forum entirely.

I assume Docker helps us host setups like this, although I’m concerned to understand any potentially clashes between the two instances, if I were to add a second.

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 6, 2017, 2:38pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/2 "2017-04-06T14:38:30Z")

</div>

No problem at all. I have such configuration running. You just need an external nginx to help mux 80/443 port.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 6, 2017, 2:47pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/5 "2017-04-06T14:47:58Z")

</div>

Someone wrote a blog post about that 🙂

> **[The current state of Brotli compression](https://samsaffron.com/archive/2016/06/15/the-current-state-of-brotli-compression)**
>
> Sam's Spot - Sam saffron's web log

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [April 6, 2017, 2:58pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/6 "2017-04-06T14:58:11Z")

</div>

> [@kraml](#):
>
> No problem at all. I have such configuration running.

Thanks!

Do I need to change app.yml in the second instance to avoid any name clashes within Docker engine?

> [@sam](#):
>
> external NGINX is what I would go for as well.

Yup - planning on using my external Nginx as a front-end proxy.

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 6, 2017, 3:15pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/7 "2017-04-06T15:15:54Z")

</div>

Thanks! Got some thing new to play with.

---

<div class="post-metadata">

### Author: ![PabloC](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pabloc/32/49633_2.png) [@PabloC](https://meta.discourse.org/u/PabloC)
#### Post date: [April 6, 2017, 3:19pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/8 "2017-04-06T15:19:32Z")

</div>

Another alternative is to use haproxy as front end.  
There are some old posts in Meta about this.

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 6, 2017, 3:25pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/9 "2017-04-06T15:25:54Z")

</div>

You second instance cannot have “app.yml” as the filename since it is going to be the Docker container name. You can just copy the app.yml file from the first instance and edit it to suit your configuration for 2nd one, and save it under a different filename. Then you need to `./launcher bootstrap <new app.yml file>` to bring it up.

Regarding HTTP2 support, all you need is a recent enough nginx which supports HTTP2. Since now you have an external nginx, the SSL setup should be done in it instead of in the container.

You have two options to do SSL setup, if you are using Let’s Encrypt.

1. Setup LE outside of container. This is the approach I took. This enables you to manage the certificates from a single point. I personally prefer DNS over web server challenge validation. I have a [blog post](https://linuxer.pro/2017/03/setup-free-ssl-with-lets-encrypt-and-dns-validation/) for that if you would like to give it a try.

2. Let the two containers handle their LE application/renew stuff the same as you have with a single container. Since you can access container files under /var/discourse/shared from the host, you can let external nginx to pick the SSL certificates there and serve HTTPS. This may require some edit in app.yml. Since I personally don’t use it so you have to figure it out by yourself.

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [April 7, 2017, 2:59pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/16 "2017-04-07T14:59:23Z")

</div>

**EDIT: Some of these steps are unnecessary - see post below by @kraml**

I now have my second Discourse instance running.

1. Checked out the Discourse code into `/var/[myforum]`
2. Took the content of `standalone.yml` from `/samples` and created `/containers/[myforum].yml`
3. In `/containers/[myforum].yml`
4. replaced all instances of `/var/discourse` with `/var/[myforum]` (e.g. volume configuration)
5. set unique ports
6. Ran `./launcher bootstrap [myforum].yml`
7. Ran `./launcher start [myforum].yml`
8. Added nginx config for the new domain

And it’s working perfectly first time. Another win for Discourse!

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 7, 2017, 3:16pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/17 "2017-04-07T15:16:57Z")

</div>

You actually don’t need another /var/[myforum]… You can just use the same /var/discourse for multiple instances.

`/var/discourse/containers/app.yml` → This is the default instance you get by running `discourse-setup`

`/var/discourse/containers/myforum.yml` → This is the 2nd instance you get by running `cp app.yml myforum.yml` && edit && `./launcher bootstrap myforum`

When editing myforum.yml, make sure you put a different host path under the volumes section, so that your 2nd container stores its data under a different directory than the 1st one.

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 9, 2017, 11:40am UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/20 "2017-04-09T11:40:46Z")

</div>

A bit off topic. I got gzip content-encoding back from meta on Firefox 53 beta and Chrom 57. Is there anything wrong?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 9, 2017, 2:38pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/21 "2017-04-09T14:38:39Z")

</div>

we only send our static assets with brotli, dynamic assets are a much trickier story.

---

<div class="post-metadata">

### Author: ![kraml](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kraml/32/68627_2.png) [@kraml](https://meta.discourse.org/u/kraml)
#### Post date: [April 9, 2017, 3:01pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/22 "2017-04-09T15:01:23Z")

</div>

Oh I see, indeed so.

---

<div class="post-metadata">

### Author: ![N8Athlete](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/n8athlete/32/98339_2.png) [@N8Athlete](https://meta.discourse.org/u/N8Athlete)
#### Post date: [June 7, 2018, 2:31am UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/23 "2018-06-07T02:31:12Z")

</div>

thanks to you and @kraml for your work and insight on how to set up dual instances of a discourse community. usually takes me a bit to get something like this done. but now have 2 instances working behind nginx proxy. thanks to you both.😀

---

<div class="post-metadata">

### Author: ![PackElend](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/packelend/32/95294_2.png) [@PackElend](https://meta.discourse.org/u/PackElend)
#### Post date: [August 8, 2019, 9:49am UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/25 "2019-08-08T09:49:21Z")

</div>

Hello,  
what is the difference between this approach and [Multisite configuration with Docker](https://meta.discourse.org/t/multisite-configuration-with-docker/14084)?  
I need a development (for testing plugins) and a production instance of Discourse on a Digital Ocean cloud server, which is why I am asking.

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [August 8, 2019, 12:23pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/26 "2019-08-08T12:23:45Z")

</div>

Multisite setup uses one database service and a shared pool of application workers for all the sites. This configuration has a completely separate database and unicorn cluster for the sites, which potentially requires a lot more RAM.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 15, 2023, 7:05pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/27 "2023-02-15T19:05:02Z")

</div>



---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 16, 2023, 12:36pm UTC](https://meta.discourse.org/t/two-standalone-instances-on-one-server/60551/28 "2023-02-16T12:36:32Z")

</div>


