Multiple sites sharing a single application

Quick question:

Say i have a few shopping sites that i want to run on the same
application code but have seperate databases and layout/design, what
would be the neatest ‘Rails’ way of doing this?

Cheers,

Steve

Stephen B. wrote:

Quick question:

Say i have a few shopping sites that i want to run on the same
application code but have seperate databases and layout/design, what
would be the neatest ‘Rails’ way of doing this?

The Rails way would be to not have different databases… but access
specific data within scope. The reason behind this is that its much
easier to maintain one database schema than multiple ones and trying to
keep those in sync with each other… especially if one instance of the
application is doing all the heavy lifting.

-Robby

Stephen B. wrote:

Quick question:

Say i have a few shopping sites that i want to run on the same
application code but have seperate databases and layout/design, what
would be the neatest ‘Rails’ way of doing this?

Cheers,

Steve

Sounds a little like a job for SVN branches. You could keep your models
in the trunk and branch the controllers and views, or at least just the
views. This would be a quick and dirty way to implement a quick “themes”
system for your application.

As far as running entirely separate instances of the application, I
would suggest using several databases. If they’re not truly the “same”
application, then keeping all that data together and adding some sort of
scope is just going to complicate things. Other than their base
software, these different sites are really separate, so make it easy on
yourself and deploy it that way.

I think that makes more sense. This would allow for the sites to
‘split’ from the common application if one site needed to add additional
bespoke componants. The main reason for maintaining the core codebase
was for code management - i just wouldn’t want to have to bug fix across
3 different places.

Cheers,

Steve

Bryan D. wrote:

Stephen B. wrote:

Quick question:

Say i have a few shopping sites that i want to run on the same
application code but have seperate databases and layout/design, what
would be the neatest ‘Rails’ way of doing this?

Cheers,

Steve

Sounds a little like a job for SVN branches. You could keep your models
in the trunk and branch the controllers and views, or at least just the
views. This would be a quick and dirty way to implement a quick “themes”
system for your application.

There is also the svn:externals
(Externals Definitions) solution :
A. create an application framework without the modified parts (probably
CSS, config and views)
B. checkout this app for each site
C. set an svn:external on each of these directories to point to the code
for each specific site. Example:

svn propset svn:externals ‘app/views’ “svn://example.com/site1/views”

“views”
D. svn up will update code in both app and site specific code. svn
status will tell you to do svn ci into ‘views’ if needed.