我在使用Rails部署到VPS時遇到問題。我的應用程序在開發環境中工作正常,但是當我使用Capistrano推到產品時,我遇到了問題。資產管道不能在導軌生產環境中工作
我使用麒麟,軌道3.2.13和1.9.3紅寶石
我的問題是,當我訪問我的生產現場,我得到一個「模板丟失」的錯誤:
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"
所以,我認爲這可能是一個資產預先編譯問題。當我運行耙資產:在我的地方發展環境的預編譯,我得到的問題:
/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'
...
部署是我的生產數據庫的用戶名,並在database.yml中被發現,在生產的命名空間。我不知道爲什麼它試圖加載這個。我肯定在開發模式下運行服務器。
我也notce這在我的我的生產服務器上unicorn.log文件:
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/[email protected]/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/[email protected]/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
from /home/deployer/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
from /home/deployer/.rvm/gems/[email protected]/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
這裏是我的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'
思想,將不勝感激。先謝謝你。
這是爲什麼在Gemfile中註釋了「#group:assets do」。你可以取消註釋嗎? –
我取消註釋,因爲我正在測試。它沒有或沒有:資產塊。 – anthony
你可以從獨角獸的日誌中看到,它似乎無法找到gemfile,任何人都知道爲什麼? /home/deployer/.rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/definition.rb:16:in'build':/ home/deployer/apps/my-app/releases/20130417020329 /找不到Gemfile(Bundler :: GemfileNotFound) – anthony