FATAL: role "ubuntu" does not exist


I’m trying to set up 2.0, with the circle.yml copied from the docs. I’ve enabled postgres-9.6 and am using dockerize to wait for it to boot, however when trying to bundle exec rails db:create I get:

#!/bin/bash -eo pipefail
bundle exec rake db:create
FATAL:  role "ubuntu" does not exist
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>"ubuntu", "password"=>"password", "database"=>"circle_test", "port"=>5432, "host"=>""}

My cricle.yml

# Ruby CircleCI 2.0 configuration file
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
version: 2
      # specify the version you desire here
       - image: circleci/ruby:2.4.1-node-browsers

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
       - image: circleci/postgres:9.6

    working_directory: ~/repo

      - checkout

      - run:
          name: Wait for db
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

      # Download and cache dependencies
      - restore_cache:
          - v1-dependencies-{{ checksum "Gemfile.lock" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            bundle install --jobs=4 --retry=3 --path vendor/bundle

      - save_cache:
            - ./vendor/bundle
          key: v1-dependencies-{{ checksum "Gemfile.lock" }}

      # Database setup
      - run: bundle exec rake db:create
      - run: bundle exec rake db:schema:load

      # run tests!
      - run:
          name: run tests
          command: |
            mkdir /tmp/test-results
            TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"

            bundle exec rspec --format progress \
                            --format RspecJunitFormatter \
                            --out /tmp/test-results/rspec.xml \
                            --format progress \

      # collect reports
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results
          destination: test-results

What am I missing here?

Getting CircleCICucumberFormatter::CircleCIJson error when upgrading Cucumber

If you take a look at the Docker Hub description for circleci/postgres you’ll see that the user is root and the password circleci_test.

I don’t remember if we still allow to override the user like the official Postgres image but if we do, you can use the POSTGRES_USER environment variable to set a different username such as ubuntu.


This was helpful, thanks. I was following the documentation here: https://circleci.com/docs/2.0/postgres-config/#postgresql-circleci-configuration-example which specifies other details.


I’ll open a GitHub Issue to get that corrected. Thanks.

Edit: https://github.com/circleci/circleci-docs/issues/1583


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