redmine plugin_assets 仍然是空的

redmine plugin_assets remains empty

Ubuntu18.04/Redmine 3.4.4/nginx

我安装了一些插件,它们本身似乎运行良好,但浏览 redmine 时出现大量 404 错误,例如:

GET http://192.168.3.12/plugin_assets/time_logger/stylesheets/time_logger.css net::ERR_ABORTED 404 (Not Found)

文件夹为空

ls -hail public/plugin_assets/
total 8.0K
923673 drwxrwxr-x 2 www-data www-data 4.0K Aug 30 08:46 .
923173 drwxr-xr-x 8 www-data www-data 4.0K Aug 30 08:46 ..
923674 -rwxrwxr-x 1 www-data www-data    0 Jan  8  2018 empty

迁移插件给出警告但没有错误:

bundle exec rake redmine:plugins:migrate RAILS_ENV=production
/usr/lib/ruby/vendor_ruby/sprockets/digest_utils.rb:47: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/digest_utils.rb:51: warning: constant ::Bignum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/processor_utils.rb:110: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/processor_utils.rb:111: warning: constant ::Bignum is deprecated
/usr/lib/ruby/vendor_ruby/builder/xchar.rb:111: warning: constant ::Fixnum is deprecated
Migrating periodictask (Redmine Periodictask plugin)...
Migrating redmine_custom_css (Redmine Custom CSS plugin)...
Migrating redmine_local_avatars (Redmine Local Avatars plugin)...
Migrating redmine_mentions (Redmine Mentions)...
Migrating redmine_messenger (Redmine Messenger)...
Migrating redmine_my_page (My Page Customization)...
Migrating redmine_theme_changer (Redmine Theme Changer plugin)...
Migrating time_logger (Time Logger)...




rake redmine:plugins:assets
/usr/lib/ruby/vendor_ruby/sprockets/digest_utils.rb:47: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/digest_utils.rb:51: warning: constant ::Bignum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/processor_utils.rb:110: warning: constant ::Fixnum is deprecated
/usr/lib/ruby/vendor_ruby/sprockets/processor_utils.rb:111: warning: constant ::Bignum is deprecated
/usr/lib/ruby/vendor_ruby/builder/xchar.rb:111: warning: constant ::Fixnum is deprecated

我确实用 nginx restartpassenger-config restart-app 重新启动了。据我了解,重新启动时应将资产复制到 plugin_assets 中,但没有发生类似情况。

production.log:

Started GET "/plugin_assets/time_logger/javascripts/time_logger.js" for 192.168.3.132 at 2019-09-02 08:20:49 +0000

ActionController::RoutingError (No route matches [GET] "/plugin_assets/time_logger/javascripts/time_logger.js"):
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:38:in `call_app'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:20:in `block in call'
  /usr/lib/ruby/vendor_ruby/active_support/tagged_logging.rb:68:in `block in tagged'
  /usr/lib/ruby/vendor_ruby/active_support/tagged_logging.rb:26:in `tagged'
  /usr/lib/ruby/vendor_ruby/active_support/tagged_logging.rb:68:in `tagged'
  /usr/lib/ruby/vendor_ruby/rails/rack/logger.rb:20:in `call'
  /usr/lib/ruby/vendor_ruby/request_store/middleware.rb:9:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/request_id.rb:21:in `call'
  /usr/lib/ruby/vendor_ruby/rack/methodoverride.rb:22:in `call'
  /usr/lib/ruby/vendor_ruby/rack/runtime.rb:18:in `call'
  /usr/lib/ruby/vendor_ruby/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  /usr/lib/ruby/vendor_ruby/action_dispatch/middleware/static.rb:120:in `call'
  /usr/lib/ruby/vendor_ruby/rack/content_length.rb:15:in `call'
  /usr/lib/ruby/vendor_ruby/rack/sendfile.rb:113:in `call'
  /usr/lib/ruby/vendor_ruby/rails/engine.rb:518:in `call'
  /usr/lib/ruby/vendor_ruby/rails/application.rb:165:in `call'
  /usr/lib/ruby/vendor_ruby/rails/railtie.rb:194:in `public_send'
  /usr/lib/ruby/vendor_ruby/rails/railtie.rb:194:in `method_missing'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'

我能做什么?

检查您是否偶尔在config/configuration.yml

中将插件的资产镜像设置为false
# Set this to false to disable plugins' assets mirroring on startup.
# You can use `rake redmine:plugins:assets` to manually mirror assets
# to public/plugin_assets when you install/upgrade a Redmine plugin.
#
#mirror_plugins_assets_on_startup: false

解决方案

我找到了一个信息here

ln -s /var/cache/redmine/default/plugin_assets 在 public 目录中,删除空的 plugin_assets 文件夹后。

这终于对我有用了。在/var/cache/redmine/default/plugin_assets中是所有资产。