• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scalable architecture

Surely, the title is only correct in reflecting my ignorance.

Some of my work involves writing code for schools and universities to manage certain student activities. As each school hires me, I recycle code from previous projects and get them on their way.

I have come to a point when I'm considering creating a website and delivering the entire thing as a service. In other words, right the code out once (or most of it, anyway) and then add schools (and their students) as they come.

My question is probably stupid but, how do I handle several schools at once? Do I write a controller for each? After all, most of the code will be the same while certain parts will be customized for each school. And how about database architecture? One database per customer seems a bit of a waste (one school ~= 1,000 students). Does this make any sense?

I've searched the forums but without luck. My mistake, no doubt.

Any help is appreciated. Thank you guys.

hi txomin,

rather than write a controller for each school i would:
1. have a single code base so when you make changes, fix bugs and add features it is available to all sites
2. symlink each site back to the master codebase
(the above assumes you're hosting them all on the same server and something like virtual hosts)

as for databases, i'd say keeping them separate will probably save headaches in the future.

of course, there are other approaches. i used something like what i describe above recently with a bash script to create each new site 'instance' and database and it saved alot of headaches.

good luck!

Thank you very much for the reply.

I understand point 1 and the issue of separate databases.

I apologize but I have no idea what "symlink" or virtual hosts are.

Scalability is an interesting topic; there are many different approaches to it.

I am in the middle of a web project at the moment that provides a stock management service to wineries. One option for this project was to create the software and sell it to the wineries, but we decided on creating a centralised multi-user web service instead.

Everything in this project is done using one website, and one database. This allows us to modify code whenever we see fit, and never have to re-distribute the software or offer updates/patches. We can even change the structure of the database if necessary. The key to making this project work has been good, efficient database design.

You could quite easily treat each school as a user with a profile, settings, user level, etc. Build the core application as you have done in the past, but make the functionality available only to registered users (schools).

virtual hosts allow you to server multiple sites from one web server.

you can read more about symbolic links here: http://en.wikipedia.org/wiki/Symbolic_link

so, let's assume your webserver looks something like this:

if these three sites are all running more or less the same code updating one by one is going to be a bit of a timewaster. so, if we create a 'master' site

then you in each of the sites you can create a symbolic link back to your codeigniter app, for example:
ln -s /home/txomin/public_html/master/system /home/txomin/public_html/site1/system

no how that would work on windows though Tongue

alternatively, you could use some form of version control (SVN, GIT etc) and update each site by checking out the master copy

@Prophet: I agree. In your example this was the most appropriate approach. I was referring to a project where the client wanted multiple (and independent) instances of the same site which i think the whole symlink shindiggery lends itself to quite nicely.

Thank you both. Good leads. Gotta walk the walk myself now.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.