3
我正在努力讓capistrano發佈我的PlayFramework應用程序,但我在運行命令時遇到了一些麻煩。Capistrano和PlayFramework
會發生什麼事是,帽運行播放開始命令,它的似乎是燒起來,但是當我做了
ps aux | grep java
沒有發揮應用程序的運行。
如果我從cap輸出複製命令並在服務器本地運行它,它可以正常工作。
卡皮斯特拉諾運行命令是否會殺死玩遊戲的子進程?
我如何防止卡皮斯特拉諾殺死這個過程?
我deploy.rb
default_run_options[:pty] = true
set :application, "Intranet"
set :domain, "intranet.example.com"
set :deploy_to, "/srv/#{domain}"
set :play_path, "/usr/local/play/play"
set :shared_path, "#{deploy_to}/shared"
set :app_pid, "#{shared_path}/pids/server.pid"
set :app_path, "#{deploy_to}/current"
set :scm, :git
set :user, "myuser"
set :repository, "[email protected]:intranet.git"
ssh_options[:forward_agent] = true
set :deploy_via, :remote_cache
set :keep_releases, 3
role :web, domain
role :app, domain
role :db, domain, :primary => true
namespace :deploy do
task :start do
run "rm -f #{app_pid};#{play_path} start #{app_path} --deps --pid_file=#{app_pid} --%prod"
end
task :restart do
stop
start
end
task :stop do
run "#{play_path} stop #{app_path} --pid_file=#{app_pid}"
end
end
namespace :play do
desc "view running play apps"
task :viewprocess do
run "#{sudo} ps -ef | grep 'play/framework'"
end
desc "kill play processes"
task :kill do
run "#{sudo} ps -ef | grep 'play/framework' | grep -v 'grep' | awk '{print $2}'| xargs -i kill {} ; echo ''"
end
desc "view logfiles"
task :tail_logs, :roles => :app do
run "tail -f #{shared_path}/log/system.out" do |channel, stream, data|
puts # for an extra line break before the host name
puts "#{channel[:host]}: #{data}"
break if stream == :err
end
end
end
太棒了!最後,我可以得到一個線部署:) –
偉大的,如果它的工作,我也喜歡它:) – mandubian
感謝您的腳本,因爲沒有它,它會更長,我嘗試和寫幾條Ruby線;) – mandubian