2016-04-05 45 views
0
benim VPS benim web uygulaması dağıtmak için Capistrano kullanmak istiyorum

. Ne yazık ki, bazı hatalar alıyorum:Capistrano, Debian 8 systemctl

DEBUG [6de1d411] Running [ -L /var/www/myapp/releases/20160405125654/log ] as [email protected] 
DEBUG [6de1d411] Command: [ -L /var/www/myapp/releases/20160405125654/log ] 
DEBUG [6de1d411] Finished in 0.005 seconds with exit status 0 (successful). 
DEBUG [cf28b01d] Running [ -L /var/www/myapp/releases/20160405125654/tmp/pids ] as [email protected] 
DEBUG [cf28b01d] Command: [ -L /var/www/myapp/releases/20160405125654/tmp/pids ] 
DEBUG [cf28b01d] Finished in 0.005 seconds with exit status 1 (failed). 
DEBUG [c7f0b156] Running [ -d /var/www/myapp/releases/20160405125654/tmp/pids ] as [email protected] 
DEBUG [c7f0b156] Command: [ -d /var/www/myapp/releases/20160405125654/tmp/pids ] 
DEBUG [c7f0b156] Finished in 0.005 seconds with exit status 1 (failed). 

Bildiğim kadarıyla okumak sadece sembolik ve dizinleri varlığını kontrol eder, çünkü bunlar başarısız deney, Tamam.

/usr/bin/env service 

beri

INFO [c1b0c10e] Finished in 0.007 seconds with exit status 0 (successful). 
INFO [e895fd13] Running /usr/bin/env sudo /etc/init.d/nginx reload as [email protected] 
DEBUG [e895fd13] Command: (export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env sudo /etc/init.d/nginx reload) 
DEBUG [e895fd13] Reloading nginx configuration (via systemctl): nginx.service 
DEBUG [e895fd13] . 
INFO [e895fd13] Finished in 0.037 seconds with exit status 0 (successful). 
INFO [1a822f12] Running /usr/bin/env service unicorn_myapp_production restart as [email protected] 
DEBUG [1a822f12] Command: (export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.3" ; /usr/bin/env service unicorn_myapp_production restart) 
DEBUG [1a822f12] /usr/bin/env: service 
DEBUG [1a822f12] : No such file or directory 
(Backtrace restricted to imported tasks) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: service exit status: 127 
service stdout: Nothing written 
service stderr: /usr/bin/env: service: No such file or directory 

Açıkçası, Debian Jessie yerine service ait systemctl dayanır var gerçekten değil: Fakat şu şekilde oyun-kırıcı olduğunu. Hayır, /myapp/config/deploy.rb için

namespace :unicorn do 

    task :defaults do 
    on roles :app do 
     set :unicorn_user, fetch(:unicorn_user, deploy_user) 
    end 
    end 

    desc 'Setup Unicorn initializer' 
    task :setup_initializer do 
    on roles :app do 
     next if file_exists? unicorn_initd_file 
     sudo_upload! template('unicorn_init.erb'), unicorn_initd_file 
     execute :chmod, '+x', unicorn_initd_file 
     sudo 'update-rc.d', '-f', fetch(:unicorn_service), 'defaults' 
    end 
    end 

    desc 'Setup Unicorn app configuration' 
    task :setup_app_config do 
    on roles :app do 
     next if file_exists? fetch(:unicorn_config) 
     execute :mkdir, '-pv', File.dirname(fetch(:unicorn_config)) 
     upload! template('unicorn.rb.erb'), fetch(:unicorn_config) 
    end 
    end 

    %w[start stop restart].each do |command| 
    desc "#{command} unicorn" 
    task command do 
     on roles :app do 
     # execute :service, fetch(:unicorn_service), command 
     # run "#{sudo} systemctl #{command} unicorn_#{application}" 
     sudo "/etc/init.d/unicorn_#{fetch(:unicorn_service)} #{command}" 
     end 
    end 
    end 

    before :setup_initializer, :defaults 

end 

ekleyerek varsayılan davranışı üzerine yazmak istiyor. Fakat capistrano bu ayarları göz ardı ediyor. Öyleyse, Debian-8'e özgü bir yapılandırmanın yüklenmesini nasıl sağlayabilirim.

cevap

0

Ben tek boynuzlu aşina değilim, ama o zaman geçersiz kılmak çalışıyoruz kapak görevlerini tanımlayan bir şeyi kullandığınız varsayılmaktadır? Eğer durum buysa, Capistrano 3 ile yeniden tanımlamak için orijinal görevi temizlemeniz gerekir. Yaptığınız şey şu anda görevleri genişletiyor. Rake::Task["task_name"].clear kullanabilmeniz için daha fazla bir şey gerekir:

namespace :unicorn do 
    %w[start stop restart].each do |command| 
    Rake::Task["unicorn:#{command}"].clear 

    desc "#{command} unicorn" 
    task command do 
     on roles :app do 
     # execute :service, fetch(:unicorn_service), command 
     # run "#{sudo} systemctl #{command} unicorn_#{application}" 
     sudo "/etc/init.d/unicorn_#{fetch(:unicorn_service)} #{command}" 
     end 
    end 
    end 
end 
+1

Bu soruları cevaplıyor ama sorunu çözmüyor. Bu çözüm sessiz gibi görünüyor: Byebye Debian, Merhaba Ubuntu. – wieschoo