如何让Phusion Passenger,MySQL和Rails在制作中发挥出色

Jas*_*ler 4 ruby mysql ruby-on-rails passenger

我写了一个rails应用程序,在没有数据库的情况下运行了一段时间.现在,我正在将注册数据库放入混合中.它不适用于生产.当然,在我的Mac上,一切正常.

这是生产环境: - Ubuntu Hardy - Phusion Passenger - Rails 2.3.2

机器上的MySQL运行正常.

我有database.yml文件,其中包含正确的信息.我可以毫无问题地运行迁移:

rake db:migrate RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)

数据库正在正确更新.

所以,我点击了tmp/restart并点击了网站.我得到了500错误,但没有写入生产日志(很奇怪).所以,我检查了apache日志,我收到了这条消息:

!捆绑的mysql.rb驱动程序已从Rails 2.2中删除.请安装mysql gem并再试一次:gem install mysql.

我已经安装了MySQL gem(版本2.7).我仍然收到这个错误.

当我将生产数据库配置更改为指向虚拟sqlite数据库时,一切正常.当我将其更改回MySQL配置时,我收到相同的错误消息.

我完全没有想法,我希望它能奏效.我把头发拉了出来,我非常感谢你提供的任何帮助.我已经包含了我能想到的所有内容,但如果有更多信息有用,请告诉我.

谢谢!

贾森

Jas*_*ler 8

弄清楚了.呜呜!

简介:Ruby Enterprise Edition(更新,感谢Hongli!)拥有自己的一组宝石.即使我正在更新宝石,它也不是乘客正在阅读的宝石.

这是我如何计算出来的:

>> /usr$ whereis gem

gem: /usr/bin/gem /usr/bin/gem1.8 /opt/ruby-enterprise-1.8.6-20090201/bin/gem

>> /usr$ cd /opt/ruby-enterprise-1.8.6-20090201/bin/

>> /opt/ruby-enterprise-1.8.6-20090201/bin$ ls -l

total 2624
-rwxr-xr-x 1 root root    3907 2009-03-26 14:47 erb
-rwxr-xr-x 1 root root     813 2009-03-26 14:47 gem
-rwxr-xr-x 1 root root     349 2009-03-26 14:47 irb
-rwxr-xr-x 1 root root     386 2009-03-26 14:47 passenger-config
-rwxr-xr-x 1 root root     402 2009-03-26 14:47 passenger-install-apache2-module
-rwxr-xr-x 1 root root     396 2009-03-26 14:47 passenger-make-enterprisey
-rwxr-xr-x 1 root root     392 2009-03-26 14:47 passenger-memory-stats
-rwxr-xr-x 1 root root     392 2009-03-26 14:47 passenger-spawn-server
-rwxr-xr-x 1 root root     386 2009-03-26 14:47 passenger-status
-rwxr-xr-x 1 root root     391 2009-03-26 14:47 passenger-stress-test
-rwxr-xr-x 1 root root     366 2009-03-26 14:47 rackup
-rwxr-xr-x 1 root root     367 2009-03-26 14:47 rails
-rwxr-xr-x 1 root root     364 2009-03-26 14:47 rake
-rwxr-xr-x 1 root root    1560 2009-03-26 14:47 rdoc
-rwxr-xr-x 1 root root      64 2009-03-26 14:46 ree-version
-rwxr-xr-x 1 root root    1516 2009-03-26 14:47 ri
-rwxr-xr-x 1 root root 2609905 2009-03-26 14:46 ruby
-rwxr-xr-x 1 root root     178 2009-03-26 14:47 testrb

>> /opt/ruby-enterprise-1.8.6-20090201/bin$ ./gem list

*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
fastthread (1.0.5)
passenger (2.1.2)
postgres (0.7.9.2008.01.28)
rack (0.9.1)
rails (2.3.2)
rake (0.8.4)
sqlite3-ruby (1.2.4)

>> /opt/ruby-enterprise-1.8.6-20090201/bin$ ./gem install mysql

Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed
Run Code Online (Sandbox Code Playgroud)

然后,我重新启动了实例,它工作正常.


Hon*_*gli 5

@Jason Butler:我没有足够的声誉来评论,所以我会把它作为答案发布.

不是Phusion Passenger拥有自己的宝石,而是Ruby Enterprise Edition.这实际上是记录在案的,其原因解释如下:http://www.rubyenterpriseedition.com/documentation.html#_how_ree_installs_itself_into_the_system