在生产机器上进行分段运行的导轨

时间:2011-07-02 06:37:05

标签: ruby-on-rails config staging

我有一台机器,我的所有rails应用程序都在“临时”环境中运行,甚至是生产环境。它正在尝试连接到临时数据库。我已经尝试将它设置为以下位置的生产:

#/etc/apache2/mods-enabled/passenger.so: 
# the line above was wrong, it is in /etc/apache2/sites-enabled/ier

RailsBaseURI /ier
RailsEnv production
<Directory /rails/production/ier/current/public>
  Options -MultiViews
</Directory>

#app/controllers/application_controller.rb
Rails.env = 'production'

我甚至试过把它放进去:

#config/environment.rb adding Rails.env = 'production'

我的乘客错误是:

staging database is not configured (ActiveRecord::AdapterNotSpecified)

我甚至跑了(grep -R“staging”.in)并得到了:

Binary file ./.git/index matches
./config/deploy.rb:set :stages, %w(staging production)
./config/deploy.rb:#    %w{staging.rb}.each do |config|
./config/deploy.rb:#    %w{production.rb staging.rb}.each do |deploy_env|
./config/database.yml:staging:
grep: ./config/deploy/staging.rb: No such file or directory
grep: ./config/deploy/production.rb: No such file or directory

我正在运行Apache2,Passenger 3.0.7,ruby 1.9.2和rails 3.0.9

在哪里可以找到我将环境设置为分段的位置?

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

尝试将其放入<VirtualHost>配置(可能在/etc/apache2/site-enabled/000-default)。

RailsEnv production
RackEnv production

我听说有些版本的Passenger需要RackEnv而不是RailsEnv,所以你可能想特别试试。

如果.htaccess设置为AllowOverrideOptions,您也可以尝试将其放入公共目录中的All文件中。