【问题标题】:rails running in staging on production machine在生产机器上分段运行的轨道
【发布时间】:2011-07-02 06:37:05
【问题描述】:

我有一台机器,我的所有 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

我还能在哪里找到我将环境设置为暂存的位置?

感谢您的帮助

【问题讨论】:

  • 您如何尝试运行您的服务器? rails s -e production?
  • 它是一个apache虚拟站点,所以它在apache启动时运行。配置包括上面的乘客代码。我将为虚拟站点添加其余代码以使其更清晰。

标签: ruby-on-rails config staging


【解决方案1】:

尝试将其放入您的 &lt;VirtualHost&gt; 配置中(可能在 /etc/apache2/site-enabled/000-default 中)。

RailsEnv production
RackEnv production

我听说某些版本的 Passenger 需要 RackEnv 而不是 RailsEnv,所以您可能特别想尝试一下。

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

【讨论】:

    猜你喜欢
    • 2019-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-25
    • 1970-01-01
    • 1970-01-01
    • 2015-01-29
    • 1970-01-01
    相关资源
    最近更新 更多