How to enable SSL for application DB?

I am setting my DB environment variables like so:

export MB_DB_TYPE=postgres
export MB_DB_DBNAME=metabase
export MB_DB_PORT=5432
export MB_DB_USER=
export MB_DB_PASS=
export MB_DB_HOST=localhost

Is there an env variable to enable SSL as well?

Apparently there is no MB_DB_SSL but a MB_DB_CONNECTION_URI, where you can give SSL as a parameter see:

and the syntax example in

I was a bit confused about the environment var name apparently the code claims as I stated above: https://github.com/metabase/metabase/blob/v0.28.5/src/metabase/db.clj#L63

When setting the MB_DB_CONNECTION_URI the application connects to H2 db.

Also if you simultaneously set MB_DB_TYPE: https://github.com/metabase/metabase/blob/v0.28.5/src/metabase/db.clj#L70 ??

edit: Here’s another user who got it working in December: Customizable connection string for application database setup (sslmode) (whole topic might be worth reading).

Also worth checking if your database needs some config: https://www.postgresql.org/message-id/51DB5D65.6040708%40gmail.com - can you connect to it using another client (from same place as Metabase, using SSL and does the database enforce it?)

I also had problems with ssl previously, but with the solution described in https://github.com/metabase/metabase/issues/6435 it now works fine.

1 Like