One of the biggest issues being pushed at this year's CFUNITED conference was the need for each and every one of us developers to be using some sort of source control. I've since joined the converted faithful and have seen the light as to just how important source control is, especially when working in a team environment.
Subversion is a free, easy-to-use, source control server with widespread support including direct integration with CFEclipse as well as the Windows file system. This is my quick and easy guide to getting up and running and setting up your repositories. It only takes a matter of seconds to setup each new repository instance, so hopefully this will allow everyone to get up and running in a jiffy. Keep in mind that these directions are for Windows, but should be pretty similar for the Mac.
The first thing you'll need is a copy of the Subversion server. This is where your repositories will sit and these will hold the master copies of all your code (along with any revisions). You can download a copy here (the ones ending in '-setup' come with a friendly installer program). Once installed, perform the steps below to get it running as a service:
- Create a root directory to hold all of your repositories (e.g. c:\svnrepo).
- Download the SVN Service Wrapper (alternate location) and unzip it to your c:\Program Files\Subversion\bin\ folder or wherever your SVNServe.exe is located.
- Open a command prompt and type 'SVNService -install -d -r c:\svnrepo'. The -d installs it as a daemon and the -r specifies that it will only server repositories located under the specified directory.
IMPORTANT: Make sure to backup that root folder and protect your repositories!!!The second thing you'll want to download and install on that machine is the
Tortoise SVN client. Once that's installed:
- Go to the directory which you specified for your subversion repositories (c:\svnrepo) and create a new folder there - name it whatever you would like your repository to be called, typically the name of your project.
- Next, right-click on that folder and select Tortoise SVN from the context menu, then choose 'Create repository here...' Select Native Filesystem at the prompt and you should then get a confirmation that everything was created OK.
- Double-click into that directory and you should now see 5 directories and 2 files. Go into the conf directory and edit svnserve.conf. Uncomment every line with only a single ## sign except for the line starting with 'authz-db', then save and exit. You can change the 'anon-access' value to 'none' to disable read-access by all.
- Edit the passwd file - remove the ## before [users] and replace the sample users with your own username/password combinations.
That's it, your repository should now be setup. Time to start adding some directories...
- Right-click on the folder we first added (the one containing the conf and other directories), and select 'Tortoise SVN', then 'Repo-browser'.
- Right-click anywhere in the main screen that pops up and select 'Create folder...' Standard convention specifies 3 directories for the top-level: trunk, tags, and branches. Create those now - enter 'trunk' as the name of the directory. Each action performs a commit which requires a memo, so we'll use 'creating initial trunk directory'. Do the same for tags and branches.
Next we need to get our code into the repository. If your web server is on a different machine than your Subversion server, you'll need to install the Tortoise SVN client onto it as well. It's important to remember that the actions on the menus are always in relation to your Subversion repository. So an import means that we'll be adding files to our repository.
- Right-click on the directory of your webroot and select 'Tortoise SVN' and then 'Import'.
- Enter the location of your Subversion repository (by default Subversion includes its own svn protocol). It should look something like this: svn://your.ip.address/repos_name/trunk. For the comment use 'initial trunk import'.
You should get a success message once all your files are imported. That's it! You've now got your source code hosted in a Subversion repository with all of the benefits that provides!
In the next post, we'll look at using CFEclipse along with Subversion to create an efficient, manageable development environment. Stay tuned!
If there are major bennies from installing the server, can I take the repository I already created through Tortoise on the server and use it with the regular Subversion server?
Thanks a lot,
Michael Brennan-White
http://carehart.org/blog/client/index.cfm/2006/7/1...
Perhaps readers of your blog entry here will enjoy some of what's there.
Charlie - thanks for the add!
What I am having trouble with is this; I have a development server and 2 production servers. My SVN Repository is on the dev server. I figured out how to set up 'svnserve' as a service so that I can connect to my remote repository via the svn: protocal. I work over a VPN, so the lack of encryption is okay for me in this instance. Now, my problem is w fold:
1. When I check a file in and out of the repository, I want that file to be available via my development website. Does this mean my repository should be where the website is, c:\inetpub\wwwroot\mysite.com\ or should I use a 'hook' to move the files from the repository to the webroot after each commit?
2. Next, I need to figure out how to push files from the dev server to the live server(s). I don't think I can write a hook that would do that, because I don't want ALL updated files pushed to the live server, only certain files and certain times. Maybe I need an alternate technology/solution for moving files from development to production. What do you think?
Thanks for the article!