Our site (fighthunger.org) is currently running on 3 web servers (LAMP - apache2, mysql5, php5). We faced some issue and I would like to submit our solution and asking for suggestion.

Server configuration

We use Subversion SVN to manage our php code. In repository we skip files/ directory; we don't need versioning those file and they are weigh down repository itself. Repository reside on one of three server (fh_1)
On each server we svncheckedout repository to a working copy (says /var/www/vh/fighthunger), so we have 3 copy of the same code on each server.
Directory files/ is NFSshared between 3 servers

Code base replication

After each commit (from a local working copy on local testing server) we configure post-commit script to synch all 3 working copy in different servers. It a little tricky because post-commit run without environment as apache user (the user running web server) and need to connect to 3 other servers. This is done by copying rsa apache public key on 3 server and run a command like

ssh "cd /var/www/vhostsbalanced/fh; svn update"

In this way change propagate almost instantly.

Drupal issue

Drupal seems not to have any problem running in this environment (session are stored in database). Only problem could arise from files/ directory but we solve using a NFS share.

Hope this could help.

Comments

rkendall’s picture

Sounds like a reasonable way to set things up. We had used rsync and an ssh script to sync 8 web servers when I worked at breathe.com - although that wasn't drupal.

Was curious how your database is setup. Do you have a seperate db server(s)? Do you have additional nics for a local network? Master/Slave setup, etc.?

Also curious about what you have for load balancing, DNS round-robin or something else?

Have you done any performance testing? If so, what would be the bottleneck, NFS share, database connection?

Cheers, thanks for sharing.

P.S. great site.

--
Ross Kendall
UK based Web and IT consultant specialising in Free and Open Source Software technologies.
http://rosskendall.com