2012-08-09 2 views
1

웹 서버로 유니콘과 함께 Rails 애플리케이션을 소유하고 있습니다.유니콘이 여전히 이전 릴리스 폴더를 가리키고 있습니다

저는 Capistrano를 사용하여 배포합니다. 여기

deploy.rb 파일 : 예상대로 서버에서

require "bundler/capistrano" 

server "91.121.11.100", :web, :app, :db, primary: true 

set :application, "myapp" 
set :user, "deployer" 
set :deploy_to, "/home/#{user}/apps/#{application}" 
#set :deploy_via, :remote_cache 
set :use_sudo, false 

set :scm, "git" 
set :repository, "[email protected]:therepository/#{application}.git" 
set :branch, "master" 

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true 

#after "deploy", "deploy:cleanup" # keep only the last 5 releases 

namespace :deploy do 
    %w[start stop restart].each do |command| 
    desc "#{command} unicorn server" 
    task command, roles: :app, except: {no_release: true} do 
     run "/etc/init.d/unicorn_#{application} #{command}" 
    end 
    end 

    task :setup_config, roles: :app do 
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}" 
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}" 
    run "mkdir -p #{shared_path}/config" 
    put File.read("config/database.yml"), "#{shared_path}/config/database.yml" 
    puts "Now edit the config files in #{shared_path}." 
    end 
    after "deploy:setup", "deploy:setup_config" 

    task :symlink_config, roles: :app do 
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" 
    end 
    after "deploy:finalize_update", "deploy:symlink_config" 

    desc "Make sure local git is in sync with remote." 
    task :check_revision, roles: :web do 
    unless `git rev-parse HEAD` == `git rev-parse origin/master` 
     puts "WARNING: HEAD is not the same as origin/master" 
     puts "Run `git push` to sync changes." 
     exit 
    end 
    end 
    before "deploy", "deploy:check_revision" 
end 

배포 잘 발생하고 현재 폴더에 업데이트 된 파일이 포함되어 있습니다.

하지만, 내가 이해하지 못하는 매우 이상한 일이 발생합니다

나는 나의 과정의 시작 부분에이 라인을 가지고 :

logger = Logger.new "#{Rails.root}/log/web_agents.log" 

이 오류가 계속 나타납니다

No such file or directory - /home/deployer/apps/myapp/releases/20120612122610/log/web_agents.log 

왜 20120612122610 ??? 그것은 심지어 내가 삭제 한 오래된 릴리스입니다.

왜 유니콘이 마지막 버전을 가리키지 않습니까?

테스트를 위해 Rails.root를 하드 코드 된 경로로 바꿉니다.

아직도 내가

어떤 생각 ... 강제로 중지 유니콘을 ... 중요하지 않습니다, 정지, 사망 한 ... 같은 오류가있어?

정확하게 나는 'current'폴더에서 마지막으로 업데이트 된 파일을 사용하여 프로세스를 시작한다고합니다. 프로세스를 삭제할 때 프로세스가 작동하지 않고 많은 오류가 나타납니다.

업데이트] 여기

config/unicorn.rb 파일 : 문제의 출처

root = "/home/deployer/apps/myapp/current" 
working_directory root 
pid "#{root}/tmp/pids/unicorn.pid" 
stderr_path "#{root}/log/unicorn.log" 
stdout_path "#{root}/log/unicorn.log" 

listen "/tmp/unicorn.myapp.sock" 
worker_processes 2 
timeout 30 
+0

'config/unicorn.rb'을 게시하십시오. – iblue

+0

@iblue unicorn.rb가 게시되었습니다. – Mik378

+0

@iblue 뭔가 궁금해합니다. 프로세스는 백그라운드에서 redis-server를 사용합니다. 어쩌면이 캐시는 일종의 캐시를 유지할 것입니다 ... 다시 시작하겠습니다 ... – Mik378

답변

2

내가 나 자신을 발견했다.

실제로 Unicorn과 Sidekiq 사이의 문제 해결이 있습니다.

실제로 위에서 언급 한 것처럼 Sidekq에서 프로세스가 시작되었습니다. 이 배포 프로세스가 정상적으로 Sidekiq을 다시 시작할 수

require 'sidekiq/capistrano' 

:

는 첫째, deploy.rb 내에서,이 라인이 있어야합니다. 보기 : https://github.com/mperham/sidekiq/wiki/Deployment

두 번째로, 유니콘 내에 있습니다.

https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting

을 이제 더 이상 이상한 문제 :

A :이 참조, 그것은에 대한 자세한 내용은

after_fork do |server, worker| 
    Sidekiq.configure_client do |config| 
    config.redis = { :size => 1 } 
    end 
end 

: RB는 블록의이 종류가 있어야합니다 잠재적 인 설명 :

아마도 SideKit은 마지막 rel을 기반으로하는 일부 캐시를 관리합니다 용이성 ... 그리고 그것은 다시 시작 플러스 유니콘과 Sidekiq의 깨끗한 출시 충분했다.

관련 문제