##// END OF EJS Templates
docs: updated svn configuration to prevent 400 errors on certain Apache versions.
marcink -
r2018:2eaa3326 stable
parent child Browse files
Show More
@@ -1,150 +1,167 b''
1 .. _svn-http:
1 .. _svn-http:
2
2
3 |svn| With Write Over HTTP
3 |svn| With Write Over HTTP
4 ^^^^^^^^^^^^^^^^^^^^^^^^^^
4 ^^^^^^^^^^^^^^^^^^^^^^^^^^
5
5
6 To use |svn| with read/write support over the |svn| HTTP protocol, you have to
6 To use |svn| with read/write support over the |svn| HTTP protocol, you have to
7 configure the HTTP |svn| backend.
7 configure the HTTP |svn| backend.
8
8
9 Prerequisites
9 Prerequisites
10 =============
10 =============
11
11
12 - Enable HTTP support inside the admin VCS settings on your |RCE| instance
12 - Enable HTTP support inside the admin VCS settings on your |RCE| instance
13 - You need to install the following tools on the machine that is running an
13 - You need to install the following tools on the machine that is running an
14 instance of |RCE|:
14 instance of |RCE|:
15 ``Apache HTTP Server`` and ``mod_dav_svn``.
15 ``Apache HTTP Server`` and ``mod_dav_svn``.
16
16
17
17
18 Using Ubuntu 14.04 Distribution as an example execute the following:
18 .. tip::
19
20 We recommend using Wandisco repositories which provide latest SVN versions
21 for most platforms. Below is example how to add the wandisco repositories
22 for Ubuntu.
23
24 .. code-block:: bash
25
26 $ sudo sh -c 'echo "deb http://opensource.wandisco.com/ubuntu `lsb_release -cs` svn19" >> /etc/apt/sources.list.d/subversion19.list'
27 $ sudo wget -q http://opensource.wandisco.com/wandisco-debian.gpg -O- | sudo apt-key add -
28 $ sudo apt-get update
29
30
31 Using Ubuntu 14.04/16.04 Distribution as an example execute the following to
32 install required components:
19
33
20 .. code-block:: bash
34 .. code-block:: bash
21
35
22 $ sudo apt-get install apache2 libapache2-mod-svn
36 $ sudo apt-get install apache2 libapache2-mod-svn
23
37
24 Once installed you need to enable ``dav_svn``:
38 Once installed you need to enable ``dav_svn``:
25
39
26 .. code-block:: bash
40 .. code-block:: bash
27
41
28 $ sudo a2enmod dav_svn
42 $ sudo a2enmod dav_svn
29 $ sudo a2enmod headers
43 $ sudo a2enmod headers
30 $ sudo a2enmod authn_anon
44 $ sudo a2enmod authn_anon
31
45
32
46
33 Configuring Apache Setup
47 Configuring Apache Setup
34 ========================
48 ========================
35
49
36 .. tip::
50 .. tip::
37
51
38 It is recommended to run Apache on a port other than 80, due to possible
52 It is recommended to run Apache on a port other than 80, due to possible
39 conflicts with other HTTP servers like nginx. To do this, set the
53 conflicts with other HTTP servers like nginx. To do this, set the
40 ``Listen`` parameter in the ``/etc/apache2/ports.conf`` file, for example
54 ``Listen`` parameter in the ``/etc/apache2/ports.conf`` file, for example
41 ``Listen 8090``.
55 ``Listen 8090``.
42
56
43
57
44 .. warning::
58 .. warning::
45
59
46 Make sure your Apache instance which runs the mod_dav_svn module is
60 Make sure your Apache instance which runs the mod_dav_svn module is
47 only accessible by |RCE|. Otherwise everyone is able to browse
61 only accessible by |RCE|. Otherwise everyone is able to browse
48 the repositories or run subversion operations (checkout/commit/etc.).
62 the repositories or run subversion operations (checkout/commit/etc.).
49
63
50 It is also recommended to run apache as the same user as |RCE|, otherwise
64 It is also recommended to run apache as the same user as |RCE|, otherwise
51 permission issues could occur. To do this edit the ``/etc/apache2/envvars``
65 permission issues could occur. To do this edit the ``/etc/apache2/envvars``
52
66
53 .. code-block:: apache
67 .. code-block:: apache
54
68
55 export APACHE_RUN_USER=rhodecode
69 export APACHE_RUN_USER=rhodecode
56 export APACHE_RUN_GROUP=rhodecode
70 export APACHE_RUN_GROUP=rhodecode
57
71
58 1. To configure Apache, create and edit a virtual hosts file, for example
72 1. To configure Apache, create and edit a virtual hosts file, for example
59 :file:`/etc/apache2/sites-enabled/default.conf`. Below is an example
73 :file:`/etc/apache2/sites-enabled/default.conf`. Below is an example
60 how to use one with auto-generated config ```mod_dav_svn.conf```
74 how to use one with auto-generated config ```mod_dav_svn.conf```
61 from configured |RCE| instance.
75 from configured |RCE| instance.
62
76
63 .. code-block:: apache
77 .. code-block:: apache
64
78
65 <VirtualHost *:8090>
79 <VirtualHost *:8090>
66 ServerAdmin rhodecode-admin@localhost
80 ServerAdmin rhodecode-admin@localhost
67 DocumentRoot /var/www/html
81 DocumentRoot /var/www/html
68 ErrorLog ${'${APACHE_LOG_DIR}'}/error.log
82 ErrorLog ${'${APACHE_LOG_DIR}'}/error.log
69 CustomLog ${'${APACHE_LOG_DIR}'}/access.log combined
83 CustomLog ${'${APACHE_LOG_DIR}'}/access.log combined
84 LogLevel info
85 # allows custom host names, prevents 400 errors on checkout
86 HttpProtocolOptions Unsafe
70 Include /home/user/.rccontrol/enterprise-1/mod_dav_svn.conf
87 Include /home/user/.rccontrol/enterprise-1/mod_dav_svn.conf
71 </VirtualHost>
88 </VirtualHost>
72
89
73
90
74 2. Go to the :menuselection:`Admin --> Settings --> VCS` page, and
91 2. Go to the :menuselection:`Admin --> Settings --> VCS` page, and
75 enable :guilabel:`Proxy Subversion HTTP requests`, and specify the
92 enable :guilabel:`Proxy Subversion HTTP requests`, and specify the
76 :guilabel:`Subversion HTTP Server URL`.
93 :guilabel:`Subversion HTTP Server URL`.
77
94
78 3. Open the |RCE| configuration file,
95 3. Open the |RCE| configuration file,
79 :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini`
96 :file:`/home/{user}/.rccontrol/{instance-id}/rhodecode.ini`
80
97
81 4. Add the following configuration option in the ``[app:main]``
98 4. Add the following configuration option in the ``[app:main]``
82 section if you don't have it yet.
99 section if you don't have it yet.
83
100
84 This enables mapping of the created |RCE| repo groups into special
101 This enables mapping of the created |RCE| repo groups into special
85 |svn| paths. Each time a new repository group is created, the system will
102 |svn| paths. Each time a new repository group is created, the system will
86 update the template file and create new mapping. Apache web server needs to
103 update the template file and create new mapping. Apache web server needs to
87 be reloaded to pick up the changes on this file.
104 be reloaded to pick up the changes on this file.
88 To do this, simply configure `svn.proxy.reload_cmd` inside the .ini file.
105 To do this, simply configure `svn.proxy.reload_cmd` inside the .ini file.
89 Example configuration:
106 Example configuration:
90
107
91
108
92 .. code-block:: ini
109 .. code-block:: ini
93
110
94 ############################################################
111 ############################################################
95 ### Subversion proxy support (mod_dav_svn) ###
112 ### Subversion proxy support (mod_dav_svn) ###
96 ### Maps RhodeCode repo groups into SVN paths for Apache ###
113 ### Maps RhodeCode repo groups into SVN paths for Apache ###
97 ############################################################
114 ############################################################
98 ## Enable or disable the config file generation.
115 ## Enable or disable the config file generation.
99 svn.proxy.generate_config = true
116 svn.proxy.generate_config = true
100 ## Generate config file with `SVNListParentPath` set to `On`.
117 ## Generate config file with `SVNListParentPath` set to `On`.
101 svn.proxy.list_parent_path = true
118 svn.proxy.list_parent_path = true
102 ## Set location and file name of generated config file.
119 ## Set location and file name of generated config file.
103 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
120 svn.proxy.config_file_path = %(here)s/mod_dav_svn.conf
104 ## Used as a prefix to the <Location> block in the generated config file.
121 ## Used as a prefix to the <Location> block in the generated config file.
105 ## In most cases it should be set to `/`.
122 ## In most cases it should be set to `/`.
106 svn.proxy.location_root = /
123 svn.proxy.location_root = /
107 ## Command to reload the mod dav svn configuration on change.
124 ## Command to reload the mod dav svn configuration on change.
108 ## Example: `/etc/init.d/apache2 reload`
125 ## Example: `/etc/init.d/apache2 reload`
109 svn.proxy.reload_cmd = /etc/init.d/apache2 reload
126 svn.proxy.reload_cmd = /etc/init.d/apache2 reload
110 ## If the timeout expires before the reload command finishes, the command will
127 ## If the timeout expires before the reload command finishes, the command will
111 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
128 ## be killed. Setting it to zero means no timeout. Defaults to 10 seconds.
112 #svn.proxy.reload_timeout = 10
129 #svn.proxy.reload_timeout = 10
113
130
114
131
115 This would create a special template file called ```mod_dav_svn.conf```. We
132 This would create a special template file called ```mod_dav_svn.conf```. We
116 used that file path in the apache config above inside the Include statement.
133 used that file path in the apache config above inside the Include statement.
117 It's also possible to manually generate the config from the
134 It's also possible to manually generate the config from the
118 :menuselection:`Admin --> Settings --> VCS` page by clicking a
135 :menuselection:`Admin --> Settings --> VCS` page by clicking a
119 `Generate Apache Config` button.
136 `Generate Apache Config` button.
120
137
121 5. Now only things left is to enable svn support, and generate the initial
138 5. Now only things left is to enable svn support, and generate the initial
122 configuration.
139 configuration.
123
140
124 - Select `Proxy subversion HTTP requests` checkbox
141 - Select `Proxy subversion HTTP requests` checkbox
125 - Enter http://localhost:8090 into `Subversion HTTP Server URL`
142 - Enter http://localhost:8090 into `Subversion HTTP Server URL`
126 - Click the `Generate Apache Config` button.
143 - Click the `Generate Apache Config` button.
127
144
128 This config will be automatically re-generated once an user-groups is added
145 This config will be automatically re-generated once an user-groups is added
129 to properly map the additional paths generated.
146 to properly map the additional paths generated.
130
147
131
148
132
149
133 Using |svn|
150 Using |svn|
134 ===========
151 ===========
135
152
136 Once |svn| has been enabled on your instance, you can use it with the
153 Once |svn| has been enabled on your instance, you can use it with the
137 following examples. For more |svn| information, see the `Subversion Red Book`_
154 following examples. For more |svn| information, see the `Subversion Red Book`_
138
155
139 .. code-block:: bash
156 .. code-block:: bash
140
157
141 # To clone a repository
158 # To clone a repository
142 svn checkout http://my-svn-server.example.com/my-svn-repo
159 svn checkout http://my-svn-server.example.com/my-svn-repo
143
160
144 # svn commit
161 # svn commit
145 svn commit
162 svn commit
146
163
147
164
148 .. _Subversion Red Book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn
165 .. _Subversion Red Book: http://svnbook.red-bean.com/en/1.7/svn-book.html#svn.ref.svn
149
166
150 .. _Ask Ubuntu: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue No newline at end of file
167 .. _Ask Ubuntu: http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
@@ -1,85 +1,88 b''
1 # Auto generated configuration for use with the Apache mod_dav_svn module.
1 # Auto generated configuration for use with the Apache mod_dav_svn module.
2 #
2 #
3 # WARNING: Make sure your Apache instance which runs the mod_dav_svn module is
3 # WARNING: Make sure your Apache instance which runs the mod_dav_svn module is
4 # only accessible by RhodeCode. Otherwise everyone is able to browse
4 # only accessible by RhodeCode. Otherwise everyone is able to browse
5 # the repositories or run subversion operations (checkout/commit/etc.).
5 # the repositories or run subversion operations (checkout/commit/etc.).
6 #
6 #
7 # The mod_dav_svn module does not support subversion repositories which are
7 # The mod_dav_svn module does not support subversion repositories which are
8 # organized in subfolders. To support the repository groups of RhodeCode it is
8 # organized in subfolders. To support the repository groups of RhodeCode it is
9 # required to provide a <Location> block for each group pointing to the
9 # required to provide a <Location> block for each group pointing to the
10 # repository group sub folder. To ease the configuration RhodeCode auto
10 # repository group sub folder. To ease the configuration RhodeCode auto
11 # generates this file whenever a repository group is created/changed/deleted.
11 # generates this file whenever a repository group is created/changed/deleted.
12 # Auto generation can be configured in the ini file. Settings are prefixed with
12 # Auto generation can be configured in the ini file. Settings are prefixed with
13 # ``svn.proxy``.
13 # ``svn.proxy``.
14 #
14 #
15 # To include this configuration into your apache config you can use the
15 # To include this configuration into your apache config you can use the
16 # `Include` directive. See the following example snippet of a virtual host how
16 # `Include` directive. See the following example snippet of a virtual host how
17 # to include this configuration file.
17 # to include this configuration file.
18 #
18 #
19 # <VirtualHost *:8090>
19 # <VirtualHost *:8090>
20 # ServerAdmin webmaster@localhost
20 # ServerAdmin webmaster@localhost
21 # DocumentRoot /var/www/html
21 # DocumentRoot /var/www/html
22 # ErrorLog ${'${APACHE_LOG_DIR}'}/error.log
22 # ErrorLog ${'${APACHE_LOG_DIR}'}/error.log
23 # CustomLog ${'${APACHE_LOG_DIR}'}/access.log combined
23 # CustomLog ${'${APACHE_LOG_DIR}'}/access.log combined
24 # LogLevel info
25 # # allows custom host names, prevents 400 errors on checkout
26 # HttpProtocolOptions Unsafe
24 # Include /path/to/generated/mod_dav_svn.conf
27 # Include /path/to/generated/mod_dav_svn.conf
25 # </VirtualHost>
28 # </VirtualHost>
26 #
29 #
27 # Depending on the apache configuration you may encounter the following error if
30 # Depending on the apache configuration you may encounter the following error if
28 # you are using speecial characters in your repository or repository group
31 # you are using speecial characters in your repository or repository group
29 # names.
32 # names.
30 #
33 #
31 # ``Error converting entry in directory '/path/to/repo' to UTF-8``
34 # ``Error converting entry in directory '/path/to/repo' to UTF-8``
32 #
35 #
33 # In this case you have to change the LANG environment variable in the apache
36 # In this case you have to change the LANG environment variable in the apache
34 # configuration. This setting is typically located at ``/etc/apache2/envvars``.
37 # configuration. This setting is typically located at ``/etc/apache2/envvars``.
35 # You have to change it to an UTF-8 value like ``export LANG="en_US.UTF-8"``.
38 # You have to change it to an UTF-8 value like ``export LANG="en_US.UTF-8"``.
36 # After changing this a stop and start of Apache is required (using restart
39 # After changing this a stop and start of Apache is required (using restart
37 # doesn't work).
40 # doesn't work).
38
41
39 # fix https -> http downgrade with DAV. It requires an header downgrade for
42 # fix https -> http downgrade with DAV. It requires an header downgrade for
40 # https -> http reverse proxy to work properly
43 # https -> http reverse proxy to work properly
41 % if use_https:
44 % if use_https:
42 RequestHeader edit Destination ^https: http: early
45 RequestHeader edit Destination ^https: http: early
43 % else:
46 % else:
44 #RequestHeader edit Destination ^https: http: early
47 #RequestHeader edit Destination ^https: http: early
45 % endif
48 % endif
46
49
47 <Location "${location_root|n}">
50 <Location "${location_root|n}">
48 # The mod_dav_svn module takes the username from the apache request object.
51 # The mod_dav_svn module takes the username from the apache request object.
49 # Without authorization this will be empty and no username is logged for the
52 # Without authorization this will be empty and no username is logged for the
50 # transactions. This will result in "(no author)" for each revision. The
53 # transactions. This will result in "(no author)" for each revision. The
51 # following directives implement a fake authentication that allows every
54 # following directives implement a fake authentication that allows every
52 # username/password combination.
55 # username/password combination.
53 AuthType Basic
56 AuthType Basic
54 AuthName "${rhodecode_realm|n}"
57 AuthName "${rhodecode_realm|n}"
55 AuthBasicProvider anon
58 AuthBasicProvider anon
56 Anonymous *
59 Anonymous *
57 Anonymous_LogEmail off
60 Anonymous_LogEmail off
58 Require valid-user
61 Require valid-user
59
62
60 DAV svn
63 DAV svn
61 SVNParentPath "${parent_path_root|n}"
64 SVNParentPath "${parent_path_root|n}"
62 SVNListParentPath ${"On" if svn_list_parent_path else "Off"|n}
65 SVNListParentPath ${"On" if svn_list_parent_path else "Off"|n}
63
66
64 Allow from all
67 Allow from all
65 Order allow,deny
68 Order allow,deny
66 </Location>
69 </Location>
67
70
68 % for location, parent_path in repo_group_paths:
71 % for location, parent_path in repo_group_paths:
69
72
70 <Location "${location|n}">
73 <Location "${location|n}">
71 AuthType Basic
74 AuthType Basic
72 AuthName "${rhodecode_realm|n}"
75 AuthName "${rhodecode_realm|n}"
73 AuthBasicProvider anon
76 AuthBasicProvider anon
74 Anonymous *
77 Anonymous *
75 Anonymous_LogEmail off
78 Anonymous_LogEmail off
76 Require valid-user
79 Require valid-user
77
80
78 DAV svn
81 DAV svn
79 SVNParentPath "${parent_path|n}"
82 SVNParentPath "${parent_path|n}"
80 SVNListParentPath ${"On" if svn_list_parent_path else "Off"|n}
83 SVNListParentPath ${"On" if svn_list_parent_path else "Off"|n}
81
84
82 Allow from all
85 Allow from all
83 Order allow,deny
86 Order allow,deny
84 </Location>
87 </Location>
85 % endfor
88 % endfor
General Comments 0
You need to be logged in to leave comments. Login now