我正在使用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 :(得分:1)
这里发生了两个错误。
首先,Rails 3.1应用程序中不再有public/images
,public/stylesheets
或public/javascripts
文件夹。他们都已被转移到app/assets
。但是,如果您运行rake assets:precompile
,那么将成为public/assets
文件夹。这是您的应用程序的静态资产将在其中提供的地方。
无论您的部署脚本中引用这三个文件夹的是什么,都需要停止这样做,否则您将继续收到此错误。
第二个错误是,就像我之前提出的其他两个人一样,你需要在服务器上安装Bundler gem。
答案 1 :(得分:0)
你看起来有PATH
个问题:
** [out :: 66.228.39.243] bash: bundle: command not found
您需要修复PATH
环境变量。
答案 2 :(得分:0)
您可能必须在生产服务器中安装bundler。
sudo gem install bundler