Anvil-runtime with external Postgresql DB Connection Failed

Hello Anvil users,

I’m trying to use the self-hosted runtime with an external Postgresql database. The anvil-runtime will run in one docker container with the database living in a second container. The database is up and running and accessible via pgadmin4 and other database apps.

I’m unable to get the anvil-runtime to connect to the external database.

Connection to DB failed. Waiting 1s, then retrying migration...
DB connection failed for 10 seconds. Abandoning migration:
org.postgresql.util.PSQLException: FATAL: password authentication failed for user "anvil"
Database migration failed: connection-failed

This is the --database connection string that I’m passing in when launching the container:

"jdbc:postgresql://<Server IP Address>:5432/RealMTO?username=postgres&password=XXXX"

Any idea of what I’m missing? I’ve tried using the config.yaml vs specifying the database string on the cli–both give the same error. I’ve tried numerous permutations of the connection string itself. I’m NOT trying to use the “anvil” user to access the database–why is it failing with that error message?

Thank you for any help!


It seems to be using the user that is running the anvil-app-server command as the database username–totally ignoring the database connection string. Any thoughts as to what I am missing?

I finally figured this out–the connection string should specify the “user” not the “username”.

1 Like

oh my goodness. You just can not imagine how much effort i’ve put in to resolve this. But finally now see your comment here. thanks

1 Like