Jul
02

如图所示,在中间的 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/;
}
}
}

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg

Tags:

3 Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>