I am trying to set up a rails app to run with postgres on circle 2.0. Sometimes the tests run successfully but other times they fail, with the error that the connection to the postgres database was refused. I believe that I’m experiencing the race-condition described here, so followed the recommended solution and added dockerize to prevent it:
version: 2 jobs: build: docker: # specify the version you desire here - image: circleci/ruby:2.4.1-node-browsers environment: - RAILS_ENV=test - DATABASE_URL=postgres://xxx@localhost:5432/yyy - image: circleci/postgres:9.6.2 environment: - POSTGRES_USER=xxx - POSTGRES_DB=yyy working_directory: ~/repo steps: - checkout # omitted steps ... - run: name: Wait for db command: | dockerize -wait tcp://localhost:5432 -timeout 1m # Database setup - run: name: Set up DB command: | bundle exec rake db:create db:schema:load --trace bundle exec rake db:migrate
This didn’t seem to have any effect and I’m still experiencing the error:
Can anyone help me figure out what’s going on here?