Add instructions how to setup the postgres user and clarify the final step #1756
Conversation
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
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. |
I rebased and enhanced the instructions. |
docs/postgres.rst
Outdated
|
||
su - postgres | ||
createuser synapse_user | ||
su - synapse_user |
There was a problem hiding this comment.
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?
docs/postgres.rst
Outdated
@@ -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 |
There was a problem hiding this comment.
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
.
docs/postgres.rst
Outdated
@@ -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:: |
There was a problem hiding this comment.
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
docs/postgres.rst
Outdated
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this 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
docs/postgres.rst
Outdated
@@ -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 |
There was a problem hiding this comment.
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
docs/postgres.rst
Outdated
|
||
su - postgres | ||
createuser --pwprompt synapse_user | ||
su - synapse_user |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is outdated
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
docs/postgres.rst
Outdated
|
||
su - postgres | ||
createuser --pwprompt synapse_user | ||
su - synapse_user |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is outdated
docs/postgres.rst
Outdated
|
||
./synctl stop | ||
cp homeserver.yaml homeserver-old-sqlite.yaml | ||
cp homeserver-postgres.yaml homeserver.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/cp/mv/
docs/postgres.rst
Outdated
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:: |
There was a problem hiding this comment.
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
…rify the final step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\o/
Signed-off-by: Ruben Barkow github@r.z11.de