Capistrano 和 git checkout
当我进行 cap 部署(从 git master 存储库中检出)时,我收到以下错误:
有人可以帮助我吗?
预先感谢
/var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:78:in `role_list_from': unknown role `app' (ArgumentError)
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:75:in `map'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:75:in `role_list_from'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:47:in `find_servers'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:10:in `find_servers_for_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/connections.rb:133:in `execute_on_servers'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:170:in `run_tree'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:143:in `run'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:208:in `sudo'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:89:in `send'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:89:in `invoke_command'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:123:in `try_sudo'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:136:in `try_runner'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `send'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `method_missing'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:302:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `send'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `method_missing'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:104:in `restart'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:154:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions_without_help'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:44:in `each'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:44:in `execute_requested_actions_without_help'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/help.rb:19:in `execute_requested_actions'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:33:in `execute!'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:14:in `execute'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/bin/cap:4
from /usr/bin/cap:19:in `load'
from /usr/bin/cap:19
Deploy.rb 文件内容:
set :deploy_to, "/home/edward/captest2"
set :application, "captest2"
role :web, "localhost"
default_run_options[:pty] = true
set :repository, "[email protected]:/usr/home/git"
set :scm, "git"
set :scm_passphrase, Proc.new { Capistrano::CLI.password_prompt("GIT Password for #{scm_user}:") } #This is your custom users password
set :user, "edward"
set :branch, "master"
ssh_options[:forward_agent] = true
I am getting the following error when I do a cap deploy, which checks out of a git master repository:
Could anyone please help me?
Thanks in advance
/var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:78:in `role_list_from': unknown role `app' (ArgumentError)
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:75:in `map'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:75:in `role_list_from'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:47:in `find_servers'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/servers.rb:10:in `find_servers_for_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/connections.rb:133:in `execute_on_servers'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:170:in `run_tree'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:143:in `run'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:208:in `sudo'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:89:in `send'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/actions/invocation.rb:89:in `invoke_command'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:123:in `try_sudo'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:136:in `try_runner'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `send'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `method_missing'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:302:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `send'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:186:in `method_missing'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/namespaces.rb:104:in `restart'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/recipes/deploy.rb:154:in `load'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `instance_eval'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:139:in `invoke_task_directly_without_callbacks'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions_without_help'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:44:in `each'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:44:in `execute_requested_actions_without_help'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/help.rb:19:in `execute_requested_actions'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:33:in `execute!'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/cli/execute.rb:14:in `execute'
from /var/lib/gems/1.8/gems/capistrano-2.5.8/bin/cap:4
from /usr/bin/cap:19:in `load'
from /usr/bin/cap:19
Deploy.rb file contents:
set :deploy_to, "/home/edward/captest2"
set :application, "captest2"
role :web, "localhost"
default_run_options[:pty] = true
set :repository, "[email protected]:/usr/home/git"
set :scm, "git"
set :scm_passphrase, Proc.new { Capistrano::CLI.password_prompt("GIT Password for #{scm_user}:") } #This is your custom users password
set :user, "edward"
set :branch, "master"
ssh_options[:forward_agent] = true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
角色应该是这样的:
The roles should look like this:
您已设置“app”角色,但没有设置“db”或“web”。 如果一切都在本地主机上,请改用:server "localhost", :app, :web, :db, :primary => 真的
You've set an "app" role, but no "db" or "web". If everything is on localhost, use this instead: server "localhost", :app, :web, :db, :primary => true