Ruby 将Sinatra应用程序部署到暂存环境时出现问题
我有一个小型Sinatra应用程序,在一台运行Nginx的服务器上同时具有登台和生产环境。为了部署,我使用Capistrano和Capistrano ext轻松地部署到不同的位置 登台环境始终使用app.rb文件中指定的生产配置运行的问题Ruby 将Sinatra应用程序部署到暂存环境时出现问题,ruby,sinatra,capistrano,Ruby,Sinatra,Capistrano,我有一个小型Sinatra应用程序,在一台运行Nginx的服务器上同时具有登台和生产环境。为了部署,我使用Capistrano和Capistrano ext轻松地部署到不同的位置 登台环境始终使用app.rb文件中指定的生产配置运行的问题 configure :staging do # staging settings set :foo, "bar" # will never be set to this end configure :production do # prod
configure :staging do
# staging settings
set :foo, "bar" # will never be set to this
end
configure :production do
# prod settings
set :foo, "rab"
end
我得出结论,deploy.rb文件中的capistrano:environment变量没有以任何方式配置Sinatra。我还尝试将ENV[“RACK_ENV”]设置为“staging”,但没有效果
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"
有什么想法吗
**更新:我应该补充一点,我也在使用Passenger。在nginx中设置rack_env变量似乎可以做到这一点