I’m attempting to upgrade our Circle project to use 2.0 - following the docs I generated a first pass at a 2.0 file with the config-translation endpoint, and made a couple of slight changes to try and fit it to our project (Current file content is at the bottom of this post).
I’m having an issue around the database:
either a) I include a specific db image in the config.yml as below, ie including this section:
docker:
- image: circleci/ruby:2.3-jessie-node-browsers
- image: circleci/postgres:9.6-alpine-postgis
command: /sbin/init
and then I get the following error:
`init: must be run as PID 1
Exited with code 1`
(and I just realise this also gets the error in b, next)
or b) I comment out the line which as far as I understand from the docs isn’t strictly essential and when Circle runs the line bundle exec rake db:create db:schema:load --trace
,
I get a bunch of failure messages, the key part of which seems to be these lines:
`Couldn't create database for {"username"=>"ubuntu",
"database"=>"circle_ruby_test", "adapter"=>"postgresql",
"encoding"=>"unicode", "pool"=>5, "host"=>"localhost"}
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config
** Execute db:schema:load
-- enable_extension("plpgsql")
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Since Circle 1.0 is being discontinued, we obviously need to fix this asap. Any advice?
Thanks!,
Sasha
(new config.yml follows)
version: 2
jobs:
build:
working_directory: ~/FoundersPledge/founders-pledge
parallelism: 1
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
docker:
- image: circleci/ruby:2.3-jessie-node-browsers
- image: circleci/postgres:9.6-alpine-postgis
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- restore_cache:
keys:
- v1-dep-{{ .Branch }}-
- v1-dep-master-
- v1-dep-
- run: echo -e "export RAILS_ENV=test\nexport RACK_ENV=test" >> $BASH_ENV
- run: 'bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
--jobs=4 --retry=3 '
- run: curl -Ls https://install.convox.com/linux.zip > convox.zip
- run: sudo unzip convox.zip -d /usr/local/bin
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
paths:
- vendor/bundle
- ~/virtualenvs
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
- run: |-
mkdir -p config && echo 'test:
username: ubuntu
database: circle_ruby_test
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
' > config/database.yml
- run:
command: bundle exec rake db:create db:schema:load --trace
environment:
RAILS_ENV: test
RACK_ENV: test
- run: mkdir -p $CIRCLE_TEST_REPORTS/rspec
- run:
command: bundle exec rspec --color --require spec_helper --format RspecJunitFormatter --out $CIRCLE_TEST_REPORTS/rspec/rspec.xml --format progress spec
environment:
RAILS_ENV: test
RACK_ENV: test
- run: mkdir -p $CIRCLE_TEST_REPORTS/cucumber
- run:
command: 'bundle exec cucumber --format json --out $CIRCLE_TEST_REPORTS/cucumber/cucumber.cucumber '
environment:
RAILS_ENV: test
RACK_ENV: test
- run: bundle exec bin/circle
- store_test_results:
path: /tmp/circleci-test-results
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results