Sinatra middleware deployment issues

I have a small Sinatra application with an intermediate and production environment on the same server with Nginx running. For deployment, I use Capistrano and capistrano-ext for quick deployment in different places.

The problem is that the staging environment always runs with the production configuration specified in the app.rb file.

configure :staging do # staging settings set :foo, "bar" # will never be set to this end configure :production do # prod settings set :foo, "rab" end 

I came to the conclusion that the variable capistrano: environment in the deploy.rb file does not configure Sinatra in any way. I also tried setting ENV ["RACK_ENV"] to "set" to no avail.

configuration / expand / staging.rb

 server "10.10.100.16", :app, :web, :db, :primary => true set :deploy_to, "/var/www/staging.my_app" set :environment, "staging" set :env, "staging" ENV["RACK_ENV"] = "staging" 

Any ideas?

** Update: I have to add that I also use Passenger.

+4
source share
1 answer

setting the rack_env variable to nginx seems to do the trick.

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#RackEnv

+3
source

All Articles