lundi 22 juin 2015

Rails 4 - NO CSS on production server

We have this strange problem with assets for our Rails 4.2.0 app. The CSS is fine in development and live compilation on production (config.assets.compile = true). But there is NO CSS after assets precompile on production server:

RAILS_ENV=production bundle exec rake assets:clean assets:precompile RAILS_RELATIVE_URL_ROOT=/mysuburi

There is no error in precompile and here are the files under public/assets:

-rw-rw-r-- 1 ubuntu ubuntu 385054 Jun 22 00:25 application-2baaa11c334b4d3babfdf9ef2805de93.js
-rw-rw-r-- 1 ubuntu ubuntu 108205 Jun 22 00:25 application-2baaa11c334b4d3babfdf9ef2805de93.js.gz
-rw-rw-r-- 1 ubuntu ubuntu   3622 Jun 13 01:26 application-d5ed8ccf82d536a6438fc4d9ec872407.css
-rw-rw-r-- 1 ubuntu ubuntu    996 Jun 13 01:26 application-d5ed8ccf82d536a6438fc4d9ec872407.css.gz
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 authentify
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 banquet_coursex
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 banquetx
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 biz_workflowx
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 commonx
-rw-rw-r-- 1 ubuntu ubuntu  23320 Jun 13 01:26 glyphicons-halflings-regular-3348022530037ee257256d4a9f1deac5.woff
-rw-rw-r-- 1 ubuntu ubuntu  20335 Jun 13 01:26 glyphicons-halflings-regular-5cc7f3b91ad7b47947e11514eae4b44e.eot
-rw-rw-r-- 1 ubuntu ubuntu  41280 Jun 13 01:26 glyphicons-halflings-regular-63fc0d7eea1f7cf2b6e8696ffb7bc83e.ttf
-rw-rw-r-- 1 ubuntu ubuntu  62926 Jun 13 01:26 glyphicons-halflings-regular-ff3e6d7867d7162f8531ba867cf354f9.svg
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 jquery-ui
-rw-rw-r-- 1 ubuntu ubuntu  12346 Jun 22 22:33 manifest-04f60cb489f7e161973b51f026287385.json
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 searchx
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 state_machine_logx
drwxrwxr-x 2 ubuntu ubuntu   4096 Jun 22 22:33 user_manualx

application-xxx.css and manifest-xxx.json are there. In Gemfile, the version of sprockets and tilt are set to:

gem 'sprockets', '2.12.3'
gem 'tilt', '~>1.4.1'

Here is the production.rb:

config.cache_classes = true config.eager_load = true config.consider_all_requests_local = false config.action_controller.perform_caching = true config.serve_static_files = false #ENV['RAILS_SERVE_STATIC_FILES'].present? config.assets.compress = true config.assets.js_compressor = :uglifier config.assets.compile = false config.assets.digest = true config.log_level = :debug config.i18n.fallbacks = true config.active_support.deprecation = :notify config.log_formatter = ::Logger::Formatter.new config.active_record.dump_schema_after_migration = false

We tried clean cache with assets:clean a few times with no avail. There are only a few values we can change for the assets. We have rolled back the version of sprockets to fix the problem in assets precompile. We have the default setup about assets location (public/assets) and application-xxx.csss file is there. What else could be wrong with CSS? Thanks.

Aucun commentaire:

Enregistrer un commentaire