I'm having an issue deploying to a VPS using Rails. My app works fine in the development environment, but when I push to production using Capistrano, I run into issues.
I am using unicorn, rails 3.2.13, and ruby 1.9.3
The issue I have is when I visit my production site, I get a 'template is missing' error:
Template is missing
Missing template site/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :haml]}. Searched in: * "/home/deployer/apps/my-app/releases/20130417030832/app/views" * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/devise-2.2.3/app/views" * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/bundler/gems/piggybak_paypal-b892954868c7/app/views" * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/piggybak_variants-0.0.15/app/views" * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/piggybak-0.6.28/app/views" * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-b8465f738261/app/views" * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/kaminari-0.14.1/app/views"
So, I think it could be an assets precompile issue. When I run rake assets:precompile in my local development environment, I get the issue:
/Users/ac/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /Users/ac/.rvm/gems/ruby-1.9.3-p392/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
rake aborted!
FATAL: password authentication failed for user "deployer"
/Users/ac/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize'
/Users/ac/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `new'
/Users/ac/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `connect'
...
deployer is the name of my production database user, and is found in database.yml, under the production namespace. I'm not sure why it's trying to load this. I am definitely running the server in development mode.
I also notce this in my unicorn.log file on my production server:
I, [2013-04-17T04:44:46.626587 #16199] INFO -- : executing ["/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/bin/unicorn", "-D", "-c", "/home/deployer/apps/my-app/current/config/unicorn.rb", "-E", "production", {12=>#<Kgio::UNIXServer:fd 12>}] (in /home/deployer/apps/my-app/releases/20130417044320)
I, [2013-04-17T04:44:46.627160 #16199] INFO -- : forked child re-executing...
/home/deployer/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/definition.rb:16:in `build': /home/deployer/apps/my-app/releases/20130417020329/Gemfile not found (Bundler::GemfileNotFound)
from /home/deployer/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
from /home/deployer/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
from /home/deployer/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
from /home/deployer/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/deployer/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
E, [2013-04-17T04:44:46.777335 #18166] ERROR -- : reaped #<Process::Status: pid 16199 exit 1> exec()-ed
Here's my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'pg'
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'piggybak', '0.6.28'
gem "piggybak_variants", '0.0.15'
gem 'piggybak_paypal', :git => 'git://github.com/timmyc/piggybak_paypal.git'
gem 'devise'
gem "cancan"
gem 'countries', :require => 'iso3166'
gem "figaro"
gem 'redactor-rails'
gem "carrierwave"
gem 'rmagick', '2.13.2'
gem "mini_magick"
gem "fog", "~> 1.3.1"
gem 'turbolinks'
gem 'tire', '0.5.7' # elastic search
gem 'kaminari'
gem "friendly_id", "~> 4.0.9"
gem 'acts-as-taggable-on', '>= 2.3.1'
gem 'acts_as_list'
gem 'meta-tags', :require => 'meta_tags'
#group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'haml-rails'
gem 'uglifier', '>= 1.0.3'
#end
group :development do
gem 'bullet'
gem 'meta_request'
end
gem 'jquery-rails'
gem "unicorn-rails"
gem 'capistrano'
gem 'rvm-capistrano'
Thoughts would be much appreciated. Thank you in advance.