Problems deploying Sinatra app to staging environment

Posted by chris on Stack Overflow See other posts from Stack Overflow or by chris
Published on 2012-06-22T21:14:48Z Indexed on 2012/06/22 21:15 UTC
Read the original article Hit count: 169

Filed under:
|
|

I have a small Sinatra app with both a staging and production environment on a single server with running Nginx. To deploy I am using Capistrano and capistrano-ext to easily deploy to different locations.

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

configure :staging do
  # staging settings
  set :foo, "bar"
end

configure :production do
  # prod settings
  set :foo, "rab"
end

I have come to the conclusion that the capistrano :environment variable within the deploy.rb file doesn't config Sinatra in any way. I have also tried setting the ENV["RACK_ENV"] to "staging" to no avail.

config/deploy/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?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about sinatra