Various multisite installation questions

I was wondering what does the db_id: 2 value in the suggested config above do?

Also, what is the procedure to add a new site to the existing multisite set-up? Is it just:

  • Update yaml
  • ./launcher bootstrap multisite [1]
  • ./launcher start multisite

I was wondering if there was a way to avoid impacting all the other existing sites by doing a full bootstrap or rebuild and somehow just add the extra database needed?


  1. I tried ./launcher rebuild multisite first, but this seems to fail ↩︎

I think that the db id is no longer needed.

You can just edit the multisite file with the new site and do a

sv restart unicorn

And then migrate the database.

1 like

You are a life-saver!

I was missing this command to restart (I also tried sv reload unicorn but somehow that wasn’t enough).

In terms of creating the database, is there already a way to do this automatically? It would be nice to have rake db:create[mynewdbname]. Otherwise, I can write a short shell script.

At the moment, I create manually (create db and set permissions) and then do a RAILS_DB=newdb rake db:migrate to populate it.

And just to check if I’m doing something stupid:

  • At the moment, I’m editing the multisite file within docker (/var/www/discourse/config/multisite.yml)
  • Creating the db manually
  • Running rake db:migrate
  • sv restart unicorn
  • I then also have to edit the yaml file outside of docker so that the multisite config is in sync in case of any future rebuild or upgrades.

Am I being silly editing the mutisite config in 2 different places when there’s already a way to edit in one place and push the changes through?

1 like

Is it possible to clean up this documentation a bit and provide a bit more directions in it? I am extremely new to Docker first off and although I have linux server experience I am not a pro at it. I am an old schooler love my cron jobs and shell scripts and you know weird stuff like that with apache multi site etc. But this is a bit more complex and using a different programming language than I am use to.. Maybe even possibly an Demonstration video of some kind? It would be nice if discourse was just made multi site ready and that way all you would have to do is just edit a few files etc.

2 likes

Just paste in that stanza of text and edit it to suit.

You also then either need a reverse proxy or to follow Set up Let’s Encrypt with multiple domains / redirects to get certs for all of the domains.

See also Setup Multisite Configuration with Let’s Encrypt and no Reverse Proxy. But that needs to get updated to have another line required that you can get from the previous link. I’ve been meaning to update it but haven’t managed

1 like

If I’m doing multisite, where should I point my domain to? The same IP as the server (which hosts another forum)?

Yes, point all domains to the same server IP.
Set up a revers proxy with Nginx or Caddy server.
Caddy is the best as it gives free automatic SSL certs to all your domains.

1 like

I followed this tutorial to set up with success a multisite install with Docker. I recently ran into an error when trying to upgrade and I believe the line:

    - exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate

Should be edited to:

    - exec: cd /var/www/discourse && sudo -H -E -u discourse bundle exec rake multisite:migrate

Could anyone confirm/edit the tutorial?

1 like

Yes. I ran into this too. You want to make that change otherwise your bootstrap will fail.

2 likes