Coder Social home page Coder Social logo

Comments (3)

sosedoff avatar sosedoff commented on July 30, 2024

@masterkain im not sure where is this supposed to go

from capistrano-unicorn.

masterkain avatar masterkain commented on July 30, 2024

-N is a special option that can go as the last parameter, if set, during unicorn/rainbows startup: it tells to not load any default middleware in the stack. It can be used to manually load Rack::ContentLength and Rack::Chunked instead of relying on the correct -E option.

The -E option corresponds to RACK_ENV, but the effective values are 'deployment', 'none' and 'development'.

#  RACK ENVIRONMENT

Accepted values of RACK_ENV and the middleware they automatically load
(outside of RACKUP_FILE) are exactly as those in rackup(1):

* development - loads Rack::CommonLogger, Rack::ShowExceptions, and
                Rack::Lint middleware
* deployment  - loads Rack::CommonLogger middleware
* none        - loads no middleware at all, relying
                entirely on RACKUP_FILE

All unrecognized values for RACK_ENV are assumed to be
"none".  Production deployments are strongly encouraged to use
"deployment" or "none" for maximum performance.

Note the Rack::ContentLength and Rack::Chunked middlewares are also
loaded by "deployment" and "development", but no other values of
RACK_ENV.  If needed, they must be individually specified in the
RACKUP_FILE, some frameworks do not require them.

-N, \--no-default-middleware
:   Disables loading middleware implied by RACK_ENV.  This bypasses the
    configuration documented in the RACK ENVIRONMENT section, but still
    allows RACK_ENV to be used for application/framework-specific purposes.

So in production if someone wants the two content middleware loaded, it has to specify an app_env as 'deployment', but this will also tell rails that the environment is 'deployment', while it is really production, staging, etc.

AFAIK the -N switch eliminates default middlewares without interfering with RACK_ENV.

from capistrano-unicorn.

aspiers avatar aspiers commented on July 30, 2024

@masterkain is right. This issue is essentially a very well disguised duplicate of #46. I have just been looking into #46, and independently found that capistrano-unicorn incorrectly assumes that values like staging and production are valid choices for the app_env variable, since it defaults app_env to whatever rails_env is. This is totally wrong, and will result in Rack::CommonLogger not ever being loaded for Rails staging and production environment (unless the user happens to realise this and manually set app_env to deployment).

I will produce a pull request to fix this mess. :) It will rename app_env to rack_env for maximum clarity, and bump the version to 0.2.0. It will also choose a sensible default according to rails_env, based on the recommendations from the unicorn docs quoted above.

from capistrano-unicorn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.