Managing a multi-site codebase
Posted: Tue Sep 06, 2011 7:51 am
Good afternoon all,
My first post here, it's great to see a heavily active PHP dedicated community, so I am excited to get involved.
For my first post, I would like to open a discussion with fellow developers, as to how they would tackle the situation we are in, and how best to go about managing a rapidly expanding codebase. This topic has created quite some heated debate within our company, and it would be great to have some outside opinion. I'll explain our situation first:
We're in the process of building a brand new, custom insurance quotation website for an international insurance broker. We have three RHEL dedicated servers with Rackspace (who, if anyone is interested, we could not recommend highly enough - they are simply the best), a development server in the UK, a production server in the UK and a production server in Sydney, Australia. We began developing the website from scratch, which was a new insurance website for Australian clients. It was written in PHP with a MySQL server storing the customer / policy and scheme data. Before the site was completed, the insurance company also required two further sites, a similar site catering for UK clients, and one providing sickness and accident cover. We subsequently took the codebase for the Australian site and copied it into two other virtual hosts, creating 3 completely separate running instances of that software, each with their own branding. We then continued to develop on the original Australian instance, whilst once or twice a week updating the other sites to reflect recent changes to the Australian one.
The company then requested a further 2 more sites, using the same software, but being branded differently. Suddenly, we had 5 separate versions of the software to maintain, and now these newer sites required some functionality changes, which would need to be specific to that particular site. Now, 3 sites operate using the same codebase and 2 sites operate using a slightly modified codebase. Now that the projects are drawing to a close, during testing, bugs are coming to light, and having to fix the bugs across the 5 different sites is a logistical nightmare.
Each site has the following codebase:
/admin/ - same across all sites
/css/ - different for each project, provides styling changes for each site
/downloads/ - same for each site
/files/ - same for each site
/images/ - different for each site
/includes/ - same for each site
/script/ - different for each site
/templates/ - different for each site (this contains the design, layout and content)
So ideally, we'd like all the folders that are the same for each site (i.e the actual software powering the website) to fetch from a single repository on the server that that virtualhost sits upon, and the rest (design-related stuff mainly) to come from the virtualhost that the site sits in.
Adding to this complication is the fact that one of our servers is in Australia and one in the UK. All I can think is that we have a single repo on our UK site and push new versions to that, and automatically server-to-server mirror that repo accross to the Australian server, to power to 2 or 3 sites over there.
Ideally, we would want to merge all 6 databases into a single database too, so presumably we'd have to implement some form of real-time MySQL mirroring where both servers act as masters? Not even sure if that is possible.
What do you think guys? Are we being a little ambitious? Are we going down the right path?
Your comments, opinions and criticisms are welcomed with open arms.
Many thanks,
MonkeyMeister
My first post here, it's great to see a heavily active PHP dedicated community, so I am excited to get involved.
For my first post, I would like to open a discussion with fellow developers, as to how they would tackle the situation we are in, and how best to go about managing a rapidly expanding codebase. This topic has created quite some heated debate within our company, and it would be great to have some outside opinion. I'll explain our situation first:
We're in the process of building a brand new, custom insurance quotation website for an international insurance broker. We have three RHEL dedicated servers with Rackspace (who, if anyone is interested, we could not recommend highly enough - they are simply the best), a development server in the UK, a production server in the UK and a production server in Sydney, Australia. We began developing the website from scratch, which was a new insurance website for Australian clients. It was written in PHP with a MySQL server storing the customer / policy and scheme data. Before the site was completed, the insurance company also required two further sites, a similar site catering for UK clients, and one providing sickness and accident cover. We subsequently took the codebase for the Australian site and copied it into two other virtual hosts, creating 3 completely separate running instances of that software, each with their own branding. We then continued to develop on the original Australian instance, whilst once or twice a week updating the other sites to reflect recent changes to the Australian one.
The company then requested a further 2 more sites, using the same software, but being branded differently. Suddenly, we had 5 separate versions of the software to maintain, and now these newer sites required some functionality changes, which would need to be specific to that particular site. Now, 3 sites operate using the same codebase and 2 sites operate using a slightly modified codebase. Now that the projects are drawing to a close, during testing, bugs are coming to light, and having to fix the bugs across the 5 different sites is a logistical nightmare.
Each site has the following codebase:
/admin/ - same across all sites
/css/ - different for each project, provides styling changes for each site
/downloads/ - same for each site
/files/ - same for each site
/images/ - different for each site
/includes/ - same for each site
/script/ - different for each site
/templates/ - different for each site (this contains the design, layout and content)
So ideally, we'd like all the folders that are the same for each site (i.e the actual software powering the website) to fetch from a single repository on the server that that virtualhost sits upon, and the rest (design-related stuff mainly) to come from the virtualhost that the site sits in.
Adding to this complication is the fact that one of our servers is in Australia and one in the UK. All I can think is that we have a single repo on our UK site and push new versions to that, and automatically server-to-server mirror that repo accross to the Australian server, to power to 2 or 3 sites over there.
Ideally, we would want to merge all 6 databases into a single database too, so presumably we'd have to implement some form of real-time MySQL mirroring where both servers act as masters? Not even sure if that is possible.
What do you think guys? Are we being a little ambitious? Are we going down the right path?
Your comments, opinions and criticisms are welcomed with open arms.
Many thanks,
MonkeyMeister