3

I'm trying to configure CI on Gitlab CI and get this error

$ rake db:create
/usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/usr/local/bundle/gems/activesupport-5.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "username"=>"runner", "database"=>"ems"}
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
4
  • Is your postgres service running ? you can start it by sudo service postgresql start . Commented Feb 14, 2017 at 10:44
  • Got this one on sudo service postgresql start ERROR: Build failed: exit code 1 Commented Feb 14, 2017 at 10:53
  • Do show your .gitlab-ci.yml Commented Feb 14, 2017 at 11:55
  • ``` image: ruby:2.4 services: - postgres - redis before_script: - sudo service postgresql start - cp config/database.yml.gitlabci config/database.yml - bundle install - RAILS_ENV=test rake db:create - RAILS_ENV=test rake db:migrate tests: script: 'bundle exec rspec' styleguide: script: 'bundle exec rubocop' variables: POSTGRES_DB: dbdb POSTGRES_USER: runner POSTGRES_PASSWORD: "" ``` Commented Feb 14, 2017 at 12:31

1 Answer 1

2

A service defined in .gitlab-ci.yml is a seperate docker instance not a local service. You need to update your db configuration to point to a host named postgres

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.