Configure Discourse to use a separate PostgreSQL server

No sir, no problem. Thanks for the info

In my case, it was because I had scram-sha-256 and not trust as the auth mechanism.
Because scram-sha-256 requires a physical user.
You can probably work around that by creating a user map in pg_ident.conf but I’m not sure how.

If by “physical user” you mean “Unix system user” then no, scram-sha-256 does not require such a user configured on the system. The peer method requires a system user, and trust is just a terrible idea all around when you’re using a remote database server.

1 Like

Will we have to include the following in addition to the existing process ?

CREATE EXTENSION vector;

since I see this extension in the discourse_docker postgres template ?

That is used by the Discourse AI core plugin, so you will need that if you are using it.

I don’t remember enabling that plugin. Infact I just checked that it is disabled. But recently when i rebuilt the image, when the latest commit went beyond this commit - GitHub - discourse/discourse at 0eab7daea450e1d7e416c46a23aaaf95687d4855, rake db:migrate started failing. When i used the commit just before the above one to bootstrap, it continued to work.

Now that I have enabled this extension, commits later than this is working without issues.

1 Like

But now the ai plugin is in core, so you need the extension regardless of whether you use the AI plugin (or contrive to explicitly remove it), right?

1 Like

Oh that’s true, as migrations are ran independently of the plugin being enabled.

2 Likes

Using managed PostgreSQL server as a non super user, db migration will failed at EnablePgVectorExtension (‘20230710171141’) even though vector has been added it to the database manually. Is there a way to disable this migration step or have a check if vector exists.

Caused by:
ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: Because vector isn’t a trusted extension, only members of “azure_pg_admin” are allowed to use CREATE EXTENSION vector (ActiveRecord::StatementInvalid)
HINT: to learn how to allow an extension or see the list of allowed extensions, please refer to Considerations with the Use of Extensions and Modules | Microsoft Learn

We merged a PR to handle this last month, are you on the latest version?

1 Like

Thanks! I am using docker image discourse/discourse:3.5.3. Not sure if that include the latest PR? (Edit: Release v2025.12.0 includes the PR and work with Azure DB)

1 Like