Coder Social home page Coder Social logo

circleci-public / circleci-demo-ruby-rails Goto Github PK

View Code? Open in Web Editor NEW
79.0 16.0 292.0 109 KB

A CircleCI demo project using Ruby and Rails

Home Page: https://circleci.com/gh/CircleCI-Public/circleci-demo-ruby-rails

License: MIT License

Ruby 78.49% JavaScript 2.08% CoffeeScript 0.76% CSS 1.27% HTML 13.60% Dockerfile 0.82% Shell 0.36% SCSS 2.62%
circleci-demos circleci ruby rails

circleci-demo-ruby-rails's Introduction

CircleCI Demo Application: Ruby on Rails CircleCI

This is an example application showcasing how to run a Ruby on Rails app on CircleCI 2.0 using 2.1 configuration.

You can follow along with this project by reading the documentation.

Local Development

set environment

  1. Create your app.env file from the example file: cp .env.app.testing app.env
POSTGRES_HOST=db
PGUSER=postgres
PGPASSWORD=postgres
RAILS_ENV=development
  1. Create your db.env file from the example file: cp .env.db.testing db.env
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=rails_blog_dev

Starting the application

$ docker-compose build
$ docker-compose up
$ docker-compose run web bundle exec rails db:migrate:reset

reset the database

$ docker-compose up db
$ docker-compose run web bundle exec rails db:migrate:reset

Navigate to http://localhost:3000

License

Copyright (c) 2019 CircleCI

Distributed under the MIT License. See the file COPYING.

circleci-demo-ruby-rails's People

Contributors

bytesguy avatar dependabot[bot] avatar drazisil avatar dsayling avatar ganezasan avatar jabsci avatar jasonsouza avatar jkzilla avatar kyletryon avatar lanzhiheng avatar michelle-luna avatar nbialostosky avatar smart-alek avatar sphericalham avatar tadashi0713 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circleci-demo-ruby-rails's Issues

Can't run this demo in local CLI

I'm trying to run this demo so that I can test my Circle CI configurations for RoR. However, it fails locally :c

This is my console output:

felix@felix-X550LD ~/D/C/P/t/ruby-circle-demo> circleci local execute
Docker image digest: sha256:3d88cfffd448da07ff8ced22ccdca5adc09ff18e87dc7db9b8af5b8a47647c08
====>> Spin up Environment
Build-agent version 0.1.750-336e0196 (2018-09-13T19:48:06+0000)
Starting container circleci/ruby:2.4.2-jessie-node
  using image circleci/ruby@sha256:61e67a20f4411e80456599db160a0df736f70d539e372d06f2e24ccc90366703
Starting container circleci/postgres:9.5-alpine
  using image circleci/postgres@sha256:0c96b87bb23280c93c76e6b483cd4fb37495b67785a2600dcf704c7f0063559a
====>> Container circleci/postgres:9.5-alpine
Service containers logs streaming is disabled for local builds
You can manually monitor container 72bb4440e69914feec3682031c37d3393723e0e452f4dbad77b990b4ef637214
====>> Checkout code
  #!/bin/bash -eo pipefail
mkdir -p /home/circleci/project && cp -r /tmp/_circleci_local_build_repo/. /home/circleci/project
====>> Which bundler?
  #!/bin/bash -eo pipefail
bundle -v
Bundler version 1.16.0
====>> Restoring Cache
Error: 
Skipping cache - error checking storage: not supported


Step failed
====>> Bundle Install
  #!/bin/bash -eo pipefail
bundle check || bundle install
The following gems are missing
 * rake (12.2.1)
 * concurrent-ruby (1.0.5)
 * i18n (0.9.1)
 * minitest (5.10.3)
 * thread_safe (0.3.6)
 * tzinfo (1.2.4)
 * activesupport (5.1.4)
 * builder (3.2.3)
 * erubi (1.7.0)
 * mini_portile2 (2.3.0)
 * nokogiri (1.8.1)
 * rails-dom-testing (2.0.3)
 * crass (1.0.2)
 * loofah (2.1.1)
 * rails-html-sanitizer (1.0.3)
 * actionview (5.1.4)
 * rack (2.0.3)
 * rack-test (0.7.0)
 * actionpack (5.1.4)
 * nio4r (2.1.0)
 * websocket-extensions (0.1.2)
 * websocket-driver (0.6.5)
 * actioncable (5.1.4)
 * globalid (0.4.1)
 * activejob (5.1.4)
 * mini_mime (1.0.0)
 * mail (2.7.0)
 * actionmailer (5.1.4)
 * activemodel (5.1.4)
 * arel (8.0.0)
 * activerecord (5.1.4)
 * public_suffix (3.0.1)
 * addressable (2.5.2)
 * bindex (0.5.0)
 * byebug (9.1.0)
 * mime-types-data (3.2016.0521)
 * mime-types (3.1)
 * xpath (2.1.0)
 * capybara (2.13.0)
 * ffi (1.9.18)
 * childprocess (0.8.0)
 * coffee-script-source (1.12.2)
 * execjs (2.7.0)
 * coffee-script (2.4.1)
 * method_source (0.9.0)
 * thor (0.20.0)
 * railties (5.1.4)
 * coffee-rails (4.2.2)
 * diff-lcs (1.3)
 * multi_json (1.12.2)
 * jbuilder (2.7.0)
 * rb-fsevent (0.10.2)
 * rb-inotify (0.9.10)
 * ruby_dep (1.5.0)
 * listen (3.1.5)
 * pg (0.21.0)
 * puma (3.10.0)
 * sprockets (3.7.1)
 * sprockets-rails (3.2.1)
 * rails (5.1.4)
 * rspec-support (3.7.0)
 * rspec-core (3.7.0)
 * rspec-expectations (3.7.0)
 * rspec-mocks (3.7.0)
 * rspec-rails (3.7.1)
 * rspec_junit_formatter (0.3.0)
 * rubyzip (1.2.1)
 * sass-listen (4.0.0)
 * sass (3.5.3)
 * tilt (2.0.8)
 * sass-rails (5.0.6)
 * selenium-webdriver (3.7.0)
 * spring (2.0.2)
 * spring-watcher-listen (2.0.1)
 * turbolinks-source (5.0.3)
 * turbolinks (5.0.1)
 * uglifier (3.2.0)
 * web-console (3.5.1)
Install missing gems with `bundle install`
Fetching gem metadata from https://rubygems.org/...........
Fetching rake 12.2.1
Fetching concurrent-ruby 1.0.5
Installing rake 12.2.1
Installing concurrent-ruby 1.0.5
Fetching minitest 5.10.3
Fetching thread_safe 0.3.6
Installing minitest 5.10.3
Installing thread_safe 0.3.6
Fetching builder 3.2.3
Fetching erubi 1.7.0
Installing erubi 1.7.0
Installing builder 3.2.3
Fetching mini_portile2 2.3.0
Fetching crass 1.0.2
Installing mini_portile2 2.3.0
Fetching rack 2.0.3
Installing crass 1.0.2
Installing rack 2.0.3
Fetching nio4r 2.1.0
Fetching websocket-extensions 0.1.2
Installing nio4r 2.1.0 with native extensions
Installing websocket-extensions 0.1.2
Fetching mini_mime 1.0.0
Fetching arel 8.0.0
Installing mini_mime 1.0.0
Fetching public_suffix 3.0.1
Installing arel 8.0.0
Fetching bindex 0.5.0
Installing public_suffix 3.0.1
Installing bindex 0.5.0 with native extensions
Using bundler 1.16.0
Fetching byebug 9.1.0
Fetching mime-types-data 3.2016.0521
Installing byebug 9.1.0 with native extensions
Installing mime-types-data 3.2016.0521
Fetching ffi 1.9.18
Fetching coffee-script-source 1.12.2
Installing coffee-script-source 1.12.2
Installing ffi 1.9.18 with native extensions
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching method_source 0.9.0
Fetching thor 0.20.0
Installing method_source 0.9.0
Fetching diff-lcs 1.3
Installing thor 0.20.0
Fetching multi_json 1.12.2
Installing diff-lcs 1.3
Fetching rb-fsevent 0.10.2
Installing multi_json 1.12.2
Fetching ruby_dep 1.5.0
Installing rb-fsevent 0.10.2
Fetching pg 0.21.0
Installing ruby_dep 1.5.0
Fetching puma 3.10.0
Installing pg 0.21.0 with native extensions
Installing puma 3.10.0 with native extensions
Fetching rspec-support 3.7.0
Fetching rubyzip 1.2.1
Installing rspec-support 3.7.0
Fetching tilt 2.0.8
Installing rubyzip 1.2.1
Fetching turbolinks-source 5.0.3
Installing tilt 2.0.8
Installing turbolinks-source 5.0.3
Fetching i18n 0.9.1
Fetching tzinfo 1.2.4
Installing i18n 0.9.1
Installing tzinfo 1.2.4
Fetching nokogiri 1.8.1
Fetching rack-test 0.7.0
Installing rack-test 0.7.0
Fetching sprockets 3.7.1
Installing sprockets 3.7.1
Fetching websocket-driver 0.6.5
Installing websocket-driver 0.6.5 with native extensions
Installing nokogiri 1.8.1 with native extensions
Fetching mail 2.7.0
Installing mail 2.7.0
Fetching addressable 2.5.2
Fetching mime-types 3.1
Installing mime-types 3.1
Installing addressable 2.5.2
Fetching coffee-script 2.4.1
Fetching uglifier 3.2.0
Installing coffee-script 2.4.1
Fetching childprocess 0.8.0
Installing uglifier 3.2.0
Installing childprocess 0.8.0
Fetching rb-inotify 0.9.10
Fetching rspec-core 3.7.0
Installing rb-inotify 0.9.10
Fetching rspec-expectations 3.7.0
Installing rspec-core 3.7.0
Fetching rspec-mocks 3.7.0
Installing rspec-expectations 3.7.0
Fetching turbolinks 5.0.1
Installing rspec-mocks 3.7.0
Fetching activesupport 5.1.4
Installing turbolinks 5.0.1
Fetching loofah 2.1.1
Installing activesupport 5.1.4
Fetching xpath 2.1.0
Installing loofah 2.1.1
Fetching selenium-webdriver 3.7.0
Installing xpath 2.1.0
Fetching listen 3.1.5
Installing listen 3.1.5
Fetching sass-listen 4.0.0
Installing selenium-webdriver 3.7.0
Fetching rspec_junit_formatter 0.3.0
Installing sass-listen 4.0.0
Fetching rails-dom-testing 2.0.3
Installing rspec_junit_formatter 0.3.0
Fetching globalid 0.4.1
Installing rails-dom-testing 2.0.3
Fetching activemodel 5.1.4
Installing globalid 0.4.1
Fetching jbuilder 2.7.0
Installing activemodel 5.1.4
Installing jbuilder 2.7.0
Fetching spring 2.0.2
Fetching rails-html-sanitizer 1.0.3
Installing spring 2.0.2
Fetching capybara 2.13.0
Installing rails-html-sanitizer 1.0.3
Fetching sass 3.5.3
Installing capybara 2.13.0
Fetching activejob 5.1.4
Installing sass 3.5.3
Fetching activerecord 5.1.4
Installing activejob 5.1.4
Fetching spring-watcher-listen 2.0.1
Installing spring-watcher-listen 2.0.1
Fetching actionview 5.1.4
Installing activerecord 5.1.4
Installing actionview 5.1.4
Fetching actionpack 5.1.4
Installing actionpack 5.1.4
Fetching actioncable 5.1.4
Fetching actionmailer 5.1.4
Installing actionmailer 5.1.4
Installing actioncable 5.1.4
Fetching railties 5.1.4
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Installing railties 5.1.4
Fetching coffee-rails 4.2.2
Fetching rails 5.1.4
Installing rails 5.1.4
Installing coffee-rails 4.2.2
Fetching rspec-rails 3.7.1
Fetching sass-rails 5.0.6
Installing rspec-rails 3.7.1
Fetching web-console 3.5.1
Installing sass-rails 5.0.6
Installing web-console 3.5.1
Bundle complete! 18 Gemfile dependencies, 79 gems now installed.
Bundled gems are installed into `./vendor/bundle`
====>> Saving Cache
Error: 
Skipping cache - error checking storage: not supported

Step failed
====>> Restoring Cache
Error: 
Skipping cache - error checking storage: not supported


Step failed
====>> Yarn Install
  #!/bin/bash -eo pipefail
yarn install --cache-folder ~/.cache/yarn
yarn install v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 1.04s.
====>> Saving Cache
Error: 
Skipping cache - error checking storage: not supported

Step failed
====>> Wait for DB
  #!/bin/bash -eo pipefail
dockerize -wait tcp://localhost:5432 -timeout 1m
2018/09/21 22:06:27 Waiting for: tcp://localhost:5432
2018/09/21 22:06:27 Connected to tcp://localhost:5432
====>> Database setup
  #!/bin/bash -eo pipefail
bin/rails db:schema:load --trace
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke db:check_protected_environments (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:check_protected_environments
** Execute db:schema:load
-- enable_extension("plpgsql")
rails aborted!
ActiveRecord::NoDatabaseError: FATAL:  role "postgres" does not exist
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:699:in `rescue in connect'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:832:in `connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:839:in `block in method_missing'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `block in say_with_time'
/usr/local/lib/ruby/2.4.0/benchmark.rb:293:in `measure'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `say_with_time'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:838:in `method_missing'
/home/circleci/project/db/schema.rb:16:in `block in <top (required)>'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/schema.rb:48:in `instance_eval'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/schema.rb:48:in `define'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/schema.rb:44:in `define'
/home/circleci/project/db/schema.rb:13:in `<top (required)>'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:233:in `load_schema'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:255:in `block in load_schema_current'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:304:in `block in each_current_configuration'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:303:in `each'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:303:in `each_current_configuration'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:254:in `load_schema_current'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:248:in `block (3 levels) in <top (required)>'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:251:in `block in execute'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:251:in `each'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:251:in `execute'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:188:in `invoke_with_call_chain'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:181:in `invoke'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:160:in `invoke_task'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:116:in `each'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:116:in `block in top_level'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:125:in `run_with_threads'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:110:in `top_level'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:186:in `standard_exception_handling'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
/home/circleci/project/bin/rails:9:in `require'
/home/circleci/project/bin/rails:9:in `<top (required)>'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:70:in `require'
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:70:in `require'
/home/circleci/project/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
PG::ConnectionBad: FATAL:  role "postgres" does not exist
/home/circleci/project/vendor/bundle/gems/pg-0.21.0/lib/pg.rb:56:in `initialize'
/home/circleci/project/vendor/bundle/gems/pg-0.21.0/lib/pg.rb:56:in `new'
/home/circleci/project/vendor/bundle/gems/pg-0.21.0/lib/pg.rb:56:in `connect'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:695:in `connect'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:220:in `initialize'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:88:in `connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:832:in `connection'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:839:in `block in method_missing'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `block in say_with_time'
/usr/local/lib/ruby/2.4.0/benchmark.rb:293:in `measure'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `say_with_time'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/migration.rb:838:in `method_missing'
/home/circleci/project/db/schema.rb:16:in `block in <top (required)>'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/schema.rb:48:in `instance_eval'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/schema.rb:48:in `define'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/schema.rb:44:in `define'
/home/circleci/project/db/schema.rb:13:in `<top (required)>'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/home/circleci/project/vendor/bundle/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:233:in `load_schema'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:255:in `block in load_schema_current'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:304:in `block in each_current_configuration'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:303:in `each'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:303:in `each_current_configuration'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:254:in `load_schema_current'
/home/circleci/project/vendor/bundle/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:248:in `block (3 levels) in <top (required)>'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:251:in `block in execute'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:251:in `each'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:251:in `execute'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:188:in `invoke_with_call_chain'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/task.rb:181:in `invoke'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:160:in `invoke_task'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:116:in `each'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:116:in `block in top_level'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:125:in `run_with_threads'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:110:in `top_level'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/home/circleci/project/vendor/bundle/gems/rake-12.2.1/lib/rake/application.rb:186:in `standard_exception_handling'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke'
/home/circleci/project/vendor/bundle/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
/home/circleci/project/bin/rails:9:in `require'
/home/circleci/project/bin/rails:9:in `<top (required)>'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/home/circleci/project/vendor/bundle/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:70:in `require'
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:70:in `require'
/home/circleci/project/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:schema:load
Error: Exited with code 1
Step failed
====>> Uploading test results
Error: Unable to save test results from /home/circleci/project/test_results
Error stat /home/circleci/project/test_results: no such file or directory

Error: Found no path with test results, skipping
Error: runner failed
Task failed

Do you know what's the problem?

Same database used in development and test

I can see how this makes setting up CI easier but, in development this configuration will overwrite the development database on every test run. This example is both counterintuitive and against good practice.

Doing a bundle exec rake db:setup confirms this:

$ bundle exec rake db:setup
Created database 'rails_blog'
Database 'rails_blog' already exists
-- enable_extension("plpgsql")
   -> 0.0291s
-- create_table("posts", {:force=>:cascade})
   -> 0.0118s
-- enable_extension("plpgsql")
   -> 0.0255s
-- create_table("posts", {:force=>:cascade})
   -> 0.1633s

Different database names should be used for each environment.

Running rspec in Circle CI

Hey guys, the sample .circleci config does not work for me. It always chokes on not being able to find bundle. All I'm trying to do is run rspec on .circle ci.

This is the config I have so far:

version: 2
jobs:
build:
parallelism: 3
docker:
- image: circleci/ruby:2.4.2-jessie-node
environment:
BUNDLE_JOBS: 3
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
TERRAFORM_VERSION: 0.10.8
PATH: "${PATH}:${HOME}/.bin"

  - image: circleci/postgres:9.6
    environment:
      POSTGRES_PASSWORD: abcd1234!!

  - image: "redis:3.2.6"

steps:
  - checkout

  # Which version of bundler?
  - run:
      name: Which bundler?
      command: bundle -v

  - run:
      name: Bundle Install
      command: bundle check || bundle install
  
  - run:
      name: Run rspec
      command: |
        bundle exec rspec
      environment:
        RAILS_ENV: test
        DB_HOST: postgres
        DB_NAME: phisher_test
        DB_USERNAME: postgres
        DB_PASSWORD: abcd1234!!
        REDIS_HOST: redis
        JWT_SECRET: dev
        COMPILER_ADDR: 10.12.0.22:5030
        ELASTICSEARCH_HOST: localhost

And this is the output where it fails:

Which bundler? (0)00:00
Exit code: 127
#!/bin/bash -eo pipefail
bundle -v
/bin/bash: bundle: command not found
Exited with code 127

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.