我正在关注instructions设置头号。现在我在第4步中设置生产服务器。这是我的配置文件:
# deploy.rb
set :application, "MyFirm"
set :deploy_to, "/var/www/myfirm.com"
set :domain, "dev.myfirm.com"
set :scm, :gitrepoit
set :repository, "ssh://myfirm@94.147.25.115:/home/myfirm/myfirm.git"
set :user, "ec2-user"
set :domain, "ec2-46-137-123-97.eu-west-1.compute.amazonaws.com"
ssh_options[:keys] = [File.join("foo.key")]
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :use_sudo, false
set :keep_releases, 3
但是当我执行cap deploy:setup
时,虽然我在配置文件中设置了公钥,但它要求我输入密码......
* executing `deploy:setup'
* executing "mkdir -p /var/www/myfirm.com /var/www/myfirm.com/
releases /var/www/myfirm.com/shared /var/www/myfirm.com/shared/app/
logs /var/www/myfirm.com/shared/web/uploads"
servers: ["ec2-46-137-123-97.eu-west-1.compute.amazonaws.com"]
Password:
有什么想法吗?
capifony 2.1.1
答案 0 :(得分:6)
嗯..我认为ssh_options[:keys]
中的路径是相对于配置文件(deploy.rb)的,但实际上是相对于cap文件(/var/lib/gems/1.8/bin/cap)。
这是有效的(在/var/lib/gems/1.8/bin /中复制foo.key):
ssh_options[:keys] = ["foo.pem")]
绝对路径当然也有效:
ssh_options[:keys] = ["/home/me/foo.pem")]
ssh_options[:keys] = [File.join(ENV["HOME"], "foo.pem")]
我的上一次发布:
# deploy.rb
set :application, "MyFirm"
set :deploy_to, "/var/www/myfirm.com"
set :domain, "dev.myfirm.com"
default_run_options[:pty] = true
set :scm, :git
set :repository, "myfirm@94.141.21.125:/home/myfirm/myfirm.git"
set :ssh_options, {:forward_agent => true}
set :user, "ec2-user"
set :domain, "ec2-41-137-132-97.eu-west-1.compute.amazonaws.com"
ssh_options[:keys] = ["foo.pem"]
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :use_sudo, false
set :keep_releases, 3
set :shared_files, ["app/config/parameters.ini"]
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :update_vendors, true