如图所示,在中间的 Application 层,在不同的时间段,我们使用了不同版本的 Rails 开发了不同的功能模块。虽然 best practices 是将 Rails 版本 update to date , 但实际工作中可能由于具体业务使用了特定的部件使 update to date 变得不太容易。当新的Rails版本出来后,开发新的一个功能时,我们也不希望继续在旧的Rails版本上开发,于是我们采用了如图所示的积木式网站架构。
附 Nginx 的部署方式如下,以下示例中 app1,app2 使用 Rails1.2.3, app3 使用 Rails2.1, 启动 app3 的 mongrel 需要使用 prefix 选项:
mongrel_rails mongrel::start --prefix /app3 -p 5001
mongrel_rails mongrel::start –prefix /app3 -p 5002
nginx.conf:
user www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
upstream mongrel_cluster1 {
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
upstream mongrel_cluster2 {
server 127.0.0.1:4001;
server 127.0.0.1:4002;
}
upstream mongrel_cluster3 {
server 127.0.0.1:5001;
server 127.0.0.1:5002;
}
server {
listen 127.0.0.1:80 default deferred;
location /app1/ {
proxy_pass http://mongrel_cluster1/;
}
location /app2/ {
proxy_pass http://mongrel_cluster2/;
}
location /app3/ {
proxy_pass http://mongrel_cluster3/app3/;
}
}
}
Tags:






八月 28th, 2008 at 9:24 am
鉴权信息如何共享?
比如几个模块都是需要登录的,用户鉴权如何实现?
八月 28th, 2008 at 9:28 am
将session 存在 memcached 中
八月 28th, 2008 at 9:54 am
如果是基于CookieStore的session存贮机制呢?
可以直接访问不?
九月 3rd, 2008 at 8:00 pm
应该可以,只要是共享Session的方式,都可以。