<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d4684235500622716427\x26blogName\x3dCaiwangqin\x27s+blog\x26publishMode\x3dPUBLISH_MODE_HOSTED\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://blog.caiwangqin.com/search\x26blogLocale\x3dzh_CN\x26v\x3d2\x26homepageUrl\x3dhttp://blog.caiwangqin.com/\x26vt\x3d3393395200455623441', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Caiwangqin's blog

Focus on Life, Cloud Service, Smart Hardware, Architecture, Technic and beyond…

使用RubyonRails建设积木式网站架构与部署

2008年7月2日星期三


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


标签:

posted by Caiwangqin, 09:52

0 Comments:

发表评论

订阅 博文评论 [Atom]

<< 主页