mastodon icon indicating copy to clipboard operation
mastodon copied to clipboard

Streaming Service: enhanced support for external DB

Open alexsasharegan opened this issue 4 years ago • 6 comments

tl;dr;

  • Support sslmode=require in pg connection uri
  • Support ssl config without requiring use of DATABASE_URL

Pitch

I just finished setting up my instance on digitalocean (DO) using the managed postgres cluster and their spaces object storage. It appears DO supplies you with a convenient connection uri copy that uses the sslmode=require form rather than ssl=true. This appears to be convention going forward given that it appears in PG docs v10 & v11

For improved compatibility with JDBC connection URIs, instances of parameter ssl=true are translated into sslmode=require.

The code currently ignores sslmode=require, which leads to some confusing debugging to the less initiated. Perhaps this code should move to using this standard while maintaining compat with ssl=true: https://github.com/tootsuite/mastodon/blob/master/streaming/index.js#L48

Also, there may be a need for another env param to enable ssl mode. I have to use the DATABASE_URL to successfully inject the ssl conf, and this is not part of the canonical install instructions path.

Motivation

I think the instructions are pretty awesome, but there's some room for improvement when incorporating managed services for DB and file hosting (also had a little spelunking to do for that). The snags are minor in the code, but cost me several hours.

alexsasharegan avatar Jul 29 '19 17:07 alexsasharegan