我在暂存/产品环境中将relative_url_root用于应用程序以部署到子目录。我最近开始将resque用于活动作业,并实现了resque-web前端来查看重新排序的作业队列。当用户单击链接时,resque网站主页上的所有链接均不遵守relative_url_path。
config.action_controller.relative_url_root = /metric
当我们单击resque网站上的“工作任务”链接时。它正在渲染/resque_web/working
而不是/metric/resque_web/working
,这会使链接断开。
有什么想法吗?
答案 0 :(得分:0)
对我有用的是:
在 config/routes.rb
中安装 ResqueWeb,如下所示:
require "resque_web"
Rails.application.routes.draw do
mount ResqueWeb::Engine => "/resque/"
root 'resque_web/overview#show'
end
在 config/application.rb
中设置相对 URL 根:
config.relative_url_root = '/resque'
更新 Nginx 配置如下
location ~ ^/resque/(.*|$) {
alias /home/ravi/ws/ror/resque-web/public$1;
passenger_app_root /home/ravi/ws/ror/resque-web;
passenger_document_root /home/ravi/ws/ror/resque-web/public;
passenger_enabled on;
passenger_app_env development;
}
resque 仪表板上的每个链接都以前缀 /resque 生成,例如/resque/workers
指向工人列表,即 resque_web/workers#index
我的 rake 路由输出是:
Prefix Verb URI Pattern Controller#Action
resque_web /resque ResqueWeb::Engine
root GET / resque_web/overview#show
Routes for ResqueWeb::Plugins::ResqueScheduler::Engine:
schedules GET /schedule(.:format) resque_web/plugins/resque_scheduler/schedules#index
requeue POST /schedule/requeue(.:format) resque_web/plugins/resque_scheduler/schedules#requeue
requeue_with_params POST /schedule/requeue_with_params(.:format) resque_web/plugins/resque_scheduler/schedules#requeue_with_params
schedule DELETE /schedule(.:format) resque_web/plugins/resque_scheduler/schedules#destroy
delayed GET /delayed(.:format) resque_web/plugins/resque_scheduler/delayed#index
delayed_job_class GET /delayed/jobs/:klass(.:format) resque_web/plugins/resque_scheduler/delayed#jobs_klass
delayed_search POST /delayed/search(.:format) resque_web/plugins/resque_scheduler/delayed#search
timestamp GET /delayed/:timestamp(.:format) resque_web/plugins/resque_scheduler/delayed#timestamp
queue_now POST /delayed/queue_now(.:format) resque_web/plugins/resque_scheduler/delayed#queue_now
cancel_now POST /delayed/cancel_now(.:format) resque_web/plugins/resque_scheduler/delayed#cancel_now
clear POST /delayed/clear(.:format) resque_web/plugins/resque_scheduler/delayed#clear
Routes for ResqueWeb::Engine:
resque_web_plugins_resque_scheduler /scheduler ResqueWeb::Plugins::ResqueScheduler::Engine
overview GET /overview(.:format) resque_web/overview#show
working_index GET /working(.:format) resque_web/working#index
clear_queue PUT /queues/:id/clear(.:format) resque_web/queues#clear {:id=>/[^\/]+/}
queues GET /queues(.:format) resque_web/queues#index
queue GET /queues/:id(.:format) resque_web/queues#show {:id=>/[^\/]+/}
DELETE /queues/:id(.:format) resque_web/queues#destroy {:id=>/[^\/]+/}
workers GET /workers(.:format) resque_web/workers#index
worker GET /workers/:id(.:format) resque_web/workers#show {:id=>/[^\/]+/}
retry_failure PUT /failures/:id/retry(.:format) resque_web/failures#retry
retry_all_failures PUT /failures/retry_all(.:format) resque_web/failures#retry_all
destroy_all_failures DELETE /failures/destroy_all(.:format) resque_web/failures#destroy_all
failures GET /failures(.:format) resque_web/failures#index
failure GET /failures/:id(.:format) resque_web/failures#show
DELETE /failures/:id(.:format) resque_web/failures#destroy
stats GET /stats(.:format) resque_web/stats#index
stats_resque GET /stats/resque(.:format) resque_web/stats#resque
stats_redis GET /stats/redis(.:format) resque_web/stats#redis
stats_keys GET /stats/keys(.:format) resque_web/stats#keys
keys_statistic GET /stats/keys/:id(.:format) resque_web/stats#keys {:id=>/[^\/]+/}
root GET / resque_web/overview#show