1

Capistrano를 사용하여 Rails 3.2.13 응용 프로그램을 배포하려고합니다.Capistrano - 레이크 에셋 : 사전 컴파일 - 응용 프로그램이 이미 초기화되었습니다.

자산 파이프 라인을 사용 중이므로 배포 중에 자산을 사전 컴파일하려고합니다.

"응용 프로그램이 이미 초기화되었습니다."라는 오류가 발생합니다. 레이크 애셋 중 : 사전 컴파일 단계.

executing "cd -- /sites/beta.myapp.com/releases/20130905192243 && RAILS_ENV=beta RAILS_GROUPS=assets bundle exec rake assets:precompile" executing command rake aborted! Application has been already initialized. /sites/beta.myapp.com/shared/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:135:in initialize!' /sites/beta.myapp.com/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:95:in block (2 levels) in '

Tasks: TOP => assets:precompile:primary => assets:environment

어떤 아이디어 :

여기에 스택 추적입니까? 나는 결국이 문제를 해결

require "bundler/capistrano" 
require 'capistrano/ext/multistage' 
require "whenever/capistrano" 
require './config/boot' 
require 'airbrake/capistrano' 

set :stages, %w(beta production) 

set :application, "myapp...." 
set :whenever_environment, defer { stage } 
set :whenever_command, "bundle exec whenever" 

set :user, "myuser...." 
set :deploy_via, :remote_cache 
set :use_sudo, false 

set :scm, "git" 
set :repository, "myrepo....." 
set :branch, $1 if `git branch` =~ /\* (\S+)\s/m 

namespace :deploy do 
    task :cold do  # Overriding the default deploy:cold 
    update 
    load_schema  # My own step, replacing migrations. 
    start 
    end 

    task :load_schema, :roles => :app do 
    run "cd #{current_path}; rake db:schema:load RAILS_ENV=#{stage}" 
    end 

    desc "Tell Passenger to restart and restart workers." 
    task :restart, :roles => :web do 
    run "touch #{deploy_to}/current/tmp/restart.txt" 
    end 

    desc "Do nothing on startup so we don't get a script/spin error." 
    task :start do 
    puts "You may need to restart Apache." 
    end 

    desc "Symlink extra configs and folders." 
    task :symlink_extras do 
    run "ln -nfs #{shared_path}/config/database.yml #{latest_release}/config/database.yml" 
    run "ln -nfs #{shared_path}/assets #{latest_release}/public/assets" 
    end 

    desc "Setup shared directory." 
    task :setup_shared do 
    run "mkdir #{shared_path}/assets" 
    run "mkdir #{shared_path}/config" 
    run "mkdir #{shared_path}/tmp" 
    run "mkdir #{shared_path}/db" 
    put File.read("config/examples/database.yml"), "#{shared_path}/config/database.yml" 
    puts "Now edit the config files and fill assets folder in #{shared_path}." 
    end 

    desc "Seed the db with shipping options and a product" 
    task :seed do 
    run "cd #{current_path}; rake db:seed" 
    end 

    desc "Make sure there is something to deploy" 
    task :check_revision, :roles => :web do 
    unless `git rev-parse HEAD` == `git rev-parse origin/#{branch}` 
     puts "WARNING: HEAD is not the same as origin/master" 
     puts "Run `git push` to sync changes." 
     exit 
    end 
    end 

    desc "Stop resque Workers." 
    task :stop_workers, :on_error => :continue do 
    run "cd #{current_path} && rake resque:stop_workers RAILS_ENV=#{stage}"  
    end 
end 

before "deploy", "deploy:check_revision" 
after "deploy", "deploy:cleanup" 
after "deploy:setup", "deploy:setup_shared" 
before "deploy:assets:precompile", "deploy:symlink_extras" 
after "deploy:update_code", "deploy:stop_workers" 
+1

deploy.rb를 표시 할 수 있습니까? 그렇지 않으면 우리가 할 수있는 일은 야생 추측을내는 것입니다. – fotanus

+0

@fontanus --- 방금 요청한대로 deploy.rb를 추가했습니다. 감사. – rlarcombe

답변

1

: 여기

내 deploy.rb입니다

config.assets.initialize_on_precompile = true

: 설정/application.rb에서

을, 나는 다음 줄을 주석했다

나는 config.assets.initialize_on_precompile을 false로 설정하고 또한 true로 설정하려고 시도했다. 두 경우 모두 "Application has already been initialized"오류가 발생했다.

하지만 한 번 주석을 달았 으면 내 앱을 배포 할 수있었습니다.

+0

나는 비관적 이었지만 실제로 효과가 있었다 ... 거짓으로 설정하는 것이 왜 그리 좋지 않은가? – hananamar

관련 문제