Capistrano从旧版本中发出错误。 ::的ActionView MissingTemplate

时间:2014-03-10 13:09:14

标签: ruby-on-rails capistrano unicorn

我已使用capistrano AWS部署了我的应用,nginxunicorn。当我打开我的主页时,它是空的。这是我的unicorn日志

Started GET "/" for 111.111.111.111 at 2014-03-10 12:50:02 +0000
Processing by StaticController#index as HTML
Completed 500 Internal Server Error in 236ms

ActionView::MissingTemplate (Missing template static/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:
  * "/home/deployer/apps/my-app/releases/20140310084512/app/views"
  * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/twitter-bootstrap-rails-2.2.8/app/views"
  * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/glimpse-redis-1.1.0/app/views"
  * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/glimpse-git-1.0.1/app/views"
  * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/glimpse-0.0.5/app/views"
  * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/kaminari-0.15.1/app/views"
  * "/home/deployer/apps/my-app/shared/bundle/ruby/1.9.1/gems/devise-3.2.3/app/views"
  * "/home/deployer/apps/my-app/releases/20140310124541"
  * "/"
):
  app/controllers/static_controller.rb:8:in `index'

我的最新版本是20140310124541,但缺少的模板错误来自之前的版本20140310084512。可能是什么问题。 current文件夹符号链接已正确创建。

3 个答案:

答案 0 :(得分:6)

您需要确保重新启动nginx / unicorn。一旦程序在符号链接中查找文件夹/文件,它将指向目标。因此,当capistrano指向当前最新版本时,nginx仍在查看现在很可能被删除的旧目标。

确保您已重启设置,如下所示:https://github.com/sosedoff/capistrano-unicorn

答案 1 :(得分:0)

--trace旗帜给了我更多信息。在我的情况下,宝石丢失了,我没有发现错误。 passenger是宝石。

答案 2 :(得分:0)

akshah123的解决方案是答案,我想分享我的看法,如果这可能对其他人有所帮助。

在deploy / your_environment.rb(例如:deploy/staging.rb)或deploy.rb中,您可以添加:

after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
  desc 'for resetting symlinks that are getting stuck in the normal deploy process'
  task :restart do
    invoke 'unicorn:reload'
  end
end

根据Capistrano的设置方式,您可能会看到以下内容:

Skipping task `unicorn:start'.
Capistrano tasks may only be invoked once. Since task `unicorn:start' was previously invoked, invoke("unicorn:start") at /Users/newman/.rvm/gems/ruby-2.6.3/gems/capistrano3-unicorn-0.2.1/lib/capistrano3/tasks/unicorn.rake:49 will be skipped.
If you really meant to run this task again, use invoke!("unicorn:start")
THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF CAPISTRANO. Please join the conversation here if this affects you.

在大多数情况下,这应该可以解决,因为正在处理冗余,并且出现了重新映射符号链接的预期结果。在这种情况下,可能不需要/不需要从消息中建议的修复,因为我们从调用unicorn:start隐式调用unicorn:reload,换句话说:invoke! unicorn:reload无法处理/阻止呈现此消息。