# Multiple instances. Visiting the second instance signs out the logged in account on the running instance

**URL:** https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393
**Category:** Development
**Created:** [3월 23, 2019, 2:23오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393 "2019-03-23T02:23:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Young\_Nam](https://avatars.discourse-cdn.com/v4/letter/y/ea666f/32.png) [@Young\_Nam](https://meta.discourse.org/u/Young_Nam)
#### Post date: [3월 23, 2019, 2:23오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/1 "2019-03-23T02:23:52Z")

</div>

**EDIT after resolved** : This happened when I open the second Discourse instance, not when I start the server.

* * *

I have two Discourse directories. I followed the following guide to install it.:

> [@Install Discourse on Ubuntu or Debian for Development](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727):
>
> warning This guide covers installation instructions in a development environment. For a production guide see: [Install Discourse in production with the official supported instructions](https://meta.discourse.org/t/how-to-install-discourse-in-production/142537) So you want to set up Discourse on Ubuntu or Debian to hack on and develop with? We’ll assume that you work locally and don’t have Ruby/Rails/Postgres/Redis installed on your Ubuntu or Debian system. Let’s begin! Requirements We suggest having at least 4 GB RAM and 2 CPU cores. Current compatibility: O…

So, the first one, say,

```plaintext
cd ~/discourse
bundle exec rails server --binding=0.0.0.0

```

is running okay, I can sign in, create my topics, etc.

Then I run another Dicsourse instance after changing the `config/database.yml` to use different ‘database’ name and run it on different port:

```plaintext
cd ~/discourse2
bundle exec rails server -p <different-port> --binding=0.0.0.0

```

It does create those databases additionally. And it runs, sure. But when I visit the first instance that’s been running and refresh, I’m signed out from it. I can log in into the second instance, and start my thing there. And when I log into my first instance, it signs me out from the second instance.

And now I’ve tried running Discourse on Docker, it runs, but when I visit `localhost` and I get the “Register page”, I’m logged out from the running Discourse.

I’m not trying to use one account for two instances.

How do I keep each account signed-in on its own Discourse instance? (Account ‘foo’ on ‘discourse’ and account ‘bar’ on ‘discourse-2’ instance)

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [3월 23, 2019, 3:33오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/2 "2019-03-23T03:33:55Z")

</div>

Are these meant to be production instances, or for development purposes?

---

<div class="post-metadata">

### Author: ![Young\_Nam](https://avatars.discourse-cdn.com/v4/letter/y/ea666f/32.png) [@Young\_Nam](https://meta.discourse.org/u/Young_Nam)
#### Post date: [3월 23, 2019, 3:48오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/3 "2019-03-23T03:48:25Z")

</div>

Correct me if I’m wrong, I’m thinking of Discourse running from a Docker container to be the production instances (or purpose?) and the instances that run from the `discourse/discourse` [repo](https://github.com/discourse/discourse) to be development instance.

I tried running two development instances first, then failed (visiting or starting one instance logs me out from currently running one, but I can log in again which would log me out from the newly started/visited instance if I’m already logged in).

Then tried with an instance running in development instance, and another from Docker, and the same thing happens.

So, I need at least one ‘development purpose’ Discourse to run. And I need one instance for my own personal use. Sure, I could host the personal one of ‘production instance’ on a cloud service, but that would cost me (little amount of) money. Even then, I’m just confused why this is the case when I’m expecting it to just work.

---

<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: [3월 23, 2019, 12:27오후 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/4 "2019-03-23T12:27:14Z")

</div>

They need to have different host names. Otherwise they try to use the same cookies.

---

<div class="post-metadata">

### Author: ![Young\_Nam](https://avatars.discourse-cdn.com/v4/letter/y/ea666f/32.png) [@Young\_Nam](https://meta.discourse.org/u/Young_Nam)
#### Post date: [3월 23, 2019, 11:58오후 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/5 "2019-03-23T23:58:49Z")

</div>

Oh my god. Thank you.

I was able to have each account on each instance not interfere each other’s login by using different browser, or different ‘account bounded chrome instance’ (or something).

---

<div class="post-metadata">

### Author: ![Young\_Nam](https://avatars.discourse-cdn.com/v4/letter/y/ea666f/32.png) [@Young\_Nam](https://meta.discourse.org/u/Young_Nam)
#### Post date: [3월 25, 2019, 5:09오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/6 "2019-03-25T05:09:48Z")

</div>

The following seem to work

- Using different ‘chrome’ instances (such as the guest window)
- Using `127.0.0.1` instead of `localhost`

What are some other ways to avoid two servers serving clients with same cookie.

Could using ‘alias’ be an example?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [3월 25, 2019, 7:11오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/7 "2019-03-25T07:11:33Z")

</div>

Just use two hostfile entries. They can share the same IP, and won’t suffer from cookie collision.

---

<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: [4월 24, 2019, 7:11오전 UTC](https://meta.discourse.org/t/multiple-instances-visiting-the-second-instance-signs-out-the-logged-in-account-on-the-running-instance/112393/8 "2019-04-24T07:11:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
