# Does anyone have a multisite with external postgres?

**URL:** <https://meta.discourse.org/t/does-anyone-have-a-multisite-with-external-postgres/314436>\
**Category:** Self-hosting\
**Tags:** multisite, postgres\
**Created:** [July 1, 2024, 10:36am UTC](https://meta.discourse.org/t/does-anyone-have-a-multisite-with-external-postgres/314436 "2024-07-01T10:36:33Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)\
**Post date:** [July 1, 2024, 10:36am UTC](https://meta.discourse.org/t/does-anyone-have-a-multisite-with-external-postgres/314436/1 "2024-07-01T10:36:33Z")

</div>

Does anyone run multi-site with external postgres?

I have multisite config like this:

```plaintext
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:

```plaintext
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?

---

_[View the full topic](https://meta.discourse.org/t/does-anyone-have-a-multisite-with-external-postgres/314436)._
