Rails can't start when serve_static_assets disabled in production -
the site works fine until add config.serve_static_assets = false
in production.rb. this:
demosite.com(master)$ rails_env=production rails s warning: use strings figaro configuration. false converted "false". => booting puma => rails 4.1.4 application starting in production on http://0.0.0.0:3000 => run `rails server -h` more startup options => notice: server listening on interfaces (0.0.0.0). consider using 127.0.0.1 (--binding option) => ctrl-c shutdown server exiting /users/user1/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:125:in `assert_index': no such middleware insert before: actiondispatch::static (runtimeerror) /users/user1/.rvm/gems/ruby-2.2.1/gems/actionpack-4.1.4/lib/action_dispatch/middleware/stack.rb:88:in `insert' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/configuration.rb:68:in `block in merge_into' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/configuration.rb:67:in `each' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/configuration.rb:67:in `merge_into' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/engine.rb:497:in `app' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/application/finisher.rb:36:in `block in <module:finisher>' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each' /users/user1/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!' /users/user1/documents/rails/directory-project/demosite.com/config/environment.rb:5:in `<top (required)>' /users/user1/.rvm/gems/ruby-2.2.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /users/user1/.rvm/gems/ruby-2.2.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /users/user1/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require' /users/user1/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency' /users/user1/.rvm/gems/ruby-2.2.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require' /users/user1/documents/rails/directory-project/demosite.com/config.ru:3:in `block in <main>' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/builder.rb:55:in `instance_eval' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/builder.rb:55:in `initialize' /users/user1/documents/rails/directory-project/demosite.com/config.ru:in `new' /users/user1/documents/rails/directory-project/demosite.com/config.ru:in `<main>' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/builder.rb:49:in `eval' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/builder.rb:49:in `new_from_string' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/builder.rb:40:in `parse_file' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/server.rb:277:in `build_app_and_options_from_config' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/server.rb:199:in `app' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/server.rb:50:in `app' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/server.rb:314:in `wrapped_app' /users/user1/.rvm/gems/ruby-2.2.1/gems/rack-1.5.3/lib/rack/server.rb:250:in `start' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/server.rb:69:in `start' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:81:in `block in server' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `tap' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:76:in `server' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands/commands_tasks.rb:40:in `run_command!' /users/user1/.rvm/gems/ruby-2.2.1/gems/railties-4.1.4/lib/rails/commands.rb:17:in `<top (required)>' bin/rails:8:in `require' bin/rails:8:in `<main>'
specifically in development.rb have these settings regarding assets:
# disable rails's static asset server (apache or nginx this). config.serve_static_assets = false # not fallback assets pipeline if precompiled asset missed. config.assets.compile = false # generate digests assets urls. config.assets.digest = false
any appreciated.
the problem line in engine.rb (i'm running rails engine in custom gem).
app.middleware.insert_before(::actiondispatch::static, ::actiondispatch::static, "#{root}/public")
i wrapped line if statement , working:
if rails.application.config.serve_static_assets app.middleware.insert_before(::actiondispatch::static, ::actiondispatch::static, "#{root}/public") end
Comments
Post a Comment