2013-10-20 42 views
3

我試圖首次使用橡皮部署到我的AWS EC2。爲了測試我現在只使用t1.micro。向AWS部署rails應用程序 - 無:NilClass錯誤

我與橡膠一個奇怪的錯誤TCAP橡膠後已經編輯rubber.yml後:create_staging

這是消息:

/Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/environment.rb:1:in `expand_string': undefined method `known_roles' for nil:NilClass (NoMethodError) 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/environment.rb:168:in `eval' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/environment.rb:168:in `expand_string' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/environment.rb:180:in `expand' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/environment.rb:146:in `[]' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/environment.rb:230:in `method_missing' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/rubber-2.5.5/lib/rubber/recipes/rubber/utils.rb:22:in `block (2 levels) in load' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:89:in `execute_task' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `each' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:34:in `execute!' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/bin/cap:23:in `load' 
    from /Users/mgreschke/Dropbox/medisupply/vendor/bundle/bin/cap:23:in `<main>' 

任何想法,尋找一個錯誤?這似乎是一個簡單的問題給我,但我真的沒有一個線索在哪裏看..

最佳, 中號

+0

在您的整個應用程序中尋找關鍵字「known_roles」(可能位於您的'environment.rb'中)調用此方法的對象返回爲零。如果您可以發佈更多關於調用哪個對象的詳細信息,它將對調試更有幫助。 –

+2

你已經解決了這個問題嗎?發佈解決方案會很有幫助。 –

+0

謝爾蓋,你的帖子下面和鏈接幫助解決問題。謝謝! – mgreschke

回答

3

只是刪除rubber_env。

staging_roles: "#{known_roles.reject {|r| r =~ /slave/ || r =~ /^db$/ }.join(',')}" 
# instead of 
staging_roles: "#{rubber_env.known_roles.reject {|r| r =~ /slave/ || r =~ /^db$/ }.join(',')}" 

有這種簡單的解決https://github.com/rubber/rubber/pull/406/files

+0

謝謝謝爾蓋。這解決了解決爲'complete_unicorn_nginx_postgresql'模板創建的應用程序的問題 –