开发者

Hosting multiple sites via rails - Should I use one rails instance, or many?

开发者 https://www.devze.com 2023-03-19 12:31 出处:网络
I am building a rails app that will host multiple archery league websites.Lets call it myarchery.com, and say I have 2 sites: billsl开发者_开发知识库eague.myarchery.com and jimsleague.myarchery.com.

I am building a rails app that will host multiple archery league websites. Lets call it myarchery.com, and say I have 2 sites: billsl开发者_开发知识库eague.myarchery.com and jimsleague.myarchery.com.

Now when I build this I can either:

  • Have one rails app serve up the subdomains (basecamp style), sharing all models, etc, but putting an account attribute on everything

  • Set each account up with its own rails app instance

I prefer running them all in one instance - (B/C I can set their sites up immediately when they sign up, have a single login, etc). However, I wanted to see if there legit reason to run them independently.

I plan to run this on a Linode using apache/passenger, if that influences your answer


Using rails3, you get subdomain routing 'for free'. See http://railscasts.com/episodes/221-subdomains-in-rails-3.

I don't see why you'd need an account attribute on everything; your normal associations should allow you to determine ownership of subobjects.

Running multiple instances per subdomain might seem simpler, but you will pay a heavy price in maintenance. It just does not scale well.


I would think that if they are the same site, running one instance is fine, but if you need to brand them differently, you could benefit from splitting the bits that differ and use, say, svn externals to load in the bits that differ, such as assets and layouts.

Either way works fine, having them all in one instance makes it easier to maintain your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号