开发者

deploy can't find asset folders in the public dir

开发者 https://www.devze.com 2023-03-14 21:50 出处:网络
I\'m using ror 3.1 rc4, somehow when I deploy into a production server, the directories for images, stylesheets, and javascript are not found, and deployment fails. I do have the necessary code in dep

I'm using ror 3.1 rc4, somehow when I deploy into a production server, the directories for images, stylesheets, and javascript are not found, and deployment fails. I do have the necessary code in 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

af开发者_StackOverflowter 'deploy:update_code', 'deploy:precompile'

And here is the error I get

 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"


There's two errors happening here.

The first is that there is no longer a public/images, public/stylesheets or public/javascripts folder within a Rails 3.1 application. They have all been moved into app/assets. However, if you run rake assets:precompile then there will be a public/assets folder. This is where the static assets for your application will be served out of.

Whatever it is in your deploy script that is referencing these three folders needs to stop doing so or otherwise you'll continue to get this error.


The second error is that, just like the two other people before me have kind of suggested, you need to have the Bundler gem installed on the server.


You have a PATH problem by the look of it:

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

You need to fix your PATH environment variable.


You probably have to install bundler in the production server.

sudo gem install bundler
0

精彩评论

暂无评论...
验证码 换一张
取 消