Capistrano 和 git checkout

发布于 2024-07-27 21:54:07 字数 4807 浏览 16 评论 0原文

当我进行 cap 部署(从 gi​​t 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

憧憬巴黎街头的黎明 2024-08-03 21:54:07

角色应该是这样的:

set :application, "deditest1.example.net"
set :domain, "deditest1.example.net"

role :app, application
role :web, application
role :db, application

The roles should look like this:

set :application, "deditest1.example.net"
set :domain, "deditest1.example.net"

role :app, application
role :web, application
role :db, application
老子叫无熙 2024-08-03 21:54:07

您已设置“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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文