[英]Capistrano with PHP
I am trying to deploy a helloworld site from my local machine to a server. 我正在尝试将本地计算机上的helloworld站点部署到服务器。 I have installed Ruby, Rails and Capistrano.
我已经安装了Ruby,Rails和Capistrano。 After having a recipe I type this "cap deploy:setup" command and get following error
有了食谱后,我键入此“ cap deploy:setup”命令并得到以下错误
/usr/lib/ruby/1.8/capistrano/configuration/variables.rb:122:in
method_missing': undefined local variable or method
primary' for/usr/lib/ruby/1.8/capistrano/configuration/variables.rb:122:in
method_missing': undefined local variable or method
for的method_missing': undefined local variable or method
主method_missing': undefined local variable or method
(NameError) from ./config/deploy.rb:19:in `load' from
(NameError)来自./config/deploy.rb:19:in来自
/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:172:in
load_from_file' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in
load' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:inload' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
each' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:inload' from Capfile:4:in
load' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:172:inload_from_file' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in
load' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:inload' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
each' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:inload' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
load_recipes' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:ineach' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
load_recipes' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:3/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:172:在/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:在
load_from_file' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in
从/ usr / libload' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
每个/usr/lib/ruby/1.8中的/ruby/1.8/capistrano/configuration/loading.rb:86:in在load' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
/capistrano/configuration/loading.rb:86load' from Capfile:4:in
加载load' from Capfile:4:in
load从/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:172load' from Capfile:4:in
load_from_file' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in
从/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:inload' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
load_from_file' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in
load从/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:inload' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
load' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
:从/usr/lib/ruby/1.8/capistrano/cli中的load' from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in
load' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
:在/usr/lib/ruby/1.8/capistrano/cli/execute.rb中的load' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
64:在/usr/lib/ruby/1.8/capistrano/cli/execute.rb中的each' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
/usr/lib/ruby/1.8/capistrano/cli/executeeach' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
load_recipeseach' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
.rbeach' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in
0:inexecute!' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:14:in
0:
execute!' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:14:in
execute!' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:14:in
execute' from /usr/bin/cap:4execute!' from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:14:in
execute'从/ usr / bin / cap:4
Following is my deploy.rb file contents. 以下是我的deploy.rb文件内容。
set :application, "testapp"
set :repository, "<url of git repo>"
set :deploy_to, "var/www/html/testapp"
set :document_root, "var/www/html/testapp/current"
set :scm, :git
set :scm_username, "MyUserName"
set :scm_password, "MyPassword"
set :scm_checkout, "clone"
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :user, "<server's user name>"
set :password, "<server's password>"
set :use_sudo, false
set :ssh_options, {:forward_agent => true}
role :web, "<server's IP>" # Your HTTP server, Apache/etc
role :app, "<server's IP>" # This may be the same as your `Web` server
role :db, "<server's IP>", primary => true # This is where Rails migrations will run
# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
# namespace :deploy do
# task :start {}
# task :stop {}
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
namespace :deploy do
task :update do
transaction do
update_code
symlink
end
end
task :finalize_update do
transaction do
end
end
task :symlink do
transaction do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
run "ln -nfs #{deploy_to}/#{current_dir} #{document_root}"
end
end
task :migrate do
end
task :restart do
end
end
role :db, "<server's IP>", primary => true
应该
role :db, "<server's IP>", :primary => true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.