2015-11-20 127 views
2

當我嘗試將我的應用程序部署到Bluemix時,出現以下錯誤。我的manifest.yml文件如下。IBM_DB Gem問題

applications: 
- path: . 
    memory: 512M 
    instances: 1 
    domain: mybluemix.net 
    name: KnowYourBrand 
    host: kyb 
    command: bundle exec rake db:setup && bundle exec rails s -p $PORT 
    disk_quota: 1024M 
    services: 
    - Personality Insights-n2 
    - Tone Analyzer-uu 
    - Insights for Twitter-bt 
    - kybSQLDB 
    - AlchemyAPI-tw 
    buildpack: https://github.com/ibmdb/db2rubybuildpack 

2015-11-17T13:04:51.55-0600 [App/0] ERR LoadError: libdb2.so.1: cannot open shared object file: No such file or directory - /home/vcap/app/vendor/bundle/ru by/2.2.0/extensions/x86_64-linux/ 2.2.0-static/ibm_db-2.6.1/ibm_db.so

我的Gemfile如下:

source 'http://rubygems.org' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.1.8' 
gem 'backbone-on-rails' 

gem 'whenever', :require => false 

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

# Use SCSS for stylesheets 
gem 'sass-rails', '~> 4.0.3' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .js.coffee assets and views 
gem 'coffee-script-source', '1.8.0' 
gem 'coffee-rails', '~> 4.0.0' 
# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0',   group: :doc 

# Use ActiveModel has_secure_password 
gem 'bcrypt-ruby', '>= 3.1.2', :platform => :ruby 

gem 'httparty' 

gem 'figaro' 
gem "cf-autoconfig", "~> 0.2.1" 

# Use unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development do 
    gem 'byebug' 
    gem 'annotate' 
    gem 'better_errors' 
    gem 'binding_of_caller' 
    gem 'pry-rails' 
    # Use sqlite3 as the database for Active Record 
    gem 'sqlite3' 
end 

# Use debugger 
# gem 'debugger', group: [:development, :test] 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin] 

還有什麼問題呢?我試着將ibm_db版本設置爲較舊的版本,但這也未能解決問題。

Environment variable IBM_DB_HOME is not set. Set it to your DB2/IBM_Data_Server_ Driver installation directory and retry gem install.

無需在我的本地計算機上安裝驅動程序即可處理此問題的最佳方法是什麼?我只是試圖將其部署到Bluemix。

+0

?你的問題說mySQLDB,但你有其他地方列出的IBM DB2 ... –

+0

也可以請你的manifest.yml文件和gemfiles添加到你的問題? –

+0

嗨亞歷克斯 - 我已附上上述。我試圖擺脫ibm_db寶石和紅寶石buildpack,並會看到如何擺脫。 –

回答

0

您可以跟蹤IBM_DB混帳問題庫here

0

的IBM_DB寶石自動下載所需的文件在安裝寶石這個問題。但是,在Bluemix中安裝了ibm_db gem後,它無法鏈接下載的庫。

要解決此問題,請按照以下步驟操作。

步驟-1。在通過遷移推送應用程序的同時,傳遞一個命令來設置LD_LIBRARY_PATH環境變量,如下所示。

cf push BlogApp2 -c "export LD_LIBRARY_PATH=/home/vcap/app/vendor/bundle/ruby/2.2.0/gems/ibm_db-3.0.0/lib/clidriver/lib:$LD_LIBRARY_PATH; bundle exec rake db:migrate"

注意:運行上面commad雖然,請註明的Ruby版本和您在Gemfile中指定的ibm_db版本。您還可以引用您在Bluemix上的服務器日誌中看到的LoadError:libdb2.so錯誤消息中的路徑。 推送應用程序後,您將看到遷移已經運行,您也將看到預期的數據庫連接錯誤。

步驟-2。在您的應用程序中添加以下環境變量登錄到bluemix - >選擇你的Ruby應用程序 - >點擊Environment Variables manu - > Select User defined。 - >添加下面的變量 - >保存。

名稱 - LD_LIBRARY_PATH

價值 - /home/vcap/app/vendor/bundle/ruby/2.2.0/gems/ibm_db-3.0.0/lib/clidriver/lib:$LD_LIBRARY_PATH [請參閱步驟1的值]

在Bluemix中將LD_LIBRARY_PATH添加到應用程序後,可以按如下方式將應用程序從cf命令中推送出去。 cf push BlogApp2 -c「null」

現在您的應用程序將連接到SQLDB。

謝謝,您使用的是SQLDB服務或MySQL服務 阿文德