【问题标题】:Can't make Rails 3.1.1 asset pipeline working on Heroku Cedar deploy无法使 Rails 3.1.1 资产管道在 Heroku Cedar 部署上工作
【发布时间】:2011-12-25 15:27:55
【问题描述】:

我已关注Rails 3.1 on Heroku Cedar 教程以及另外六篇文章,但无法使其正常工作。

在推送 Heroku 后,该应用程序没有任何可用的 CSS/js。

Push 编译和注入 rails3_serve_static_assets 似乎没有任何错误:

lsoave@ubuntu:~/rails/github/gitwatcher$ git push heroku +master
Counting objects: 30, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 1.99 KiB, done.
Total 21 (delta 16), reused 0 (delta 0)

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.rc
       Running: bundle install --without development:test --path vendor/bundle --deployment
       Fetching gem metadata from http://rubygems.org/.......
       Fetching gem metadata from http://rubygems.org/..
       Using rake (0.9.2)
       Using log4r (1.1.9)
       Using XMLCanonicalizer (1.0.1)
       Using multi_json (1.0.3)
       Using activesupport (3.1.1)
       Using builder (3.0.0)
       Using i18n (0.6.0)
       Using activemodel (3.1.1)
       Using erubis (2.7.0)
       Using rack (1.3.5)
       Using rack-cache (1.1)
       Using rack-mount (0.8.3)
       Using rack-test (0.6.1)
       Using hike (1.2.1)
       Using tilt (1.3.3)
       Using sprockets (2.0.3)
       Using actionpack (3.1.1)
       Using mime-types (1.17.2)
       Using polyglot (0.3.3)
       Using treetop (1.4.10)
       Using mail (2.3.0)
       Using actionmailer (3.1.1)
       Using arel (2.2.1)
       Installing tzinfo (0.3.31)
       Using activerecord (3.1.1)
       Using activeresource (3.1.1)
       Using addressable (2.2.6)
       Using bson (1.4.0)
       Using bson_ext (1.4.0)
       Using chunky_png (1.2.5)
       Installing coffee-script-source (1.1.3)
       Using execjs (1.2.9)
       Using coffee-script (2.2.0)
       Using rack-ssl (1.3.2)
       Using json (1.6.1)
       Using rdoc (3.11)
       Using thor (0.14.6)
       Using railties (3.1.1)
       Using coffee-rails (3.1.1)
       Using fssm (0.2.7)
       Using sass (3.1.10)
       Using compass (0.12.alpha.0)
       Using crack (0.1.8)
       Using daemons (1.0.10)
       Using dalli (1.1.3)
       Using eventmachine (0.12.10)
       Using multipart-post (1.1.3)
       Using faraday (0.7.5)
       Using faraday-stack (0.1.3)
       Using haml (3.1.2)
       Using haml-rails (0.3.4)
       Using httparty (0.7.8)
       Installing jquery-rails (1.0.17)
       Using bundler (1.1.rc)
       Using rails (3.1.1)
       Using kaminari (0.12.4)
       Installing systemu (2.4.1)
       Using macaddr (1.5.0)
       Using mongo (1.4.0)
       Using mongoid (2.2.2)
       Using mongoid_taggable_with_context (0.7.2) from https://github.com/lgs/mongoid_taggable_with_context.git (at master)
       Using multi_xml (0.4.1)
       Using net-ldap (0.2.2)
       Using nokogiri (1.5.0)
       Using oa-core (0.3.2)
       Using rest-client (1.6.7)
       Using oa-basic (0.3.2)
       Using pyu-ruby-sasl (0.0.3.3)
       Using rubyntlm (0.1.1)
       Using uuid (2.3.4)
       Using oa-enterprise (0.3.2)
       Using oa-more (0.3.2)
       Using oauth (0.4.5)
       Using oauth2 (0.5.1)
       Using oa-oauth (0.3.2)
       Using ruby-openid (2.1.8)
       Using rack-openid (1.3.1)
       Using ruby-openid-apps-discovery (1.2.0)
       Using oa-openid (0.3.2)
       Using omniauth (0.3.2)
       Using pg (0.11.0)
       Using rufus-scheduler (2.0.10)
       Using sass-rails (3.1.4)
       Using thin (1.2.11)
       Using uglifier (1.0.4)
       Your bundle is complete! It was installed into ./vendor/bundle
       Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Rails plugin injection
       Injecting rails_log_stdout
       Injecting rails3_serve_static_assets
-----> Discovering process types
       Procfile declares types      -> web
       Default types for Ruby/Rails -> console, rake, worker
-----> Compiled slug size is 25.3MB
-----> Launching... done, v25
       http://gitwatcher.com deployed to Heroku

To git@heroku.com:gitwatcher.git
 + 6033342...d6921f3 master -> master (forced update)
lsoave@ubuntu:~/rails/github/gitwatcher$ 

有什么帮助吗?

更新:

在 heroku 日志中,我注意到两件事:

  1. 可能没关系,我不知道,...但它似乎在寻找标准的 public/javascripts 路径:

    heroku[路由器]:获取 gitwatcher.com/javascripts/application.js

  2. 比,似乎缺少缓存:

    缓存:[GET /] 未命中

...这里是一些日志:

2011-11-10T19:00:04+00:00 app[web.1]: Started GET "/" for 93.34.206.235 at 2011-11-10 19:00:04 +0000
2011-11-10T19:00:04+00:00 app[web.1]:   Processing by HomeController#index as HTML
2011-11-10T19:00:04+00:00 heroku[router]: GET gitwatcher.com/ dyno=web.1 queue=0 wait=0ms service=323ms status=200 bytes=2221
2011-11-10T19:00:04+00:00 app[web.1]: Rendered home/index.html.haml within layouts/application (3.7ms)
2011-11-10T19:00:04+00:00 app[web.1]: Completed 200 OK in 107ms (Views: 106.5ms | ActiveRecord: 0.0ms)
2011-11-10T19:00:04+00:00 app[web.1]: cache: [GET /] miss
2011-11-10T19:00:04+00:00 app[web.1]: 
2011-11-10T19:00:04+00:00 app[web.1]: 
2011-11-10T19:00:04+00:00 heroku[router]: GET gitwatcher.com/javascripts/application.js dyno=web.1 queue=0 wait=0ms service=34ms status=500 bytes=728

@RyanWilcox: ...无论如何我确认这是一个雪松堆栈:

lsoave@ubuntu:~/rails/github/gitwatcher$ heroku info --log | grep -i stack
Stack:          cedar
lsoave@ubuntu:~/rails/github/gitwatcher$ 

卢卡

【问题讨论】:

标签: ruby-on-rails heroku ruby-on-rails-3.1


【解决方案1】:

你确定确定你在雪松上吗?你检查过heroku stack 吗?

例如,在我以前的应用程序中,我确定我使用的是 cedar。 Heroku: Cedar and the asset pipeline 的文章谈到了 git push heroku ... 的回话:

准备 Rails 资产管道`

但我没有在我的应用程序中看到这一点。然后我检查了一下,我在 Bamboo...

【讨论】:

  • 我检查过,但它是 * cedar (beta) 就像假设的那样......不知道方法不要说“准备 Rails 资产管道”......
  • 另外:如果有 public/assets 文件夹(这是 Rails 创建的缓存文件夹),则资源在推送时不会编译。
【解决方案2】:

使用 mongoid 我必须从 config/application.rb 中删除 require 'rails/all'

这就是我没有看到 heroku 日志记录的方式:

-----> Preparing app for Rails asset pipeline

因为没有加载链轮。

如果您使用MongoID configuration,则必须将以下行添加到 config/application.rb

需要“sprockets/railtie”

【讨论】:

    猜你喜欢
    • 2011-12-15
    • 2011-09-13
    • 1970-01-01
    • 1970-01-01
    • 2012-04-29
    • 1970-01-01
    • 1970-01-01
    • 2019-10-27
    • 1970-01-01
    相关资源
    最近更新 更多