I get a cache: [GET /] miss error message for my Rails 3.2 application.
I use nginx as the proxy for the unicorn and I am deploying it using capistrano. When I start the server, I get a lot of repeated errors like the ones above. Capistrano will definitely precompile assets during deployment. I include the configuration files below (sorry for the detailed).
Any ideas, or at least a hint, to find out what is wrong?
application.rb
config.assets.enabled = true
production.rb
# Disable Rails static asset server
deploy.rb
require 'bundler/capistrano' set :application, "network" set :rails_env, "production" set :deploy_to, "/var/www/#{application}" set :repository, "/var/repo/#{application}.git". set :branch, "master" set :use_sudo, false set :user, "root" set :unicorn_conf, "#{deploy_to}/current/config/unicorn.rb" set :unicorn_pid, "#{deploy_to}/shared/pids/unicorn.pid" set :bundle_roles, [:app] set :normalize_asset_timestamps, false set :scm, :git server "mydomain.ru", :app, :web, :db, :primary => true namespace :deploy do task :restart do run "if [ -f #{unicorn_pid} ] && [ -e /proc/$(cat #{unicorn_pid}) ]; then kill -USR2 `cat #{unicorn_pid}`; else cd #{deploy_to}/current && bundle exec unicorn -c #{unicorn_conf} -E #{rails_env} -D; fi" end task :start do run "cd #{deploy_to}/current && bundle exec unicorn -c #{unicorn_conf} -E #{rails_env} -D" end task :stop do run "if [ -f #{unicorn_pid} ] && [ -e /proc/$(cat #{unicorn_pid}) ]; then kill -QUIT `cat #{unicorn_pid}`; fi" end end
unicorn.rb
DEPLOY_TO = "/var/www/network" RAILS_ROOT = "#{DEPLOY_TO}/current" PID_FILE = "#{DEPLOY_TO}/shared/pids/unicorn.pid" SOCKET_FILE = "#{DEPLOY_TO}/shared/unicorn.sock" LOG_FILE = "#{RAILS_ROOT}/log/unicorn.log" ERR_LOG = "#{RAILS_ROOT}/log/unicorn_error.log" OLD_PID = PID_FILE + '.old' listen SOCKET_FILE, :backlog => 1024 timeout 30 worker_processes 2 user "danchenkov", "danchenkov" working_directory RAILS_ROOT pid PID_FILE stderr_path ERR_LOG stdout_path LOG_FILE preload_app true GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_exec do |server| ENV["BUNDLE_GEMFILE"] = "#{rails_root}/Gemfile" end before_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! old_pid = "#{server.config[:pid]}.old" if File.exists?(old_pid) && old_pid != server.pid begin sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU Process.kill(sig, File.read(old_pid).to_i) rescue Errno::ENOENT, Errno::ESRCH end end sleep 1 end after_fork do |server, worker| defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection end
nginx.conf