Multiple subdomain instances of Discourse at the same domain?

Hi,

I’m trying to make a two separate Discourse forums (including users, topics, categories, etc.). However, when I get a new instance and try to host it with the same domain, but a different subdomain, it takes my current Discourse instance and makes it inaccessible.

For example, if my current Discourse runs at discourse.example.com, then I try to launch a second Discourse at discourse2.example.com, then the existing instance stops working and nothing is shown in the second URL. However, I can just rebuild the first Discourse at discourse.example.com and my first instance is restored.

During the setup, all the settings were the same as the first except for the Discourse Hostname. Can anyone explain why this happens and how I can make a fresh instance for discourse2.example.com?

1 Like

Have you looked into

Multisite Configuration with Let's Encrypt and no reverse proxy

4 Likes

Or alternatively into

other website being discourse in this particular case

4 Likes

Thank you for your suggestions everyone. I was able to create a second Discourse using a combination of these two websites:

  1. Running other websites on the same machine as Discourse (@angus 's response was especially helpful)
  2. How to install Multiple discourse on one server | by Pushpender singh | Medium

Although these two websites suggest a very similar process, the second website acts as a more beginner-friendly supplement to the first link and I strongly recommend for anyone who attempts to do the same thing to read both while setting up their system.

Right now, my second Discourse is currently marked as “insecure” (because I copied the certificate from the previous instance in /var/discourse/shared/standalone/ssl in order to avoid the “file not found” error when I tried sudo nginx -t). Could someone tell me how to make the second Discourse site https secure (the first one has no issues)? Thank you in advance.

2 Likes

Why not give it a try with @pfaffman’s tutorial (that @itsbhanusharma shared above)? It will just handle the certificates. I’ve actually followed it a few times now and I’m still in awe how it simplifies the matter!

Truth be told it has a downside in that you will get greedy and spin up an additional instance for any little task… I think I’m at 7 now and need more :grinning_face_with_smiling_eyes:

4 Likes

Thank you for the suggestion. I’m giving it a try, but I’m having trouble with a couple of things in the guide:

  1. I can’t seem to find the Database password (or what it is even used for in the file)

  2. My app.yml file did not originally contain an after_postgres section, so I added one under hooks to match the others (after_ssl, after_db_migrate, etc.). If this is placed in the wrong section, please let me know, I’m completely new to working with this type of stuff.

  3. When I check the syntax of the YAML file on http://www.yamllint.com/ I get (<unknown>): did not find expected key while parsing a block mapping on the line where I put the after_postgres section under the hooks section.

If you could clarify the steps you did @nolo while following the aforementioned guide, that would be greatly appreciated.

2 Likes

I actually always did it for a two-container setup and it works fine for that. You can easily get this by installing Discourse with ./discourse-setup --two-container and then adjust both web_only.yml and data.yml

If you want to try again with just one container, but the steps are unclear for that, it’s maybe best to post in the topic and point out your issues. I actually have no clue how these files work myself… that’s why I’m so happy there was a simple approach and I can finally spin up several instances for development. One thing that’s also really handy for development is that you will have your plugins already installed on any additional instance.

About the syntax error: did you use a tab for indention? It’s freaking picky about formatting.

2 Likes

No I didn’t use tabs and I’m pretty sure the copy-paste from the guide didn’t put any in (though I only did a brief check). I’d like to avoid doing a two container setup if possible, so I will make a post in the guide asking for help. Thank you very much for your assistance!

2 Likes