Let’s say you’re using AWS RDS, or an existing PostgreSQL server managed elsewhere. It’s fairly straightforward to get Discourse to use such a setup, without needing to grant superuser privileges to anything that Discourse itself runs. Here’s how.
Discourse requires PostgreSQL 9.5 or later; if you try to run on an older version, it might work, but we don’t guarantee it, and if something breaks in the future, you get to keep both pieces. We also require some extensions that are distributed in the
postgresql-contrib package (or its equivalent).
1. Setup the DB
As a database superuser, run the following:
CREATE USER discourse PASSWORD 's3kr1t'; CREATE DATABASE discourse OWNER discourse; \c discourse CREATE EXTENSION hstore; CREATE EXTENSION pg_trgm;
That’s all that has to be done to prepare the DB for use by Discourse.
2. Configure Discourse
Get Discourse setup in the usual way, and then edit
containers/app.yml as follows:
Remove the line
- "templates/postgres.template.yml"under the
templatestop-level key (towards the top of the file);
envtop-level key, set the following:
DISCOURSE_DB_USERNAME: discourse DISCOURSE_DB_PASSWORD: s3kr1t DISCOURSE_DB_HOST: <IP or hostname> DISCOURSE_DB_NAME: discourse
./launcher rebuild app, and you should be good to go.