Search code examples
ruby-on-railsdb2rakeibm-clouddashdb

Rake / adapter error during Rails 5 app deploy on Bluemix


I'm trying to deploy Rails 5 app with DashDB service on IBM Bluemix platform. According to the logs everything seems to be working fine during the deployment stage until rake command is being triggered:

...
OUT    Starting app instance (index 0) with guid 88517c00-d623-43f3-b44b-01e140cba4f6
ERR    rake aborted!
ERR    ArgumentError: wrong number of arguments (given 5, expected 3..4)
ERR    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:283:in `create_table_definition'
...

My manifest.yml looks following:

applications:
- path: .
  buildpack: https://github.com/cloudfoundry/ruby-buildpack.git
  command: rake db:migrate && bin/rails server -p $PORT -e $RAILS_ENV
  memory: 1024M
  instances: 1
  domain: eu-gb.mybluemix.net
  name: windykacja
  host: windykacja
  disk_quota: 1024M
  services:
  - dashDB-win

Here is my gemfile:

source 'https://rubygems.org'
ruby '2.3.0'

gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem "cf-autoconfig", "~> 0.2.1"
gem 'puma', '~> 3.0'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'rack'
gem 'devise'

group :production do
    gem 'rails_12factor'
    gem 'ibm_db'
end

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'sqlite3'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

..and one last bit of details, database.yml (but I'm not really sure whether it's even being used now):

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

test:
  pool: 5
  timeout: 5000
  adapter: ibm_db
  database: BLUDB

production:
  pool: 5
  timeout: 5000
  adapter: ibm_db
  database: BLUDB
  user: dash105844
  password: <%= ENV['DB_PASS'] %>

Currently I have only one Environment Variable set up and it's DB_PASS of course. I'm not really sure whether I need more of them (like DATABASE_URL.. which didn't help) - I would appreciate any help from someone experienced with using rails and DashDB / DB2 on Bluemix. I'm fighting with this since few hours and I run out of ideas. Cheers!

EDIT

I've tried to deploy with Rails 4.2.5 and Ruby 2.3.0 but it didn't work either.

source 'https://rubygems.org'
ruby '2.3.0'

gem 'rails', '4.2.5'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :production do
    gem 'rails_12factor'
    gem 'ibm_db'
end

group :development, :test do
  gem 'byebug'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
  gem 'sqlite3'
end

manifest.yml:

applications:
- path: .
  buildpack: https://github.com/cloudfoundry/ruby-buildpack.git
  command: rake db:migrate && bin/rails server -p $PORT -e $RAILS_ENV
  memory: 1024M
  instances: 1
  domain: eu-gb.mybluemix.net
  name: windykacja
  host: windykacja
  disk_quota: 1024M
  services:
  - dashDB-win

errors from the log (please note that IBM messed up and you need to read the logs from the bottom now):

DEA/200Instance (index 0) failed to start accepting connections2016-10-23T12:53:48.857+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:557:in `add_index'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/schema_migration.rb:32:in `create_table'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:925:in `initialize'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:822:in `initialize_schema_migrations_table'2016-10-23T12:53:48.715+0200
App/0    Tasks: TOP => db:migrate2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `new'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'2016-10-23T12:53:48.715+0200
App/0    (See full trace by running task with --trace)2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:1250:in `execute'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'2016-10-23T12:53:48.715+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:2281:in `execute'2016-10-23T12:53:48.714+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:1251:in `block in execute'2016-10-23T12:53:48.714+0200
App/0    ActiveRecord::StatementInvalid: [IBM][CLI Driver][DB2/LINUXX8664] SQL1667N The operation failed because the operation is not supported with the type of the specified table. Specified table: "DASH105844.SCHEMA_MIGRATIONS". Table type: "ORGANIZE BY COLUMN". Operation: "CREATE INDEX". SQLSTATE=42858 SQLCODE=-16672016-10-23T12:53:48.713+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:1250:in `execute'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:925:in `initialize'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:1251:in `block in execute'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:2285:in `rescue in execute'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/schema_migration.rb:32:in `create_table'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `new'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:822:in `initialize_schema_migrations_table'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:2277:in `execute'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:557:in `add_index'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'2016-10-23T12:53:48.711+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'2016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'2016-10-23T12:53:48.710+0200
App/0    Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL1667N The operation failed because the operation is not supported with the type of the specified table. Specified table: "DASH105844.SCHEMA_MIGRATIONS". Table type: "ORGANIZE BY COLUMN". Operation: "CREATE INDEX". SQLSTATE=42858 SQLCODE=-16672016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'2016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `new'2016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'2016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:925:in `initialize'2016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:822:in `initialize_schema_migrations_table'2016-10-23T12:53:48.710+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:2277:in `execute'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:1251:in `block in execute'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/schema_migration.rb:32:in `create_table'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:557:in `add_index'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:2285:in `rescue in execute'2016-10-23T12:53:48.709+0200
App/0    ActiveRecord::StatementInvalid: RuntimeError: Failed to execute statement due to: [IBM][CLI Driver][DB2/LINUXX8664] SQL1667N The operation failed because the operation is not supported with the type of the specified table. Specified table: "DASH105844.SCHEMA_MIGRATIONS". Table type: "ORGANIZE BY COLUMN". Operation: "CREATE INDEX". SQLSTATE=42858 SQLCODE=-1667: CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations (version)2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'2016-10-23T12:53:48.709+0200
App/0    /home/vcap/app/vendor/bundle/ruby/2.3.0/gems/ibm_db-3.0.4/lib/active_record/connection_adapters/ibm_db_adapter.rb:1250:in `execute'2016-10-23T12:53:48.709+0200
App/0    rake aborted!2016-10-23T12:53:48.708+0200
App/0     [1m[35m (13.8ms)[0m CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations (version)2016-10-23T12:53:48.706+0200
App/0     [1m[36m (363.7ms)[0m [1mCREATE TABLE schema_migrations (version varchar(255) NOT NULL) [0m2016-10-23T12:53:48.457+0200
DEA/200  Starting app instance (index 0) with guid 8b29e93c-2560-4396-8fb0-354041aa69d52016-10-23T12:53:33.764+0200

Solution

  • The ibm_db Rails Adapater does not yet support Rails 5.