masukomi / mobtvse

Working towards being the worlds best Markdown blogging app...
http://mobtvse.com
Apache License 2.0
45 stars 2 forks source link

/admin 500 errors when run in production #39

Open jdoss opened 11 years ago

jdoss commented 11 years ago

If run in production mode with Nginx and Passenger /admin barfs out a 500 error:

Started GET "/admin" for xxx.xxx.xxx.xxx at 2012-11-10 23:02:34 -0600
Processing by PostsController#admin as HTML
  Rendered posts/_li.html.haml (0.0ms)
  Rendered posts/_li.html.haml (0.0ms)
  Rendered posts/admin.html.haml within layouts/admin (2.3ms)
Completed 500 Internal Server Error in 50ms

ActionView::Template::Error (File to import not found or unreadable: bourbon.
Load path: /home/user/app/mobtvse
  (in /home/user/app/mobtvse/app/assets/stylesheets/posts.css.scss)):
    14:             =stylesheet_link_tag 'kudos' 
    15:         /= stylesheet_link_tag 'normalize' 
    16:         = stylesheet_link_tag 'embed' 
    17:         = stylesheet_link_tag 'posts' 
    18:         = stylesheet_link_tag 'fonts/font-awesome' 
    19:         = stylesheet_link_tag 'admin'
    20:         = stylesheet_link_tag 'flexgraph'
  app/assets/stylesheets/posts.css.scss:1
  app/views/layouts/admin.html.haml:17:in `_app_views_layouts_admin_html_haml___446462920088281360_32510360'
  app/controllers/posts_controller.rb:117:in `admin'

Forcing Mobtvse to run in Development mode produces no such error.

masukomi commented 11 years ago

interesting. it's been working fine on my branch. I'll attack this tonight. Sorry about the delayed response. installing the bourbon gem should address this. but I'll test it before making any commits.

jdoss commented 11 years ago

Not sure if this helps but Bourbon is showing as installed.

[user@server mobtvse]$ bundle show bourbon
/usr/lib64/ruby/gems/1.9.1/gems/bourbon-2.0.0.rc1
masukomi commented 11 years ago

I was able to replicated this in production mode with thin.

I've addressed it by copying the bourbon assets to the app/assets/stylesheets directory along with a path change to its import in app/assets/stylesheets/posts/admin.css.scss

I've pushed these changes to the experimental branch.

Can you please confirm that this fixes the issue for you? If so I'll push them to master and then close this issue.

On a related note... Heroku seems to handle the current state of things without issue. I have no explanation for why it works on Heroku but not elsewhere.

jdoss commented 11 years ago

I can confirm that this bug is fixed with your changes to the experimental branch. Thanks!

jdoss commented 11 years ago

Getting what looks to be the same error on editing a post using the experimental branch.

  Rendered posts/edit.html.haml within layouts/admin (33.9ms)
Completed 500 Internal Server Error in 101ms

ActionView::Template::Error (File to import not found or unreadable: bourbon.
Load path: /home/user/app/mobtvse
  (in /home/user/app/mobtvse/app/assets/stylesheets/posts/edit.css.scss)):
    18:         = stylesheet_link_tag 'fonts/font-awesome' 
    19:         = stylesheet_link_tag 'admin'
    20:         = stylesheet_link_tag 'flexgraph'
    21:         = stylesheet_link_tag "#{controller.controller_name}/#{params[:action]}" if Obtvse::Application.assets.find_asset("#{controller.controller_name}/#{params[:action]}.css") 
    22:         = javascript_include_tag "#{controller.controller_name}/#{params[:action]}" if Obtvse::Application.assets.find_asset("#{controller.controller_name}/#{params[:action]}.js") 
    23:         -if @post and params[:action]=='edit'
    24:             / special case for supporting markpad
  app/assets/stylesheets/posts/edit.css.scss:1
  app/views/layouts/admin.html.haml:21:in `_app_views_layouts_admin_html_haml___2822435683135925036_6715380'
  app/controllers/posts_controller.rb:173:in `edit'
masukomi commented 11 years ago

grr. I'll poke it this evening if you don't manage to solve it first.

Sorry for these complications. I wish i understood why it works without fault on Heroku (in production mode) but not locally in production mode... something about how / when the gem is loaded?

masukomi commented 11 years ago

updated experimental. was just a path change in the app/assets/stylesheets/posts/edit.css.scss

It doesn't look like this should show up anywhere else.

I'm having a little trouble testing this in production mode locally because something keeps going awry with the built-in javascript compression, but I have been able to tweak things enough to replicate this particular error and then make it go away.