【问题标题】:Deploying a Rails application on apache在 apache 上部署 Rails 应用程序
【发布时间】:2010-09-29 10:20:22
【问题描述】:

我已经构建了一个在后端与 mysql 交互的小型应用程序。当我在 mongrel 服务器上运行时,它运行良好。 我想在 apache 服务器上运行这个应用程序。 该应用程序是一个 Rails 应用程序 操作系统是opensolaris 我尝试在 apache 中修改 httpd.conf 并添加以下行。

LoadModule passenger_module /var/ruby/1.8/gem_home/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
   PassengerRoot /var/ruby/1.8/gem_home/gems/passenger-2.2.15
   PassengerRuby /usr/ruby/1.8/bin/ruby

<VirtualHost *:80>
      ServerName sampleapp.com
      DocumentRoot /export/home/gaurav/test/sample_app/public
    <Directory /export/home/gaurav/test/sample_app>
      AllowOverride ALL
      Order allow,deny
      Allow from all
     </Directory>
   </VirtualHost>`

但是我得到一个数据库错误。我检查日志文件是否显示错误代码 500

【问题讨论】:

  • 你配置好你的生产数据库了吗?
  • 请问您的日志可以吗?
  • 同一个应用程序正在使用 mogrel。所以我猜必须配置生产数据库。但我仍然检查了 database.yml 文件,那里一切都很好。
  • 状态:500 内部服务器错误未知数据库“sample_prod”/var/ruby/1.8/gem_home/gems/activerecord-2.3.8/lib/active_record/connection_adapters/mysql_adapter.rb:619:in @ 987654322@connect' /var/ruby/1.8/gem_home/gems/activerecord-2.3.8/lib/active_record/connection_adapters/mysql_adapter.rb:203:in 'initialize' /var/ruby/1.8/gem_home/gems/activerecord- 2.3.8/lib/active_record/conne.......................................
  • 我想问一下,当我什至数据库“sample_prod”不存在时,rails applicationo 如何在 mogrel 上运行而不是在 apache 中运行,我什至不需要它。但是当我从数据库中删除它时.yml 文件给出了一些生产 d/b 缺失的错误

标签: ruby-on-rails deployment apache2 config


【解决方案1】:

您需要在您的 db/database.yml 文件中定义一个生产数据库,并使用所有迁移创建此数据库

RAILS_ENV=production rake db:create
RAILS_ENV=production rake db:migrate

或者如果你真的不想使用生产环境,你可以在你的乘客配置上改变它

【讨论】:

  • 嗨 shingara ..RAILS_ENV=production rake db:create 命令有效..但是当我运行下一个命令时,它给出了。(在 /usr/home/gaurav/demo/sample_app 中)rake 中止了!密码不是模块
  • 这是另一个问题。我想密码在我们的 Gem 或您的代码中。
猜你喜欢
  • 1970-01-01
  • 2012-03-24
  • 2012-07-12
  • 1970-01-01
  • 2010-10-04
  • 1970-01-01
  • 2018-11-01
  • 2012-12-20
  • 1970-01-01
相关资源
最近更新 更多