Setting up a dev environment

This may not be applicable to everyone, but I like my work environment to be fairly portable and simple to work with, so in no particular order, let me share with you how I setup my Eclipse / Coldfusion development environment on Windows.

First, lets get the software out of the way.

  • Coldfusion - Any flavor will do, dev edition of CF8 is simple to work with, but Railo or BD would be just as applicable
  • Apache HTTPD - Hands down, working on many projects on your local system, Apache wins.  You can setup name-based virtual hosts and run multiple sites at once on your XP system, its faster than IIS, supports mod-rewrite, and runs with less RAM usage.  No Brainer.
  • Eclipse - When properly setup, Eclipse beats any other tool I have used in support of a portable coding environment.  Plugins will include CfEclipse, Subclipse, and JSEclipse to start with
  • SQL Server 2005 Express - Its free, its fast, it is very compatible, and has nice graphical tools. Check out a tool called Database Publishing Wizard from Microsoft. It will let you export your entire schema, FK's and all, *including data*, to a single .sql file. This makes keeping your database in the SVN repo as simple as committing the script!

If you have a windows box and want to host a subversion repo, you can check out VisualSVN.  super easy to manage, graphical tool for creating and setting permissions on your repo's, and even a slick web interface. Did I mention its free?  I only mention that because I use Subversion heavily for my 'portability' aspect of my environment.

So, you get all your software installed, lets setup a new project.  I use a directory tree somewhat like this:

/ (project root)
----/wwwroot (your physical web server root is here)
----/mappings (any project-specific coldfusion mappings)
----/customTags (project-specific custom tags)
----/support (contains database scripts, documentation, etc)

Now, the project root will be where you change your Eclipse project root to point too.  This keeps all the project assets nice and tidy.  Each project root is usually named for the client or the project I'm doing.  Every project will have its own SVN repo. A few things to note about Eclipse projects:  They do not perform well over a UNC path or a mapped drive, especially with many files.  Do yourself a favor and develop locally (you know you should not be editing files live on the server anyway!).  When you are not working on a project, close it! (right click the project in eclipse, click 'close project') This will free up distraction and ram in Eclipse so you can focus on your task at hand.

So now you have a project in Eclipse, and a nice directory structure, here is an Apache v-host snippet to add a name-based virtual host (goes in httpd.conf in the apache folder in Program Files, restart Apache after it is inserted) :

<VirtualHost *:80>
   ServerName yourDesiredHostname.dev
   DocumentRoot D:/projects/test/wwwroot
   CustomLog D:/projects/test/access.log combined
   ErrorLog D:/projects/test/error.log
   Options Includes FollowSymLinks
   
   <Directory D:/projects/test/wwwroot>
   Order allow,deny
   Allow from all
   Satisfy all
   </Directory>
   
   <IfModule dir_module>
      DirectoryIndex index.cfm
   </IfModule>
</VirtualHost>

Now you have to add a record to your hosts file on Windows, pointing yourDesiredHostname.dev to 127.0.0.1 (or whichever IP you configured apache to be listening too). Woohoo, now you can see a placeholder page!

Before I run the risk of this post getting too long, here is a very paraphrased idea of workflow:

  • Develop code locally and test till features are complete
  • Commit the updates to SVN with good comments
  • Test after and before the SVN commit - everything working? Deploy code to production server!
The cool thing with an SVN server is, you can checkout your entire web root at home, or to a portable thumb device, and code wherever you need too. I <8 SVN, and with several free servers out there (even for windows folks), there is no excuse or reason not to use it!

If you need a more step-by-step guide, check out the excellent ACME Guide to setting up Coldfusion on a PC or a Mac.


642-812 professionals usually teach students of 70-236 and 70-431. They prefer their students to prepare for N10-003 before sitting in the actual test.

1 comments

1 response to “Setting up a dev environment”

  1. Mike Rankin Says:
    So close! If you were able to use something other than MSSQL, you would pretty much be able to run the same setup on OSX and Linux. I'm going to start looking at Derby pretty seriously as an alternative.

Leave a comment