我正在尝试cap deploy:setup
在我的 rails 项目目录中运行,但出现此错误。
* 2013-07-06 02:46:14 executing `deploy:setup'
* executing multiple commands in parallel
-> "else" :: "sudo -p 'sudo password: ' mkdir -p /var/www /var/www/releases /var/www/shared /var/www/shared/system /var/www/shared/log /var/www/shared/pids"
-> "else" :: "sudo -p 'sudo password: ' mkdir -p /var/www /var/www/releases /var/www/shared /var/www/shared/system /var/www/shared/log /var/www/shared/pids"
-> "else" :: "sudo -p 'sudo password: ' mkdir -p /var/www /var/www/releases /var/www/shared /var/www/shared/system /var/www/shared/log /var/www/shared/pids"
-> "else" :: "sudo -p 'sudo password: ' mkdir -p /var/www /var/www/releases /var/www/shared /var/www/shared/system /var/www/shared/log /var/www/shared/pids"
-> "else" :: "sudo -p 'sudo password: ' mkdir -p /var/www /var/www/releases /var/www/shared /var/www/shared/system /var/www/shared/log /var/www/shared/pids"
servers: ["your web-server here", "*web-address-from-capfile*", "your app-server here", "your primary db-server here", "your slave db-server here"]
connection failed for: your primary db-server here (SocketError: getaddrinfo: nodename nor servname provided, or not known), your web-server here (SocketError: getaddrinfo: nodename nor servname provided, or not known), your slave db-server here (SocketError: getaddrinfo: nodename nor servname provided, or not known), your app-server here (SocketError: getaddrinfo: nodename nor servname provided, or not known)
我的 Capfile 是这样的:
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
set :application, "myapp"
set :repository, "file://~/git/#{application}.git"
set :local_repository, "myserver:~/git/#{application}.git"
set :branch, "master"
set :scm, :git
set :deploy_to, "/var/www"
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :user, "me"
ssh_options[:keys] = %w(~/.ssh/id_rsa)
set :port, 33333
server "example.com", :app, :web, :db, :primary => true
这个错误真的让我发疯。应该注意的是,我可以使用我的公钥/私钥很好地 ssh 进入我的服务器,并且 sshd 设置为侦听远程主机上的非默认端口(因此是该set :port
行)。