passwordless mastodon user in combination with default DB_HOST causes postgreSQL and websockets errors
Caveat: this error occurs on Ubuntu 20.04, it may be ok on 18.04 which is currently specified.
The Running Mastodon - Installing from source instructions specify to create a mastodon user without a password:
adduser --disabled-login mastodon
And the default database configuration defaults DB_HOST to "localhost".
PostreSQL doesn't like this, and throws PG::ConnectionBad fe_sendauth: no password supplied.
This can be resolved by setting a DB_HOST value of "" (i.e. an empty string). See this Digital Ocean forum explanation - apologies that I can't find a more "official" explanation. It seems however that an empty string uses a unix socket rather than an HTTP connection. I haven't tried it but possibly another fix might be to default to http://localhost.
I'm logging this as an issue rather than a pull request because it's possible the best fix for this is to change the default value – which obviously is not simply a documentation update – rather than updating the documentation to suggest overriding the default.
Additionally, it appears that the way the streaming API is configured, it expects the database user to have a password. I couldn't find any way around this, but using the current documentation for server setup results in a broken install with websockets not working.
This is fixable by simply giving the database user a password and restarting services, but it seems that whilst a passwordless server user is probably sensible for security reasons, that user still should have a postresql password to avoid broken installations.