Locale and encoding
Mastodon requires these manual steps:
su - postgres psql postgres
ALTER USER mastodon CREATEDB; UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; DROP DATABASE template1; CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE'; UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; \c template1 VACUUM FREEZE;
Synapse requires:
su - postgres # Or, if your system uses sudo to get administrative rights sudo -u postgres bash
Then, create a postgres user and a database with:
# this will prompt for a password for the new user createuser --pwprompt synapse_user createdb --encoding=UTF8 --locale=C --template=template0 --owner=synapse_user synapse
The above will create a user called synapse_user, and a database called synapse.
Additional options from community.postgresql.postgresql_db module should be added to this role.