Luca G. Soave
Luca G. Soave

Reputation: 12699

Can't make Rails 3.1.1 asset pipeline working on Heroku Cedar deploy

I've followed Rails 3.1 on Heroku Cedar tutorial, as well as another half a dozen articles, but can't make it working.

The app just don't have any CSS/js available after pushing on Heroku.

Push doesn't seem to get any error compiling and injecting 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 [email protected]:gitwatcher.git
 + 6033342...d6921f3 master -> master (forced update)
lsoave@ubuntu:~/rails/github/gitwatcher$ 

Any help?

UPDATE:

in heroku logs, I noticed two things:

  1. May be that's ok, i don't know, ... but it seems to look for a standard public/javascripts path:

    heroku[router]: GET gitwatcher.com/javascripts/application.js

  2. than, it seems missing cache:

    cache: [GET /] miss

... here a snap of logs:

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: ... anyway I confirm that is a cedar stack:

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

Luca

Upvotes: 0

Views: 588

Answers (2)

Luca G. Soave
Luca G. Soave

Reputation: 12699

Using mongoid I had to remove require 'rails/all' from config/application.rb,

that's way I didn't see heroku logging :

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

because sprockets was not being loaded.

If you use MongoID configuration you've to add the following line to config/application.rb :

require "sprockets/railtie"

Upvotes: 0

RyanWilcox
RyanWilcox

Reputation: 13972

Are you sure sure sure you're on cedar? Did you check with heroku stack ?

For example, in a previous app of mine I was sure I was on cedar. The Heroku: Cedar and the asset pipeline article talks about git push heroku ... saying something back like:

Preparing Rails asset pipeline`

But I didn't see that in my app. Then I checked, and I was on Bamboo...

Upvotes: 3

Related Questions