undefined method `install_gem_spec_stubs'

2010-01-29 6:08 pm

在启动mongrel的时候遇到这个问题:

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  1. /usr/rails/vendor/rails/railties/lib/initializer.rb:43:in `run': undefined method `install_gem_spec_stubs' for
  2.  
  3. # (NoMethodError)
  4. from /usr/rails/config/boot.rb:46:in `load_initializer'
  5. from /usr/rails/config/boot.rb:38:in `run'
  6. from /usr/rails/config/boot.rb:11:in `boot!'
  7. from /usr/rails/config/boot.rb:110:in `'
  8. from script/server:2:in `require'
  9. from script/server:2:in `'

这个问题是ROR版本的问题,升级到最新版本即可

gem update --system
如果不明白gem请 gem --help或者 gem help examples
安装rails
gem install rails --remote

推荐(0)
收藏

rails部署之nginx+mongrel

2009-10-15 4:33 pm

ruby on rails 有几种的方式来部署,如lighttpd+fastcgi或者nginx+mongrel等等,
我这里用nginx+mongrel来做。
首先安装nginx不用说了,
然后安装mongrel-clutser,用来更好的管理mongrel cluster,

apt-get install mongrel-cluster

然后会提示在rails目录下的config目录下有mongrel_cluster.yml,配置,

  2 log_file: log/mongrel.log
  3 port: 3000
  4 pid_file: tmp/pids/mongrel.pid
  5 servers: 6

其中servers为需要开启的进程,port是起始端口,这样将开启3000, 3001,....,3005六个
mongrel进程,接下来需要用nginx来做反向代理,nginx配置非常简单,

  1 worker_processes 1;
  2 events {
  3     worker_connections 1024;
  4 }
  5
  6 http{
  7     upstream myproject {
  8         server 127.0.0.1:3000;
  9         server 127.0.0.1:3001;
 10         server 127.0.0.1:3002;
 11         server 127.0.0.1:3003;
 12         server 127.0.0.1:3004;
 13         server 127.0.0.1:3005;
 14
 15     }
 16
 17     server {
 18         listen 8080;
 19         location / {
 20             proxy_pass http://myproject;
 21         }
 22     }
 23 }

这里将“/”路径下的请求分配到6个进程中,注意myproject和http://myproject名称一致,
接下来可以测试一下,可以发现有6个进程在处理请求了。

推荐(0)
收藏