2014-09-15 5 views
2

После того, как вы планировали в течение многих лет в разработке, включая развертывание на Heroku, я следую Rails Bates's Railscast для развертывания в VPS (Linode) для постановки. Все развертывается гладко, единорог запускается, то выдает ошибку на любом маршруте я заказываю, а именно (это для простых страниц # приветствовать запрос):Rails Маршруты, разбитые на развертывание

Started GET "/welcome" for 108.74.161.183 at 2014-09-15 22:02:43 +0000 

ActionController::RoutingError (No route matches [GET] "/welcome"): 
    actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' 
    actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 
    railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app' 
    railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call' 
    activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged' 
    activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged' 
    activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged' 
    railties (4.0.3) lib/rails/rack/logger.rb:20:in `call' 
    actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in `call' 
    rack (1.5.2) lib/rack/methodoverride.rb:21:in `call' 
    rack (1.5.2) lib/rack/runtime.rb:17:in `call' 
    activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call' 
    actionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in `call' 
    rack (1.5.2) lib/rack/sendfile.rb:112:in `call' 
    railties (4.0.3) lib/rails/engine.rb:511:in `call' 
    railties (4.0.3) lib/rails/application.rb:97:in `call' 
    railties (4.0.3) lib/rails/railtie/configurable.rb:30:in `method_missing' 
    unicorn (4.8.2) lib/unicorn/http_server.rb:573:in `process_client' 
    unicorn (4.8.2) lib/unicorn/http_server.rb:667:in `worker_loop' 
    unicorn (4.8.2) lib/unicorn/http_server.rb:522:in `spawn_missing_workers' 
    unicorn (4.8.2) lib/unicorn/http_server.rb:533:in `maintain_worker_count' 
    unicorn (4.8.2) lib/unicorn/http_server.rb:291:in `join' 
    unicorn (4.8.2) bin/unicorn:126:in `<top (required)>' 
    /var/www/RP/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `load' 
    /var/www/RP/shared/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>' 



***** Debugger requested, but was not available (ensure the debugger gem is listed in Gemfile/installed as gem): Start server with --debugger to enable ***** 

Performance идентичен начать ли я до единорога или unicorn_rails. И когда я запускаю «рейк-маршруты» на сервере, он покорно перечисляет все маршруты, которые он должен. Помимо сбоев маршрутов, одна вещь, которую я не понимаю, - это строки, касающиеся запросов отладчика. В моем коде нет отладочных вызовов, либо в/app, либо в lib. Но я не вижу никакой связи между предупреждением отладчика (которое никогда не было проблемой до) и ошибками маршрутизации.

Я сижу здесь, вырывая волосы, потому что я не могу представить, что могло бы стать источником этой проблемы. Огромное спасибо за любые полезные предложения.

Gemfile:

source 'http://rubygems.org' 

ruby '1.9.3' 
gem 'rails', '~> 4.0' # '3.2.11' # 
# gem 'rails',  :git => 'git://github.com/rails/rails.git' 
# gem 'rails4_upgrade' 
gem 'rails_12factor', :group => [ :production, :staging ] 

# add these gems to help with the transition: 
gem 'protected_attributes' 
gem 'rails-observers' 
# gem 'actionpack-page_caching' 
# gem 'actionpack-action_caching' 

# Bundle edge Rails instead: 

gem 'pg' 

gem 'builder', '~> 3.1.0' 
gem 'draper', '~> 1.3' 
gem 'closure_tree' 
gem 'htmlentities' 
gem 'nokogiri', "~> 1.5" # "~> 1.5.3" 
gem 'will_paginate', '~> 3.0' 
gem 'newrelic_rpm' 
gem 'devise', '~> 3.1.0'      # auth, rails generate devise:install, rails generate devise MODEL 
gem 'devise_invitable', '~> 1.3.0' # git: 'git://github.com/scambra/devise_invitable.git' 
gem 'ruby-openid' 
gem 'omniauth-twitter'      
gem 'omniauth-facebook' # , '~> 1.4.0' 
gem 'omniauth-google-oauth2'      
gem 'omniauth-openid'      
gem 'declarative_authorization'  # simple auth rules/roles, create config/authorization_rules.rb, add filter_resource_access to each controller, use permitted_to? in views 
gem 'eventmachine', '~> 1.0.3' 
gem 'ruby_parser' 
gem "rmagick", "~> 2.13.2" 
gem "feedzirra", "~> 0.2" # :git => 'git://github.com/pauldix/feedzirra.git' 
gem "simple_form", :git => 'git://github.com/plataformatec/simple_form.git' # , '~> 3.0.0.beta1' 
gem 'delayed_job' # , git: 'git://github.com/collectiveidea/delayed_job.git' 
gem 'delayed_job_active_record' # , git: 'git://github.com/collectiveidea/delayed_job_active_record.git' 
gem 'daemons' 
gem 'hirefire-resource' 
# gem 'debugger', :group => [:test, :development] 
gem 'awesome_nested_set' 
gem 'redcarpet' 
gem 'content_for_in_controllers' 
gem 'youtube_addy' 
# gem 'active_model_serializers' 

gem 'exception_notification', git: 'git://github.com/smartinez87/exception_notification.git' 
# gem 'exception_notification', '~> 4.0.1', :require => 'exception_notifier' # , git: 'git://github.com/alanjds/exception_notification.git' 
group :development do 
    gem 'minitest', '~> 4.2' 
    # gem 'rspec-rails' 
    gem 'annotate', '2.5.0' 
    gem "nifty-generators" 
    gem 'log_buddy' 
    gem 'ruby-prof', '~> 0.13.0' # , :git => 'git://github.com/wycats/ruby-prof.git' 
    gem 'letter_opener' 
    gem "better_errors" 
    gem "binding_of_caller" 
    # gem "json" 
end 

gem "masonry-rails" 

group :test do 
    gem 'minitest-rails', "~> 1.0" # gem 'minitest', '~> 4.2' 
    # gem 'rspec-rails' 
    # Pretty printed test output 
    gem 'turn', :require => false 
    gem 'webrat', '~> 0.7.3' 
    gem "minitest-rails-capybara" # ...for simulating user interaction 
    # gem "guard-rspec" # ...for auto-running tests on file save 
    gem 'factory_girl_rails', "~> 4.0" 
    gem "mocha" 
    gem 'poltergeist' 
end 

gem 'coffee-rails', "~> 4.0.0" 
gem 'uglifier', '>= 1.3.0' 
# gem 'compass-rails' 
gem 'sass-rails', " ~> 4.0" 
gem 'bootstrap-sass', '~> 3.2.0' # '~> 3.1.1' 
# gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass', branch: '3' 
gem 'autoprefixer-rails' 

gem 'jquery-rails' 

# Use unicorn as the web server 
gem 'unicorn' 
gem 'unicorn-rails' 

# Deploy with Capistrano 
gem 'sshkit', '~> 1.3.0' 
gem 'capistrano' 
gem 'capistrano-rails' 
gem 'capistrano-bundler' 
gem 'capistrano-rbenv' 
# gem 'capistrano-rvm' 

routes.rb:

unless @RPRoutesLoaded 
    @RPRoutesLoaded = true 

    RP::Application.routes.draw do 

     if Rails.env.development? || Rails.env.test? 
     # IntegersController is for testing streams 
     get "integers" => 'integers#index' 
     end 
     resources :votes, :only => :create 
     post '/votes/recipes/:recipe_id' => 'votes#create', :as => "vote_recipe" 
     get 'pic_picker/new' => 'pic_picker#new' 

     get "redirect/go" 
     get '/auth/failure' => 'authentications#failure' 
     # get '/authentications/new' => 'authentications#new' 
     resources :authentications 

     devise_for :users, :skip => [ :registrations ], :controllers => { 
      :sessions => 'sessions', 
      :passwords => 'passwords', 
      :invitations => 'invitations', 
      # :registrations => 'registrations' # Had to elide this and use devise_scope to define /users/register instead of /users to create 
     } 

     match 'users', :controller=>'users', :action=>'index', :via => [:get, :post] 

     devise_scope :user do 
     post "https://stackoverflow.com/users/register" => "registrations#create", :as => "user_registration" 
     get "https://stackoverflow.com/users/sign_up" => "registrations#new", :as => "new_user_registration" 
     get "https://stackoverflow.com/users/edit" => "registrations#edit", :as => "edit_user_registration" 
     get "https://stackoverflow.com/users/cancel" => "registrations#cancel", :as => "cancel_user_registration" 
     put "/users" => "registrations#update" 
     delete "/users" => "registrations#destroy" 
     get "https://stackoverflow.com/users/sign_out" => "sessions#destroy" 
     patch "/users" => "registrations#update" 

     get "https://stackoverflow.com/users/invitation/divert" => "invitations#divert", :as => "divert_user_invitation" 
     end 

     get '/auth/:provider/callback' => 'authentications#create' 
     post '/auth/:provider/callback' => 'authentications#create' 

     # Calling 'profile' action in 'users' controller edits the current user 
     get 'users/profile' => 'users#profile' 
     # Ask a user to identify him/herself by email address 
     get 'users/identify' => 'users#identify' 
     get 'users/:id/recent' => 'users#recent' 
     get 'users/:id/collection' => 'users#collection' 
     get 'users/:id/biglist' => 'users#biglist' 
     # get 'users/:id/show' => 'users#show' 
     resources :users, :except => [ :index, :create ] do 
     member do 
      get 'collect' 
      post 'remove' 
      get 'match_friends' 
      get 'notify' 
      get 'acquire' # Acquire a recipe (etc.) 
     end 
     end 

     post '/list' => 'lists#create', :as => 'create_list' 
     resources :lists, except: [ :index, :create ] do 
     member do 
      get 'scrape' 
     end 
     end 
     match 'lists', :controller=>'lists', :action=>'index', :via => [:get, :post] 

     post '/site' => 'sites#create', :as => 'create_site' 
     resources :sites, except: [ :index, :create ] do 
     member do 
      get 'scrape' 
     end 
     end 
     match 'sites', :controller=>'sites', :action=>'index', :via => [:get, :post] 

     post '/reference' => 'references#create', :as => 'create_reference' 
     resources :references, :except => [ :index, :create ] 
     match 'references', :controller=>'references', :action=>'index', :via => [:get, :post] 

     post '/feed' => 'feeds#create', :as => 'create_feed' 
     resources :feeds, :except => [ :index, :create ] do 
     member do 
      get 'collect' # Add the feed to the current user 
      post 'remove' # Remove the feed from the current user's set 
      post 'approve' # (Admin only) approve the feed for presentation 
     end 
     end 
     match 'feeds', :controller=>'feeds', :action=>'index', :via => [:get, :post] 

     post '/tag' => 'tags#create', :as => 'create_tag' 
     resources :tags, except: [ :index, :create ] do 
     member do 
      post 'absorb' 
     end 
     collection do 
      get 'editor' 
      get 'list' 
      get 'typify' 
      get 'match' 
     end 
     end 
     match 'tags', :controller=>'tags', :action=>'index', :via => [:get, :post] 

     match 'collection', :controller=>'collection', :action=>'index', :via => [:get, :post] 
     post 'collection/update' 
     get "collection/refresh" 
     get "collection/feed" 
     get "collection/show", as: 'collection_show' 
     get "collection/new" 
     get "collection/edit" 
     post "collection/create" 
     get "collection/relist" 

     get "stream/stream" 
     get "stream/buffer_test" 
     get "iframe/create" 
     get "admin/data" 
     get "admin/control" 
     get "notifications/accept" 

     resources :thumbnails 
     resources :feedback, :only => [:new, :create] 
     resources :expressions 
     resources :referents 
     resources :ratings 
     resources :scales 

     resources :recipes do 
     resources :tags do 
      member { post 'remove', :to => 'recipes#untag' } 
     end 
     member do 
      get 'collect' 
      get 'touch' 
      get 'piclist' 
      post 'remove' 
     end 
     collection do 
      get 'capture' 
      post 'parse' 
     end 
     end 
     get '/revise', :to => 'recipes#revise' 

     # get "pages/home" 
     # get "pages/contact" 
     # get "pages/about" 
     get '/home', :to => 'pages#home' 
     get '/popup/:name', :to => 'pages#popup' 
     get '/popup', :to => 'pages#popup' 
     get '/share', :to => 'pages#share' 
     get '/contact', :to => 'pages#contact' 
     get '/about', :to => 'pages#about' 
     get '/welcome', :to => 'pages#welcome' 
     get '/faq', :to=>"pages#faq" 
     get '/admin', :to=>"pages#admin" 
     get '/mobi', :to=>"pages#mobi" 
     root :to => 'pages#root' 
    end 
    end 
+0

Только для пинков вы можете добавить свой Gemfile? –

+0

Работает ли ваша индексная страница? –

+0

'routes.rb'? Может быть полезно. –

ответ

3

Ответ: кажется, что давно я пытался memoize загрузку маршрутов, используя флаг для предотвращения выполнения кода загрузки в routes.rb более одного раза. По какой-то причине Rails решила перезагрузить их дважды в жизни этого флага, в результате чего вторая загрузка была заблокирована, в результате чего ... нет маршрутов! Речь шла не о платформе, а о среде, которая стала единственной жертвой. Я не знаю, почему маршруты перегружались при постановке, но не в разработке или производстве, но это и было источником проблемы.

Смежные вопросы