I’m looking into moving my team from Jenkins to Drone. We have a Postgres RDS instance with a few DBs that we use for our internal tools and utilities. I created a new db and role for Drone on this RDS instance. From the ec2 instance where I’m setting up the drone server, and using the same connection string as what I’ve put in the drone config, I can connect to my drone db via psql, but when I try to spin up the drone server, I get the following:
pq: Could not detect default username. Please provide one explicitly.
Any idea what’s up here? Again, I’ve confirmed that it’s not a networking issue or a connection string formatting issue, as the db is reachable via psql.
I would start with your connection string. Are you missing a database username or is there any other configuration parameters you need to add? You can learn more about the postgres connection string here:
You might also have luck posting this error message to Stackoverflow and tagging with Postgresql (https://stackoverflow.com/questions/tagged/postgresql) since this is likely Postgres-specific. There is no database code in Drone per-se, we just pass the connection string unmodified to official Postgres driver.
Basically, in the container’s environment, pq wasn’t able to determine a user. For anyone else stumbling across this: the fix was to pass “USER” as an environment variable from the docker-compose.yml file. I.e.: