[COLUG] Remotely Updating Webservers, Part II

Joshua Kramer josh at globalherald.net
Fri Apr 4 18:44:03 EST 2008


Howdy All,

A while back, I asked about updating webservers remotely.  Here, I'll post 
what I did to accomplish this.

On my production server, I have the site under /opt, like this. 
(Substitute drupal, joomla, etc for 'webapp' - this is where the HTML 
and php goes, kind of like pubhtml.)

/opt/josh_site/webapp

There are other assorted things under /opt/josh_site.  There is also a svn 
directory, like this:

/opt/josh_site/svn
/opt/josh_site/svn/josh_site
/opt/josh_site/svn/josh_site/trunk  (also branches, tags)

And, under trunk, there is:

dist/webapp

This dist/webapp directory corresponds to the pubhtml-type 
/opt/josh_site/webapp directory noted above.  So basically, if I do an 
update from svn, then I need to somehow get the correctly-versioned files 
from the /opt/josh_site/svn/josh_site/trunk/dist/webapp directory to the 
actual /opt/josh_site/webapp directory.  That's where rsync comes in, but 
I'm doing an rsync from local to local.

Here is a nifty script that accomplishes the svn checkout and rsync 
update.  It resides in /opt/josh_site/svn.

update_prod.sh:

#!/bin/bash
cd josh_site
svn update --username site_deploy_user --password site_deploy
cd ..
rsync -avz --exclude=".*/" josh_site/trunk/dist/webapp ../

In svn, my site looks like this:

josh_site
josh_site/branches
josh_site/tags
josh_site/trunk
josh_site/trunk/dist
josh_site/trunk/dist/webapp
josh_site/trunk/dist/bin
josh_site/trunk/dist/webservice
josh_site/trunk/src
josh_site/trunk/src/webservice
...etc...

This is because there are other, non-website parts of my project and so I 
have other kinds of code under trunk/src.

Hopefully this is hepful to someone!

Cheers,
-J



More information about the colug432 mailing list