使用橡胶部署rails应用到AWS - nil:NilClass错误

时间:2022-07-30 20:40:43

I'm trying to use rubber to deploy to my AWS EC2 for the first time. For testing im just using a t1.micro right now.

我第一次尝试使用rubber部署到AWS EC2上。测试im时,只使用t1。现在微。

I get a weird error with rubber after having edited rubber.yml after tcap rubber:create_staging

在编辑了橡胶之后,我发现了一个奇怪的错误。yml后tcap橡胶:create_staging

This is the message:

这是信息:

/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>'

Any idea where to look for an error? It seems like a simple problem to me but I dont really have a clue where to look..

知道在哪里查找错误吗?这对我来说似乎是个简单的问题,但我真的不知道该往哪儿看。

Best, M

最好的,米

1 个解决方案

#1


3  

Just remove rubber_env.

只是删除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(',')}"

There is this simple fix https://github.com/rubber/rubber/pull/406/files.

这里有一个简单的修复https://github.com/rubber/rubber/pull/406/files。

#1


3  

Just remove rubber_env.

只是删除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(',')}"

There is this simple fix https://github.com/rubber/rubber/pull/406/files.

这里有一个简单的修复https://github.com/rubber/rubber/pull/406/files。