CircleCI Postgres Image suddenly causing problems? "role postgres not found"

Update: To conform with upstream, we’ve removed our default root role/user so that the postgres role/user is automatically created. See this. The TL;DR is if you were using root as your user, either create it via config or use postgres as the user.


Hey everyone,

Here’s what’s going on and what caused it.

The Problem

Most of the CircleCI Docker Convenience Images are small CI tweaks we apply to the upstream Docker Library images. So the circleci/postgres image is based on the postgres image.

4 days ago the upstream maintainers made a small tweak to the image so that the postgres role/user is only created when the POSTGRES_USER is not set. So of course, we set it to root. This has caused circleci/postgres images built within the last few days to no longer have the postgres role.

The Solution

There’s 3 quick solutions:

  1. There’s already a root PostgreSQL role/user in the image. You can change your DB creds to use that instead of postgres.
  2. Set the POSTGRES_USER environment variable in your CircleCI config to postgres and you’ll get the role back in the image as it was before. This would be done something like this:
          - image: circleci/postgres:9.6-alpine
            environment:
              POSTGRES_USER: postgres
    
  3. Use the upstream image directly (e.g. postgres:9.6). Keep in mind certain utilities that CircleCI features need might not be installed.
5 Likes

Thank you very much for the detailed information here, we were actually in the middle of writing up the issue as a ticket. We’ve been able to fix all affected circleci configurations with Option 2 above, and everything is now functioning as expected.

2 Likes

Glad to hear that! @tobypinder

We’re now publishing changes that should mitigate this issue, as well:

https://discuss.circleci.com/t/convenience-images-update-removing-hardcoded-postgres-user

2 Likes

@FelicianoTech I think the removal of the default root user warrants an update to the documentation on https://hub.docker.com/r/circleci/postgres/ - if you agree, please could you update?

That page still implies that the root user is created. If I understand correctly, that’s no longer true. In fact, the postgres user will get created by default (in the absence of the POSTGRES_USER env var).

I will go ahead and suggest some edits to the docs for this today. :slightly_smiling_face:

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.