https://wiki.uniformserver.com/index.php?title=Reverse_Proxy_Server_2:_SVN&feed=atom&action=historyReverse Proxy Server 2: SVN - Revision history2024-03-29T13:19:04ZRevision history for this page on the wikiMediaWiki 1.41.0https://wiki.uniformserver.com/index.php?title=Reverse_Proxy_Server_2:_SVN&diff=3841&oldid=prevRic: New page: {{Nav reverse proxy server}} '''''How to run a subversion server behind a reverse proxy''.''' On the previous page I mentioned an SVN server requires special consideration. Basic requir...2009-08-22T14:28:38Z<p>New page: {{Nav reverse proxy server}} '''''How to run a subversion server behind a reverse proxy''.''' On the previous page I mentioned an SVN server requires special consideration. Basic requir...</p>
<p><b>New page</b></p><div>{{Nav reverse proxy server}}<br />
<br />
'''''How to run a subversion server behind a reverse proxy''.''' <br />
<br />
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. <br />
<br />
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.<br />
<br />
== Preparation ==<br />
For this example we require a subversion server.<br />
<br />
Create a new folder '''C:\server_c''' Extract a copy of UniServer 5.0 to this folder.<br />
<br />
{|cellspacing="6"<br />
|-valign="top"<br />
|1)<br />
|'''Move Servers''' First close all running servers.<br />
# Run Unitray: C:\server_c\UniServer\Start.exe<br />
# '''Left click''' tray icon > '''Advance''' > '''Move Servers''' multi-server operation<br />
# '''Press enter''' at all prompts<br />
# Repeat 2 and 3 Until icon 4 is displayed <br />
|Moves servers and also configures server's internal paths.<br />
* Apache port = 83<br />
|-valign="top"<br />
|2)<br />
|Inside folder C:\server_c\'''UniServer''' create two new folders '''svn_tools''' and '''svn''' <br /><br />
C:\server_c\UniServer\'''svn_tools'''<br /><br />
C:\server_c\UniServer\'''svn'''<br />
|You can choose different names and locate these outside of the UniServer folder.<br />However we are placing these here for portability.<br /> Folder '''svn''' will contain our SVN repositories]].<br />
|-valign="top"<br />
|3)<br />
|Download File: '''svn-win32-1.6.4.zip''' or newer.<br /><br />
Located at the bottom of this page: [http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100 '''tigris.org''']<br /><br />
Extract to any folder<br />
|Make sure any newer version is compatible with the version of Apache.<br />
|-valign="top"<br />
|4)<br />
|Copy the entire content of folder svn-win32-1.6.4\'''svn-win32-1.6.4'''<br /><br />
To folder C:\server_c\UniServer\'''svn_tools'''<br /><br />
Folder svn_tools will now contain folders '''bin''', '''iconv''', '''licenses''',<br /> '''share''' and file '''README.txt'''<br />
|Once copied if you wish to save space delete the extracted files<br /> and svn-win32-1.6.4.zip they are no longer required.<br />
|-valign="top"<br />
|5)<br />
|Navigate to C:\server_c\UniServer\svn_tools\'''bin'''<br /><br />
Move files: '''mod_authz_svn.so''' and '''mod_dav_svn.so'''<br /><br />
To folder: C:\server_c\UniServer\usr\local\apache2\'''modules'''<br />
|Move the two modules to Apache's module folder;<br />
|-valign="top"<br />
|6)<br />
|Navigate to C:\server_c\UniServer\svn_tools\'''bin'''<br /><br />
Copy these files:<br />
<br />
* intl3_svn.dll<br />
* libdb44.dll<br />
* libsvn_delta-1.dll<br />
* libsvn_fs-1.dll<br />
* libsvn_repos-1.dll<br />
* libsvn_subr-1.dll<br />
<br />
To: C:\server_c\UniServer\usr\local\apache2\'''bin'''<br />
|The above two modules have dependencies (dlls),<br /><br />
Apache resolves dependences by first looking in<br /><br />
its bin folder and then looks along system paths.<br /><br />
<br />
<br />
Generally these dlls are located on a system path<br /><br />
however we want a portable installation hence they<br /><br />
are copied to Apache’s bin (binary) folder.<br />
|-valign="top"<br />
|7)<br />
|Edit file: C:\server_c\UniServer\usr\local\apache2\conf\'''httpd.conf'''<br /><br />
Confirm these modules are enabled as shown:<br />
<pre><br />
LoadModule dav_module modules/mod_dav.so<br />
LoadModule dav_fs_module modules/mod_dav_fs.so<br />
</pre><br />
|Configure Apache to use the subversion module.<br /><br />
First check these modules are enabled.<br /><br />
Note, mod_dav.so is enabled by default.<br /><br />
|-valign="top"<br />
|8)<br />
|At the end of load modules section add these two lines:<br />
<pre><br />
LoadModule dav_svn_module modules/mod_dav_svn.so<br />
LoadModule authz_svn_module modules/mod_authz_svn.so<br />
</pre><br />
|The two lines inform Apache to load the svn modules.<br />Add them just below:<br />LoadModule vhost_alias_module modules/mod_vhost_alias.so<br />
|-valign="top"<br />
|9)<br />
|At the end of httpd.conf, add the following block of code.<br />
<pre><br />
<location /svn><br />
DAV svn<br />
SVNListParentPath on<br />
SVNParentPath C:/server_c/UniServer/svn<br />
</location><br />
</pre><br />
|<br /><br />
* '''svn''' Top level folder name <nowiki>http://localhost</nowiki>/svn/*** any name after svn is assumed a repository request and passed to DAV for resolving <br />
* '''DAV svn''' Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request. <br />
* '''SVNListParentPath on''' Enables listing of all repositories for URL <nowiki>http://localhost</nowiki>/'''svn'''<br />
* '''SVNParentPath''' Absolute path to the parent folder containing all the repositories.<br />
|}<br />
<br />
=== Testing SVN server ===<br />
* Restart Servers<br />
* Access the SVN repository. Type the following into a browser '''<nowiki>http://localhost:83/svn</nowiki>''' <br />
Page displays<br />
<pre><br />
Collection of Repositories<br />
Powered by Subversion version 1.6.4 (r38063).<br />
</pre><br />
This confirms Apache has been configured correctly. Next step is to create an SVN repository.<br />
<br />
'''''[[#top | Top]]'''''<br />
== Creating a repository ==<br />
This section shows how to create a repository using the command line tool '''svnadmin.exe''' and how to add a working project. <br />
<br />
=== Batch file ===<br />
To run the admin tools requires opening a command prompt and navigating to the svn_tools executables folder .<br />
<br />
This is very tedious hence create the following batch file in folder C:\server_c\UniServer\svn_tools\'''bin'''<br />
<br />
Name the batch file whatever you like I have named it '''z_start_svn_command_prompt.bat''' add the following content:<br />
<pre><br />
start "SVN COMMAND PROMPT" cmd.exe /k "COLOR B0" <br />
</pre><br />
Double click to run, a new command prompt is opened and the working folder is automatically set.<br />
<br />
'''''[[#top | Top]]'''''<br />
=== Create a repository ===<br />
You need to create at least one blank repository choose a name that matches your project for this example I will use “'''myproject'''” <br />
<br />
Run the batch file above and type the following command:<br />
<pre><br />
svnadmin.exe create ..\..\svn\myproject<br />
</pre><br />
* '''svnadmin.exe''' Runs the subversion administration program.<br />
* '''create''' Is the command to be run by svn admin. It creates a repository named '''myproject'''.<br />
** '''''Note'':''' You can specify an absolute path or a relative path to the folder '''myproject'''.<br />For example:<br />Absolute: '''C:\server_c\UniServer\svn\myproject'''<br />Relative: '''..\..\svn\myproject''' - as shown above<br />
* If the folder '''myproject''' does not exist it is created. Adds subversion database and tracking folders. <br />
<br />
==== Repository Access ====<br />
Start the servers. To access repositories type either of the following into a browser:<br />
<br />
# '''<nowiki>http://localhost:83/svn/</nowiki>''' -- Displays Collection of Repositories page.<br />
## All repositories in folder '''svn''' are listed as links.<br />
## Currently we have just one repository hence a single link “myproject” is displayed<br />
## Click this link to display “myproject” repository.<br />
## If you do not want all repositories listed comment this line as shown: '''#SVNListParentPath on'''<br />Accessing '''<nowiki>http://localhost:83/svn/</nowiki>''' will now produce ''Forbidden You don't have permission to access /svn/ on this server''. <br />
## You can still access a repository by entering its full URL see below.<br />&nbsp; <br />
#'''<nowiki>http://localhost:83/svn/myproject/</nowiki>''' -- You directly access a repository by name as shown for "“myproject”. <br />Viewing this repository with a browser you will find it empty.<br /> However view the same folder using '''Windows Explorer''' displays several SVN suport folders and files.<br />
## '''''Folders'':''' '''conf''', '''dav''', '''db''', '''hooks''' and '''locks'''<br />
## '''''Files'':''' '''README.txt''' and '''format'''<br />
## Never edit or delete the above folders or files. They tag and track all changes in a repository.<br />
<br />
'''''[[#top | Top]]'''''<br />
<br />
== Command line client ==<br />
Starting with an empty repository you probably want to quickly set it up and publish your current project as it stands. <br />
<br />
The following shows a quick way to do this it also includes SVN’s recommended folder structure.<br />
<br />
# Create a temporary folder for example '''C:\a_svn_temp'''<br />
# Inside this create three new folders (SVN recommended) names:<br />
## '''trunk'''<br />
## '''tags'''<br />
## '''branches'''<br />
# Copy your current stable project into folder '''trunk''' -- Note: For testing I copied folder C:\server_c\UniServer\'''unicon''' <br />
# '''Start''' servers<br />
# Run batch file '''z_start_svn_command_prompt.bat''' (whatever you named it)<br />
# Type the following:<br />
<pre><br />
svn.exe import C:\a_svn_temp http://localhost:83/svn/myproject -m "Initial import"<br />
</pre><br />
This updates your repository with new folder structure and project.<br />
<br />
View repository, type into browser <nowiki>http://localhost:83/svn/myproject</nowiki><br />
<br />
* The project page and status are displayed '''myproject - Revision 1:'''<br />
<br />
<br />
'''''Note'':''' If you do not include '''-m "Some text"''' SVN will complain about not being able to find a text editor. <br />
<br />
'''''[[#top | Top]]'''''<br />
<br />
== Summary ==<br />
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. <br />
<br />
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 [[Reverse Proxy Server 2: SVN2 | '''next page''']].<br />
<br />
'''''[[#top | Top]]'''''<br />
----<br />
<br />
{|<br />
|-valign="middle"<br />
| [[Image:uc_small_logo.gif]] || [[User:Ric|Ric]] <br />
|}<br />
<br />
<br />
[[Category: Uniform Server 5.0-Nano]]</div>Ric