Does anyone have a multisite with external postgres?

Does anyone run multi-site with external postgres?

I have multisite config like this:

before_bundle_exec:
    - file:
        path: $home/config/multisite.yml
        contents: |
          example:
           adapter: postgresql
           database: example
            pool: 5
           timeout: 5000
           host_names:
             - example.com

I see:

I, [2024-07-01T10:26:26.110357 #1]  INFO -- : Multisite migrator is running using 1 threads

Migrating default
Migrating example

Then alter the rebuild is failing on:

cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate failed with return #<Process::Status: pid 433 ex it 1>

When I check the database, I see that the tables for the default discourse database have been created, but none of the other ones.

Do I somehow need to also add the postgres host and port to the multisite config section above instead of relying on the main section in env? If so, what is the correct syntax for db host, port, username, password?

OK. I think I answered my own question. I added the database parameters to each ‘site’ and now it seems to be progressing.

So this is interesting in that it seems that multisite allows flexibility of separate database for each multi-site.

EDIT: confirmed, adding full database details for each site allowed the bootstrap to proceed.

2 Likes

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