Reverse Proxy Server 2: SVN
Reverse Proxy Server: Introduction | Basics | mod proxy html | mod proxy html 2 | SVN 1 | SVN 2 | SVN 3 | SVN 4 | Wiki | Deployment | IIS back-end server
|
|
Uniform Server 5.0-Nano Reverse Proxy. |
How to run a subversion server behind a reverse proxy.
On the previous page I mentioned an SVN server requires special consideration. Basic requirement is for a proxy server to push everything over to the back-end server and let it do its job such as verification and copy and move.
Subversion uses the DAV (Distributed Authoring and Versioning) Protocol it uses more methods than standard HTTP (eg. GET, COPY, MOVE) these must be passed to the back-end server hence special consideration. In addition more headers are used compared to standard HTTP. Again these must be taken into account.
Preparation
For this example we require a subversion server.
Create a new folder C:\server_c Extract a copy of UniServer 5.0 to this folder.
1) | Move Servers First close all running servers.
|
Moves servers and also configures server's internal paths.
|
2) | Inside folder C:\server_c\UniServer create two new folders svn_tools and svn C:\server_c\UniServer\svn_tools |
You can choose different names and locate these outside of the UniServer folder. However we are placing these here for portability. Folder svn will contain our SVN repositories]]. |
3) | Download File: svn-win32-1.6.4.zip or newer. Located at the bottom of this page: tigris.org |
Make sure any newer version is compatible with the version of Apache. |
4) | Copy the entire content of folder svn-win32-1.6.4\svn-win32-1.6.4 To folder C:\server_c\UniServer\svn_tools |
Once copied if you wish to save space delete the extracted files and svn-win32-1.6.4.zip they are no longer required. |
5) | Navigate to C:\server_c\UniServer\svn_tools\bin Move files: mod_authz_svn.so and mod_dav_svn.so |
Move the two modules to Apache's module folder; |
6) | Navigate to C:\server_c\UniServer\svn_tools\bin Copy these files:
To: C:\server_c\UniServer\usr\local\apache2\bin |
The above two modules have dependencies (dlls), Apache resolves dependences by first looking in
|
7) | Edit file: C:\server_c\UniServer\usr\local\apache2\conf\httpd.conf Confirm these modules are enabled as shown: LoadModule dav_module modules/mod_dav.so LoadModule dav_fs_module modules/mod_dav_fs.so |
Configure Apache to use the subversion module. First check these modules are enabled. |
8) | At the end of load modules section add these two lines:
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so |
The two lines inform Apache to load the svn modules. Add them just below: LoadModule vhost_alias_module modules/mod_vhost_alias.so |
9) | At the end of httpd.conf, add the following block of code.
<location /svn> DAV svn SVNListParentPath on SVNParentPath C:/server_c/UniServer/svn </location> |
|
Testing SVN server
- Restart Servers
- Access the SVN repository. Type the following into a browser http://localhost:83/svn
Page displays
Collection of Repositories Powered by Subversion version 1.6.4 (r38063).
This confirms Apache has been configured correctly. Next step is to create an SVN repository.
Creating a repository
This section shows how to create a repository using the command line tool svnadmin.exe and how to add a working project.
Batch file
To run the admin tools requires opening a command prompt and navigating to the svn_tools executables folder .
This is very tedious hence create the following batch file in folder C:\server_c\UniServer\svn_tools\bin
Name the batch file whatever you like I have named it z_start_svn_command_prompt.bat add the following content:
start "SVN COMMAND PROMPT" cmd.exe /k "COLOR B0"
Double click to run, a new command prompt is opened and the working folder is automatically set.
Create a repository
You need to create at least one blank repository choose a name that matches your project for this example I will use “myproject”
Run the batch file above and type the following command:
svnadmin.exe create ..\..\svn\myproject
- svnadmin.exe Runs the subversion administration program.
- create Is the command to be run by svn admin. It creates a repository named myproject.
- Note: You can specify an absolute path or a relative path to the folder myproject.
For example:
Absolute: C:\server_c\UniServer\svn\myproject
Relative: ..\..\svn\myproject - as shown above
- Note: You can specify an absolute path or a relative path to the folder myproject.
- If the folder myproject does not exist it is created. Adds subversion database and tracking folders.
Repository Access
Start the servers. To access repositories type either of the following into a browser:
- http://localhost:83/svn/ -- Displays Collection of Repositories page.
- All repositories in folder svn are listed as links.
- Currently we have just one repository hence a single link “myproject” is displayed
- Click this link to display “myproject” repository.
- If you do not want all repositories listed comment this line as shown: #SVNListParentPath on
Accessing http://localhost:83/svn/ will now produce Forbidden You don't have permission to access /svn/ on this server. - You can still access a repository by entering its full URL see below.
- http://localhost:83/svn/myproject/ -- You directly access a repository by name as shown for "“myproject”.
Viewing this repository with a browser you will find it empty.
However view the same folder using Windows Explorer displays several SVN suport folders and files.- Folders: conf, dav, db, hooks and locks
- Files: README.txt and format
- Never edit or delete the above folders or files. They tag and track all changes in a repository.
Command line client
Starting with an empty repository you probably want to quickly set it up and publish your current project as it stands.
The following shows a quick way to do this it also includes SVN’s recommended folder structure.
- Create a temporary folder for example C:\a_svn_temp
- Inside this create three new folders (SVN recommended) names:
- trunk
- tags
- branches
- Copy your current stable project into folder trunk -- Note: For testing I copied folder C:\server_c\UniServer\unicon
- Start servers
- Run batch file z_start_svn_command_prompt.bat (whatever you named it)
- Type the following:
svn.exe import C:\a_svn_temp http://localhost:83/svn/myproject -m "Initial import"
This updates your repository with new folder structure and project.
View repository, type into browser http://localhost:83/svn/myproject
- The project page and status are displayed myproject - Revision 1:
Note: If you do not include -m "Some text" SVN will complain about not being able to find a text editor.
Summary
The above server is intentionally non-restrictive meaning anyone can access and change repositories. We will add security latter a non-restrictive server allows configuration in simple stages making it easier to test.
Currently we have a functional SVN server, its fully portable and can be relocated on a new host machine. The real objective was to proxy it, this is covered on the next page.
Ric |