2010-10-04 25 views
1

J'ai une application Ruby on Rails qui ne génère pas correctement les feuilles de style. Parfois, SASS ne compile pas le SCSS en CSS et parfois les CSS concaténés ne sont pas générés. Je reçois essentiellement une erreur d'écriture des fichiers, comme ceci:L'application Ruby on Rails ne régénère pas les feuilles de style lors du déploiement

Error Message: 
Errno::EACCES: Permission denied - /var/www/app/releases/20101004114929/public/stylesheets/cached_tutor24_tutor24-dot-ch-dot-simplificator-dot-com.css 

Where: 
pages#show 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/helpers/asset_tag_helper.rb, line 673 

Backtrace Summary: 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/helpers/asset_tag_helper.rb:673:in `initialize' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/helpers/asset_tag_helper.rb:673:in `open' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/helpers/asset_tag_helper.rb:673:in `write_asset_file_contents' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/helpers/asset_tag_helper.rb:433:in `stylesheet_link_tag' 
[PROJECT_ROOT]/app/helpers/application_helper.rb:28:in `robust_stylesheet_link_tag' 
[PROJECT_ROOT]/app/views/layouts/application.html.haml:28:in `_run_haml_app47views47layouts47application46html46haml' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/renderable.rb:34:in `send' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/renderable.rb:34:in `render_without_trace_View_path_r_2_Rendering' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/base.rb:306:in `with_template' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/renderable.rb:30:in `render_without_trace_View_path_r_2_Rendering' 
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/agent/method_tracer.rb:319:in `render' 
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/agent/method_tracer.rb:141:in `trace_execution_scoped' 
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/agent/method_tracer.rb:314:in `render' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/template.rb:205:in `render_template' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/base.rb:265:in `render_without_haml' 
[GEM_ROOT]/gems/haml-3.0.18/rails/./lib/haml/helpers/action_view_mods.rb:13:in `render' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/base.rb:352:in `_render_with_layout' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_view/base.rb:262:in `render_without_haml' 
[GEM_ROOT]/gems/haml-3.0.18/rails/./lib/haml/helpers/action_view_mods.rb:13:in `render' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:1250:in `render_for_file' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:936:in `render_without_benchmark' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:51:in `render' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:51:in `render' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:1326:in `default_render' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:1332:in `perform_action_without_filters' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/filters.rb:617:in `call_filters' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/rescue.rb:160:in `perform_action_without_flash' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/flash.rb:151:in `perform_action_without_newrelic_trace' 
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/control/./agent/instrumentation/controller_instrumentation.rb:254:in `perform_action' 
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/agent/method_tracer.rb:141:in `trace_execution_scoped' 
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/control/./agent/instrumentation/controller_instrumentation.rb:247:in `perform_action' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:532:in `send' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:532:in `process_without_filters' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/filters.rb:606:in `process' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:391:in `process' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/base.rb:386:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/routing/route_set.rb:438:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:87:in `dispatch' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:121:in `_call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack' 
[GEM_ROOT]/gems/haml-3.0.18/rails/./lib/sass/plugin/rack.rb:41:in `call' 
[GEM_ROOT]/gems/haml-3.0.18/rails/./lib/sass/plugin/rack.rb:41:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/string_coercion.rb:25:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/params_parser.rb:15:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/session/abstract_store.rb:177:in `call' 
[GEM_ROOT]/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:29:in `call' 
[GEM_ROOT]/gems/activerecord-2.3.9/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache' 
[GEM_ROOT]/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:9:in `cache' 
[GEM_ROOT]/gems/activerecord-2.3.9/lib/active_record/query_cache.rb:28:in `call' 
[GEM_ROOT]/gems/activerecord-2.3.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/failsafe.rb:26:in `call' 
[GEM_ROOT]/gems/actionpack-2.3.9/lib/action_controller/dispatcher.rb:106:in `call' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb:252:in `safe_fork' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:352:in `__send__' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:352:in `main_loop' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:163:in `start' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb:222:in `start' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb:145:in `spawn_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:352:in `__send__' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:352:in `main_loop' 
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously' 

L'ensemble/var/www/app est définie appartenir à www-data: www-data avec des autorisations ug + rwx, deux ou trois fois à déployer le temps.

Même après le déploiement, je peux aller vérifier les autorisations et ils sont très bien:

# ls -la current/public/stylesheets/ 
total 92 
drwxrwxr-x 2 www-data www-data 4096 Oct 4 14:11 ./ 
drwxrwxr-x 6 www-data www-data 4096 Oct 4 13:49 ../ 

et il ne parvient toujours à créer (ou lire les fichiers).

Des idées sur ce qui pourrait se passer?

Répondre

1
  1. Le serveur Web fonctionne-t-il réellement en tant qu'utilisateur www-data?
  2. N'existe-t-il pas d'erreurs FS? (dmesg)
  3. Est-ce que le lien symbolique 'actuel' pointe vers le même répertoire sous 'releases' qui est montré dans trace? Que se passe-t-il si vous modifiez les permissions sur les current/public/stylesheets en 777?
+0

1: oui, il le fait; J'ai vérifié juste au cas où. Je vais travailler les 2, 3 et 4 demain quand je serai de retour au bureau. Merci d'avoir répondu. – Pablo

+0

2: il n'y a pas d'erreurs de système de fichiers. 3: Oui, c'est le même répertoire. 4: J'ai ajouté cela à notre processus de déploiement, et il a commencé à travailler, je l'ai supprimé, et il a continué à travailler ... donc pas sûr. – Pablo

1
+0

Eh bien, il devrait fonctionner comme www-data car c'est le propriétaire de config/environment.rb. Pendant une courte période de temps, le propriétaire est root et en effet le passager fonctionne en tant que root bien que la documentation indique qu'il ne fonctionnera jamais en tant que root. – Pablo

+0

Phusion Passenger peut exécuter certains processus d'assistance internes en tant que root mais l'application elle-même, par ex. tous les processus "Rails: ..." et "Rack: ..." ne sont jamais exécutés en tant que root. Que font-ils en fonction de ps? – Hongli