Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Add instructions how to setup the postgres user and clarify the final step #1756

Merged
merged 1 commit into from May 17, 2018

Conversation

rubo77
Copy link
Contributor

@rubo77 rubo77 commented Jan 3, 2017

Signed-off-by: Ruben Barkow github@r.z11.de

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

2 similar comments
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@rubo77
Copy link
Contributor Author

rubo77 commented Jan 3, 2017

finding out, how to create the user and password for the postgresql database took us 2 hours to find out. so with this small hint, you help users that are not used to Postgresql a lot.

@rubo77 rubo77 changed the title Add instructions how to setup the postgres user Add instructions how to setup the postgres user and clarify the final step Jan 11, 2017
@rubo77
Copy link
Contributor Author

rubo77 commented May 8, 2018

I rebased and enhanced the instructions.


su - postgres
createuser synapse_user
su - synapse_user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work:

postgres@fred:/home/rav$ createuser synapse_user
postgres@fred:/home/rav$ su - synapse_user
No passwd entry for user 'synapse_user'

Why not just add --pwprompt to the createuser command?

@@ -6,6 +6,17 @@ Postgres version 9.4 or later is known to work.
Set up database
===============

Create a user ``synapse_user`` with::

su - postgres
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is installation-specific. Not all distributions will have a unix user called postgres.

@@ -46,8 +57,7 @@ As with Debian/Ubuntu, postgres support depends on the postgres python connector
Synapse config
==============

When you are ready to start using PostgreSQL, add the following line to your
config file::
When you are ready to start using PostgreSQL, edit the `database` section in your config file so they match the following lines::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please wrap at 80 chars

database configuration file ``homeserver-postgres.yaml`` (i.e. rename it to
``homeserver.yaml``) and restart synapse. Synapse should now be running against
PostgreSQL.
database configuration file ``homeserver-postgres.yaml`` (for an example
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should continue to tell people to rename it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why renaming a file, that you just created?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should it be called homeserver-postgres.yaml rather than just homeserver.yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought, the name is irrelevant. Just this instruction here should use only one name as example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the difficult part here is, that you have to create that file yourself with the example above. It is irrelevant how you name it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're telling people to call it homeserver-postgres.yaml.

And while we're here, the user should already have written the file, so pointing them to example content now is unhelpful.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to argue about this any more. Please either update the PR or close it.

@rubo77
Copy link
Contributor Author

rubo77 commented May 11, 2018

I didn't want to argue either. I just struggled to understand the meaning of the original wording.

I hope now it is clearer, what there is to do.

@@ -6,7 +6,19 @@ Postgres version 9.4 or later is known to work.
Set up database
===============

The PostgreSQL database used *must* have the correct encoding set, otherwise
Assuming your PostgreSQL database user is called ``postgres``, create a user
Copy link
Contributor Author

@rubo77 rubo77 May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is the most elegant solution to create the user, I have no system at the moment to try out a shorter solution.

feel free to edit this section if there is a shorter solution.

I just wanted to make sute, that this section is included in the istructions, cause it is essential to know for unexperienced users.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking better now, thanks! A few nits

@@ -46,8 +58,8 @@ As with Debian/Ubuntu, postgres support depends on the postgres python connector
Synapse config
==============

When you are ready to start using PostgreSQL, add the following line to your
config file::
When you are ready to start using PostgreSQL, edit the `database` section in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RST uses double-backticks for preformatted text


su - postgres
createuser --pwprompt synapse_user
su - synapse_user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit is now unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outdated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? it's still showing up in the diff at https://github.com/matrix-org/synapse/pull/1756/files

Copy link
Contributor Author

@rubo77 rubo77 May 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok,so I guess those 2 lines have to be removed too:

 su - synapse_user
 psql

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit (up to line 19) is now unnecessary: the pwprompt allows you to enter a password

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


su - postgres
createuser --pwprompt synapse_user
su - synapse_user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit (up to line 19) is now unnecessary: the pwprompt allows you to enter a password

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outdated


./synctl stop
cp homeserver.yaml homeserver-old-sqlite.yaml
cp homeserver-postgres.yaml homeserver.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/cp/mv/

When you are ready to start using PostgreSQL, add the following line to your
config file::
When you are ready to start using PostgreSQL, edit the `database` section in
your config file so they match the following lines::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"to match" sounds more natural than "so they match" here

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@richvdh richvdh merged commit ae53c71 into matrix-org:master May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants