Use CloudPanel to manage multiple sites with Discourse

You can go directly to my step-by-step tutorial here…

On my (Hetzner) dedicated server I have installed a fresh Discourse instance (and that is the only thing on the server at this point.)

Now I want to use CloudPanel as the reverse proxy, so I can also use the server to host Ghost blogs and Wordpress sites for some of my clients.

From reading this tutorial, and having also studied the other posts also below, it seems possible.

But I’m struggling with my learning curve about reverse proxies.

I can easily install and manage my sites using the CloudPanel.

But, I am not clear about the correct order or procedure to make CloudPanel play nice with Discourse.

I would like to document the procedure here in this post.

Can anyone walk me through this?

First follow one of those guides to move discourse to another port and remove the ssl and let’s encrypt templates and rebuild. Then tell your reverse proxy to use that port.

3 Likes

What if I install CloudPanel first, and create a reverse proxy in the interface…


… and/or in the Vhost Editor…

… could I then install Discourse?

Or, is it necessary or somehow preferable to install Discourse first?

I’d like to provide the steps to the most simple/intuitive way (for other simpletons like me :slight_smile: )

It doesn’t matter. As long as

  • Discourse doesn’t use ports 80/443 because conflict will crash your reverse proxy
  • Discourse doesn’t use SSL but exposing port 80 to that port what reverse proxy uses to backend

So it doesn’t matter means Discourse must be set up as backend before you start reverse proxy and is unreachable some time at that point.

1 Like

It’s not a setup for a simpleton. You’ll have to understand both how a reverse proxy works and how to configure discourse manually. It’s not going to be simple, or intuitive.

It’s difficult enough to support the standard install for novices. Many, many hours have been spent making those instructions work for people who don’t know anything about system administration.

2 Likes

Many, many hours have been spent making those instructions work for people who don’t know anything about system administration.

@pfaffman I hope I can help lower those hours for you going forward!

1 Like

Is containers/app.yml a file that is created by the installer? (I’m not finding it in the repository.)

I have edited the standalone.yml file and renamed it app.yml

If I place that file into containers/ and then run ./discourse-setup, should that work?

(Assuming that I have correctly configured the settings in my app.yml)

It is.

As a relative newcomer to Discourse, the right way to do this looks something like:

  • Temporarily disable your reverse proxy.
  • Install Discourse with SSL/Lets Encrypt disabled
  • Verify a working install on :80
  • Change the discourse port to 81 or another nonstandard port, or better still use a socket.
  • Spin up the reverse proxy again, configure against discourse installation (including https encapsulation)
  • Enable force_https

If you don’t install Discourse without the RP up there are too many areas this could go wrong to practically troubleshoot.

1 Like

You can’t use discourse-setup for your setup. If you edited it then run

./launcher rebuild app

2 Likes

Miracle of miracles – we did it! Thank you for all of your help! I’ll document the procedure in the Topic post above.

2 Likes

OK just stuck on a (small, I think) thing…

To create a second Discourse instance I create and edit the app2.yml, and the server_name.conf for the second Discourse, changing the DISCOURSE_HOSTNAME and the server_name.

But then… how do I build the app2? I tried:

service nginx restart

./launcher stop app

./launcher rebuild app2

and

./discourse-setup (I had used ./discourse setup for installing the first instance and then went back and edited the app.yml, and it did work out on the first instance.)

This procedure did result in a Discourse at the second URL, but it seems to be getting data from the first instance.

I’m not understanding something. What is the proper way to build the second site on the second domain?

2 Likes

Is your reverse proxy configured to listen for the second domain and route the traffic to a different port?

2 Likes

You need to change the directory that it uses where it says /var/discourse/standalone to something different (standalone2?).

You might want to use a two container setup so that your running only one copy of postgres (I think the Multisite configuration with Docker has some hints), but if you have lots of ram you may not care.

1 Like

Whoa. I never would have figured that out on my own. You are my hero of the day.

What I’m doing here is (for a client) building a prototype for a versatile Discourse publishing system for Creator-types, integrating Ghost with Discourse.

I’m a front end dev, and now need to fully learn the sysadmin.

So I need to build both a multisite and separate containers.

This is my server setup:

  1. a dedicated server on Hetzner (6 CPU Cores, 64 GB Ram and 2x512GB NVMe)

  2. a VPS on Contabo (8 CPU Cores, 30 GB Ram and 200 GB NVMe)

1 Like
3 Likes

I don’t know anything about it, but if you and others think your tutorial is reliable, feel free to create a new sysadmin how-to advanced-setup and whatever other tags you think fits in :slight_smile:
(before your answer is automatically deleted in one month :stuck_out_tongue: )

3 Likes

OK yes. So for that second instance it worked to (after creating a new Site in the CloudPanel):

  1. manually create and edit the app2.yml, changing each instance in that file of standalone to standalone2

  2. also change standalone to standalone2 in the Vhost file

  3. run ./launcher rebuild app2

I think I also cleared all of the Cloudflare caches restarted nginx and then also restarted the server.

Thank you again for your help.

2 Likes

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