We recently relaunched our website and with that we changed how we manage content on the site. Before, the website code (Java classes, JSP pages, HTML, images, CSS, etc) was checked in to source control and usually one developer (sadly, me) would have to make all kinds of changes. It was a really inefficient process and not sustainable the bigger we grew. We needed a system where non-engineers could edit the pages, see their changes easily and deploy the changes to the site without my help.


First, we use an open source template framework called Sitemesh. This allows our guys to write very basic HTML and not worry about things like the header, footer, sidebar, etc. Sitemesh takes the output of a JSP page (or anything that serves up HTML), parses it then merges it with a template.  You can have any number of templates in the system, all mapped to patterns or various other things. This is a pretty simplified description of Sitemesh -- overall, it's a very powerful and extremely simple framework. As I mentioned, it'll handle anything that produces HTML so it's compatible with PHP, Perl, ASP, etc. We use it in our products to make templating easy and to keep the JSP pages clean.


Next, I created a Subversion hook to do automatic deployments of our content when a check-in is received. (I got the idea for this from an Ars Technica article.) Subversion is our source control and a hook is a way to execute a script based on an event like a check-in, update, etc. Local to the jivesoftware.com machine is a checkout of our site code. From there, the hook script calls an Ant target to deploy the latest JSP/HTML code. I only deploy JSP or HTML in this step and not Java classes or config files. Doing updates to the core source is less frequent and ususally requires a server restart.


Finally, we have a checkout of the site project on our internal file server (Linux + Samba). I also use that checkout as the web root for an internal staging site. Since changes are picked up automatically, our guys can edit the files on the file server then reload the page immediately in their browser. After they make their changes, code is checked in and automatically deployed.