2018-09-11 09:07:01.912 UTC [910] FATAL: role "postgres" does not exist
which is an odd one, since by default postgres user & db should be set up.
connecting to the db as user root fixes it, but I don’t think introducing breaking changes like this to the images is a good practice. I know that the tag 10 is rolling, but I wouldn’t expect such breaking changes.
When there need to be breaking changes, please announce them. Maybe under different tags.
Hopefully someone else will find this solution helpful.
How are you starting this container? I believe there are subkeys to specify a username, and I wonder if you could use this to specify a user you wish to connect through.
Having a similar issue, but connecting as root did not solve the issue. Taking a look at the logs between yesterday’s and today’s environments, there is a difference in the “Container circleci/postgres:9.5” step.
Yesterday:
...
waiting for server to start....LOG: database system was shut down at 2018-09-10 11:56:48 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: autovacuum launcher started
LOG: database system is ready to accept connections
done
server started
CREATE DATABASE
CREATE ROLE
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
...
and today:
...
waiting for server to start....LOG: database system was shut down at 2018-09-11 09:07:42 UTC
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
...
Clearly, the part of this step that is creating the role has been changed or omitted.
We automatically build images as they’re pushed from upstream, so the following change to the postgres image, where the username ‘postgres’ was being hardcoded:
Username is now populated with the value of POSTGRES_USER, which we set in the CircleCI dockerfile as root:
ENV POSTGRES_USER=root \
POSTGRES_DB=circle_test
For now, connecting as the user root should solve the issue, or defining any other username using POSTGRES_USER.
The exact changes to the postgres image can be viewed in this github diff. No changes have been made to the CircleCI dockerfile. Apologies for any inconvenience caused, but sometimes upstream changes do cause issues we can’t predict due to how we currently handle building convenience images.
The change is not in line with their (upstream Docker) docs:
POSTGRES_USER
This optional environment variable is used in conjunction with POSTGRES_PASSWORD to set a user and its password. This variable will create the specified user with superuser power and a database with the same name. If it is not specified, then the default user of postgres will be used.
I should mention that this is the 9.5 image, but if that’s the only difference, can you think of another reason why the build is failing? Thank you for responding so promptly.
Sorry @ShaunGillies, was replying to @anzecesar – do you have any postgres config in his django settings, and if so could you update this as well? To use root for username and circle_test for the db, although I also can’t see a reason there shouldn’t be a postgres database for django to connect to.
You could still set it to postgres by defining the environment variable POSTGRES_USER = postgres, but the dockerfile I linked sets it to root. The environment variable wasn’t previously respected – it was set to postgres regardless. Now it is respected, so it’s set to root.