After the recent web server replacement, I have been doing a couple of changes to my development environment for the site. For those of you who have an interest in these kinds of things, I figured I'd describe how things are set up from a pure development perspective.
First off, we have the code editor. A few years ago, while I was still using a Windows system, I was using NuSphere's PhpEd, which I still think is a fantastic environment for PHP development. Unfortunately, switching to Apple meant I had to find a new editor. I've tested a number of various editors and IDEs over the years, but to make a long story short I've ended up with Eclipse as my main development platform. The reasoning behind this is that I like having a full IDE (refactorisation support, code completion, integrated API reference), and Eclipse supports both major languages used for the site (PHP and Java {SE and EE}) in a fairly seamless manner.
On my desktop machine, I don't have Apache running, nor do I have Glassfish installed (both of these run various aspects of the website). To be able to test things on the PHP side, I have two websites set up. One production site (driving fumbbl.com and
www.fumbbl.com) and one for development (dev.fumbbl.com, not accessable from outside my LAN).
To push code from my development machine to these two sites I am using two different methods. For the development copy of the site, I have a Samba share (windows file sharing), which is mounted as a remote file system on my desktop machine. I don't have my full eclipse workspace on the remote folder though. Instead, I have a plugin installed called FileSync. Every time I do a modification to the code, it automatically syncs the updated file to another folder. This other folder is obviously the remote file system, which makes the development site update automatically every time I save a file in my IDE.
For the live site, however, I want a bit more accountability and structure. To get this, I have connected the production site to my version control software. The concept is fairly simple: I have a source code repository to which I commit changes. Once a change is committed, a script on the web server is run that does an update of a local copy of the code and then syncs the code to the live site directory.
Now, prior to the web server replacement, I was using SVN for version control. So what I did was to commit a change and then manually run a script that did the update and pushed the code to the live site. This was somewhat annoying and meant I had to have a terminal window up on the web server for the sole purpose of doing these updates.
With the reinstallation of the web server, I took the time to switch to Mercurial (a more modern version control system). With the new setup, once I push a change to the live repository a triggered action is performed on the server where the repository is located that pushes the change to the web server repository. There, another triggered script is executed that automatically pushes the changes to the live folder. It may sound a bit complicated, but the end result is that once I push a change, it is automatically and immediately deployed on the live site.
I'm quite happy with how this setup is working for me. It's easy for me to test things, and develop new things and deploying to the live site is quite easy as well.
On the Java end, I have two primary methods. For Java SE applications (such as the blackbox scheduler and bowlbot), I can pretty much develop directly on the development machine. The applications can be run locally and I don't have to push the code elsewhere. To deploy to the production servers, I've simply set up Ant build scripts that compile, package, and copy files over to the live server using SSH.
For Java EE, which is a fairly new aspect of the website, I am lacking a development site. This is something I will need to look into implementing at some point as I am planning to push more back-end functionality into the Java space (in order to be able to utilise caching and have better threading support). For now, Eclipse is set up to auto-deploy to the live server. So when I make a change to the code, Eclipse builds a new version of the servlet I'm working on and pushes it to the Glassfish server that's running on the web server machine without me having to do anything. Ideally, I'd want a similar workflow as for the PHP code, where Eclipse automatically pushes as it does now to a development copy, and then runs a build-script and deploys to the live version once I do a source control push. With a compiled language like Java, this is a bit trickier but I am certain it's possible.. Something for me to look into one of these days.. :)
That pretty much covers how I develop for FUMBBL. I'm sure this is a bit too technical for a lot of you and only hope you won't be too harsh when you rate this blog ;)