2011-06-24 191 views
2

我使用的是ror 3.1 rc4,在部署到生產服務器時,找不到圖像,樣式表和JavaScript目錄,並且部署失敗。我確實有deploy.rb部署在公共目錄中找不到資產文件夾

namespace :deploy do 
    task :start do ; end 
    task :stop do ; end 

    desc "Restarting mod_rails with restart.txt" 
    task :restart, :roles => :app, :except => { :no_release => true } do 
    run "touch #{current_path}/tmp/restart.txt" 
end 

task :precompile do 
    run "cd #{release_path}; RAILS_ENV=production rake assets:precompile" 
end 
end 

after 'deploy:update_code', 'deploy:precompile' 

這裏需要的代碼是錯誤,我得到

executing "find /var/www/nattyvelo/releases/20110624033801/public/images /var/www/nattyvelo/releases/20110624033801/public/stylesheets /var/www/nattyvelo/releases/20110624033801/public/javascripts -exec touch -t 201106240338.03 {} ';'; true" 
    servers: ["66.228.39.243"] 
    [66.228.39.243] executing command 
** [out :: 66.228.39.243] find: `/var/www/nattyvelo/releases/20110624033801/public/images' 
** [out :: 66.228.39.243] : No such file or directory 
** [out :: 66.228.39.243] find: `/var/www/nattyvelo/releases/20110624033801/public/stylesheets' 
** [out :: 66.228.39.243] : No such file or directory 
** [out :: 66.228.39.243] find: `/var/www/nattyvelo/releases/20110624033801/public/javascripts' 
** [out :: 66.228.39.243] : No such file or directory 
    command finished in 705ms 
    triggering after callbacks for `deploy:update_code' 
    * executing `bundle:install' 
    * executing "ls -x /var/www/nattyvelo/releases" 
    servers: ["66.228.39.243"] 
    [66.228.39.243] executing command 
    command finished in 595ms 
    * executing "cd /var/www/nattyvelo/releases/20110624033801 && bundle install --gemfile /var/www/nattyvelo/releases/20110624033801/Gemfile --path /var/www/nattyvelo/shared/bundle --deployment --quiet --without development test" 
    servers: ["66.228.39.243"] 
    [66.228.39.243] executing command 
** [out :: 66.228.39.243] bash: bundle: command not found 
    command finished in 604ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /var/www/nattyvelo/releases/20110624033801; true" 
+0

修復bundler路徑後。我必須做出這個改變! https://gist.github.com/1018400 – railsnoob

回答

0

你必須通過它的外觀一個PATH問題:

** [out :: 66.228.39.243] bash: bundle: command not found 

你需要修復你的環境變量PATH

0

您可能必須在生產服務器中安裝捆綁軟件。

sudo gem install bundler 
1

這裏發生了兩個錯誤。

第一個是在Rails 3.1應用程序中不再有public/imagespublic/stylesheetspublic/javascripts文件夾。他們都被搬進了app/assets。但是,如果您運行rake assets:precompile那麼是一個public/assets文件夾。這是您的應用程序的靜態資產將被提供的地方。

無論在您的部署腳本中引用這三個文件夾是否需要停止這樣做,否則您將繼續出現此錯誤。


第二個錯誤是,就像我之前的其他兩個人有種建議,你需要在服務器上安裝Bundler gem。

相關問題