Hosting Git, SVN and Hg (Mercurial) repositories on Windows with IIS

Git, SVN and Hg (Mercurial) currently are the most popular version control systems. In this guide we are going to show how to host repositories for these systems on Windows with Microsoft IIS 7+.

We will be using a magnificent free and open source tool – SCM-Manager. This is simple and nifty looking manager tool for Git, SVN and HG written in Java. Probably the best thing about SCM-Manager is that it includes all dependencies inside and does not require you to download and compile any third party components. You don’t have to install Git or any other kind of servers to host repositories. It does require Python and Hg package to host Mercurial repositories, but these packages can be installed automatically into the SCM-Manager home directory directly form web interface. So if your host support hosting of Java applications you don’t need access to the server console to install some components or run additional commands.

Hosting Java applications with Helicon Zoo

First of all you need to configure your IIS server to host Java applications. The easiest way to do this is to use Web Platform Installer.

  1. Download and install Microsoft Web Platform Installer.
  2. Run Web Platform Installer and click “Options”.
  3. Add Helicon Zoo feed into “Display additional scenarios” box: http://www.helicontech.com/zoo/feed. New “Zoo” tab will appear.
  4. Go to the Zoo –> Templates and select Java (Jetty) project.
  5. Accept licenses to start installation process.

image

This will install all dependencies required to run Java application on IIS, including JVM, Helicon Zoo Module, etc. After installation of all dependencies is completed you will be presented with the standard Web Deploy dialog to create new web application:

image

Select “New web site” in the web site field and configure other options as usual.

Another good way to install all required dependencies is to install Zoo –> Packages –> Java Hosting Package. This package is usually installed on servers to allow them to host Java applications. The idea is that Java application can be simply moved from one IIS server to another just by copying web site folder, if both servers has Java Hosting Package installed.

Installing SCM-Manager

First you need to download SCM-Manager as a single WAR file here: https://bitbucket.org/sdorra/scm-manager/wiki/download Save this WAR file to the IIS web site folder and edit web.config file as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <heliconZoo>
      <application name="jetty.project" >
        <environmentVariables>
          <add name="CONTEXT_PATH" value="%APPL_VIRTUAL_PATH%" />
          <add name="WAR_EXTRACT_PATH" value="%APPL_PHYSICAL_PATH%" />
          <add name="WAR_FILE" value="scm-webapp-1.20.war" />
          <add name="SCM_HOME" value="%APPL_PHYSICAL_PATH%/.scm" />
        </environmentVariables>
      </application>
    </heliconZoo>
    <handlers>
      <add name="jetty.project#x86" scriptProcessor="java.jetty"  path="*" verb="*" modules="HeliconZoo_x86"
           preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
      <add name="jetty.project#x64" scriptProcessor="java.jetty"  path="*" verb="*" modules="HeliconZoo_x64"
           preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
  </system.webServer>
</configuration>

Here the WAR_FILE environment variable contains the downloaded WAR file name. The SCM_HOME points to the /.scm folder under web site home, this will instruct SCM-Manager to store all files and repositories inside a web site folder. Note that write permissions to the web site folder for the user running Web Application Pool are required.

Now navigate to the web site created. The first start usually takes some time as SCM-Manager will create files and folder structures, configurations and Java Virtual Machine also needs time to start-up. After application initialization you should see a login screen. Enter the following default credentials to log in:

login: scmadmin
password: scmadmin

Don’t forget to change default password later. Now welcome to the dashboard:

image

Working with SCM-Manager

After installation you can immediately start creating empty Git and SVN repositories. To start using Hg open Repository Types page under config section and start Configuration Wizard for Mercurial. Select “download and install” and required packages will be installed into /.scm folder under web site automatically.

More often users ask how to import your existing repositories into SCM-Manager. All repositories are stored in the folder /.scm/repositories inside your web site. If you have FTP access to these folders you can simply copy entire directory structure of your repositories to the corresponding folders under /.scm/repositories. For SVN this is the only viable option to import repository as it uses central repository storage. Then click on Import Repositories link on the dashboard and your repositories will be imported into SCM-Manager.

Since Git and Hg uses decentralized repository storage, you can simply create empty repositories with web interface and then push your local repositories to the new location.

Now you can create users and groups, manage permissions, view commits and sources. And the most important feature of SCM-Manager is that it provides central point to administer all of your repositories from different source controls on a remote servers and over internet. And it is so easy to start work with!

This entry was posted in Helicon Zoo and tagged . Bookmark the permalink.

7 Responses to Hosting Git, SVN and Hg (Mercurial) repositories on Windows with IIS

  1. Simon Egli says:

    Great, would be even better, if this would be available in the web platform installer…

  2. Simon Egli says:

    Too bad, I tried this but there are still some issues.

    Compared to the standalone version of SCM-Manager I cannot push large changesets with mercurial. I’ve tried to increase requestlenght of IIS and jetty, but I don’t really know how to configure jetty.

  3. Simon Egli says:

    Would it be possible to add a handler in the web.config for the /hg subdirectory to route mercurial via IIS/Phyton and not jetty?

  4. Simon Egli says:

    Hi,
    I think the issue with pushing big changesets is a Mercurial & IIS issue, since codeplex has the same problem, and they’re probably also hosting mercurial on IIS.
    I’ve created a new Zoo engine that uses exact the same parameters for java.exe as the standalone SCM-Manager version, and the issue remains.

  5. Simon Egli says:

    Furthermore, the standalone SCM-Manager is using a newer version of jetty

    • Slov says:

      Hello.

      We are working now on a new version of IIS to Java integration with Helicon Zoo. We will try to resolve this issue as well. I will notify you when new version is available.
      Please use our forum or support service for further discussion.

  6. Slov says:

    New versions of Helicon Zoo Module and Java Hosting Packages are available in beta feed now. Since these changes are significant, we made these versions available through beta feed for now.
    These new versions should resolve current issues with Java applications.

    Installation instructions:

    1. Run Web Platform Installer and click Options.
    2. Remove current Helicon Zoo feed (http://www.helicontech.com/zoo/feed/)
    3. Add Helicon Zoo beta feed (http://www.helicontech.com/zoo/feed-beta/)
    4. Install Java Hosting Package – your current installations will be upgraded. You need to install Oracle JDK first, as Oracle prohibit direct downloading of Java packages so it can’t be included into repository.

    Please report your results to community forum.