I am getting postgres error. Anything i can do for it? it seems that the postgres is not able to look for HOST
#!/bin/bash -eo pipefail
bundle exec rake db:create RAILS_ENV=test
rake aborted!
KeyError: key not found: “HOST”
version: 2
jobs:
build:
working_directory: ~/circleci-demo-ruby-rails
docker:
- image: circleci/ruby:2.3.3-node
environment:
PGHOST: 127.0.0.1
PGUSER: myapp-test
RAILS_ENV: test
- image: circleci/postgres:9.6.2-alpine
environment:
POSTGRES_USER: myapp
POSTGRES_DB: myapp-test
POSTGRES_PASSWORD: ""
steps:
- checkout
- restore_cache:
name: Restore bundle cache
keys:
- myapp-bundle-{{ checksum "Gemfile.lock" }}
- myapp-bundle-
- restore_cache:
name: Restore yarn cache
keys:
- myapp-yarn-{{ checksum "yarn.lock" }}
- myapp-yarn-
- run:
name: Bundle Install
command: bin/bundle check --path vendor/bundle || bin/bundle install --path vendor/bundle --jobs 4 --retry 3
- run:
name: Yarn Install
command: yarn install
- save_cache:
name: Store bundle cache
key: myapp-bundle-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- save_cache:
name: Store yarn cache
key: myapp-yarn-{{ checksum "yarn.lock" }}
paths:
- ~/.yarn-cache
- run:
name: Rubocop
command: bin/rubocop --rails
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Database setup
command: bin/rails db:schema:load --trace
- run:
name: Run tests
command: bin/rails test