Setting up a Build Environment under Windows, using Subversion (Part 1)

For my Build Environment, I use Subversion (SVN) as my Source Control system. Normally, Linux (or another *nix) is the operating system that is being frequently used for this, but I have an existing Windows 2003 Server that I wanted to use.
This multi-part posting series will explain:

  • How to set up an Apache Web Server to run in parallel with IIS
  • Installing Subversion with Apache integration and user authentication
  • Automatic Backups using WinRAR and cmdsendmail
  • Writing an automated Buildscript

These articles were made on a Windows 2003 Server, Web Edition. Generally, every Windows Version should work, even XP Home or Vista Basic.

Part 1: Setting up the Apache Web Server
While it may be somehow possible to run Subversion on IIS, Apache Web Server is the server of choice here. If you are running a Windows Server, you may already have IIS installed, and thus the question might come up: How to run IIS and Apache in parallel? While IIS is not relevant for our build environment, I wanted to keep it for some other stuff running on that machine.
Before we start, let’s first download Apache. On http://httpd.apache.org/ you will find a Download link in the Menu, where you can download a MSI Installer. I used Version 2.2.8 incl. OpenSSL (apache_2.2.8-win32-x86-openssl-0.9.8g.msi).
If you have no desire to run IIS in parallel to Apache, feel free to skip the next section and jump to "Setting up Apache".
Now, we have to decide which approach we want to use to run 2 Web servers in parallel. The two options which are really apparent here:

  • Run them on different ports
  • Run each one on a different IP address

Personally, I don’t like web servers running on other ports than 80 (or 443 for SSL). Also, the idea to run IIS in HTTP and Apache in HTTPS mode seems logical. But I’ve chosen the second approach: Give the server 2 IP addresses and run the IIS on the second IP address. Together with 2 different Names on the DNS Server, this gives a clear separation with the ability to still run HTTP and HTTPS on each server without having to use non-standard ports. Note that there may be more options (Host Headers, funky VLAN/Router configurations…), but this is not an IIS Reference Guide 🙂
The server name is "blogtest" and the IP Addresses are 10.23.42.160 and 10.23.42.161. I will limit IIS to .161. My DNS Server is configured to resolve "blogtest" to .160 and "btestiis" to .161.

Disabling IIS Socket Pooling
Per default, IIS binds itself to all IP Addresses on the server and therefore blocks port 80 on both IP Addresses. We want to disable this so-called "Socket Pooling" and only bind it to .161, as detailed in Microsoft’s Knowledgebase Article 813368:

C:\Program Files\Support Tools>httpcfg set iplisten -i 10.23.42.161
HttpSetServiceConfiguration completed with 0.

C:\Program Files\Support Tools>httpcfg query iplisten
IP                      : 10.23.42.161
------------------------------------------------------------------------------

With this option set, IIS will not touch the .160 IP anymore. (Remember to net stop/start the service after this change).
Be advised that this is a global IIS change. So even if you set a Website to "(All Unassigned)" or even explicitly to .160, it will not respond on .160 (or any IP address other than the ones you added using httpcfg set ilisten -I) anymore.

Setting up Apache
Ok, IIS is out of the way now. Let’s start installing Apache. When you are prompted to enter the server details, make sure that "For all users, on Port 80" is selected, so that Apache installs itself as service.
When you have finished installing Apache, it’s time to look at the configuration. You can find it here (per Default):
C:\Program Files\Apache Software Foundation\Apache2.2\conf
The file is called httpd.conf and we need to make sure Apache only binds to .160.
Scroll down until you come to this part:

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <virtualhost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

Note the "Listen 80". Change this to
Listen 10.23.42.160:80
Save the file and restart Apache (there is a little tray icon, or look in services.msc).

Bonus: Enable HTTPS on Apache
You may want to enable HTTPS as well on Apache, if it’s being exposed to the Internet. Since my server is only used internally, I have no use for HTTPS yet. If you need HTTPS support, have a look at this article. (Note that OpenSSL and mod_ssl are already included in the "Win32 Binary including OpenSSL" download Packages at Apache.org)

Conggratulations! You have now successfully set up Apache and IIS in friendly co-existence on one server.
This concludes Part 1 of this series. Now that we have our web server running, we’ll install Subversion and set up authentication.

Comments (1)

[...] in a multi-part series about setting up a build environment under Windows, featuring Subversion. In Part 1, we’ve set up an Apache Web Server and made it happily live next to an IIS Web Server. In [...]