HowTo to handle SVN repositories creation and access control with Redmine (part 2) » History » Version 1
Nicolas Chuche, 2007-10-21 19:20
1 | 1 | Nicolas Chuche | h1. HowTo to handle SVN repositories creation and access control with Redmine (part 2) |
---|---|---|---|
2 | |||
3 | {{>TOC}} |
||
4 | |||
5 | If you haven't configure redMine and subversion integration, begin with the first part : |
||
6 | [[HowTo to handle SVN repositories creation and access control with Redmine]] |
||
7 | |||
8 | Be careful, the following recipes only work with a fairly recent |
||
9 | redmine/reposman.rb (Rev. 860 and later). They won't work with the |
||
10 | perl version of reposman. |
||
11 | |||
12 | h2. How to automatically update the url of your new repositories in |
||
13 | redMine with reposman ? |
||
14 | |||
15 | You can do that by using the @--url@ argument. |
||
16 | |||
17 | <pre> |
||
18 | ruby ./reposman.rb --redmine-host localhost:3000 --svn-dir /var/svn \ |
||
19 | --url file:///var/svn/ |
||
20 | </pre> |
||
21 | |||
22 | reposman will return to redMine the url of your repository (the url |
||
23 | argument plus the idendified) |
||
24 | |||
25 | Next time you create a project with a repository, reposman will |
||
26 | informe redMine that's done and redMine will save the new repository |
||
27 | information returned by reposman. |
||
28 | |||
29 | h2. What if you want to allow redMine to browse private repository ? |
||
30 | |||
31 | The previous recipes allow you to create repository on the fly and |
||
32 | anonymous browsing. But, if your project is private or if the project |
||
33 | isn't on the same server, you won't be able to browse it in redMine. |
||
34 | |||
35 | h3. redMine and svn are on the same server |
||
36 | |||
37 | If your reposities and redmine are on the same server, you just need |
||
38 | to use the @--url@ option like in the previous item to register the |
||
39 | repository and the @--owner@ argument to set the repository owner to the |
||
40 | mongrel/apache user so that it can parse files. |
||
41 | |||
42 | <pre> |
||
43 | ruby ./reposman.rb --redmine-host localhost:3000 --svn-dir /var/svn \ |
||
44 | --url file:///var/svn/ --owner MONGREL_USER |
||
45 | </pre> |
||
46 | |||
47 | BUT, you won't be able to separate repositories and redMine in the |
||
48 | future (in fact you will be but you need to change the database |
||
49 | manually and that's bad). A better way to do this, if you think you |
||
50 | will need to separate those two servers one day, is to do like you |
||
51 | already have two servers. To do this, read the next recipe. |
||
52 | |||
53 | h3. redMine and svn aren't on the same server |
||
54 | |||
55 | There's more than one way to do this, one could be to use a specific |
||
56 | user to browse the repository with svnserve or svn+ssh but I don't |
||
57 | like this way (don't ask why). Another way is to add a third |
||
58 | access way (we already have svn+ssh for registered users and svnserve |
||
59 | for anonymous users). |
||
60 | |||
61 | In the following, the redmine server is known as redmine.my.domain and |
||
62 | the svn as svn.my.domain. You need to have apache/apache2 and mod_dav_svn on |
||
63 | the svn server. |
||
64 | |||
65 | 1. configure your apache to serve the svn repository just for the redmine server |
||
66 | |||
67 | Just add something like that in your apache.conf or in a file in the |
||
68 | directory /etc/apache/conf.d : |
||
69 | |||
70 | <pre> |
||
71 | LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so |
||
72 | <Location /svn> |
||
73 | DAV svn |
||
74 | # this must be the path you give to reposman with -s,--svn-dir argument |
||
75 | SVNParentPath "/var/svn" |
||
76 | Order allow,deny |
||
77 | Allow from ip.of.my.redmine.server |
||
78 | </Location> |
||
79 | </pre> |
||
80 | |||
81 | Verify you can access it from your redMine server. |
||
82 | |||
83 | 2. change your reposman cron by adding the @--owner@ argument with the apache user : |
||
84 | |||
85 | <pre> |
||
86 | ruby ./reposman.rb --redmine-host http://redmine.my.domain/ --svn-dir /var/svn |
||
87 | --url http://svn.my.domain/svn/ --owner APACHE_USER |
||
88 | </pre> |
||
89 | |||
90 | h2. Web Service and Security |
||
91 | |||
92 | For the moment, the WS is open to everybody and you surely don't want |
||
93 | that someone register project for you. You can block access to the WS |
||
94 | with apache/mongrel (if you don't use apache, I let you do your |
||
95 | homework...) with the Location apache directive like this : |
||
96 | |||
97 | <pre> |
||
98 | <VirtualHost *:80> |
||
99 | ServerName redmine.my.domain |
||
100 | ServerAdmin webmaster@localhost |
||
101 | |||
102 | <Location /sys> |
||
103 | Order allow,deny |
||
104 | Allow from ip.of.my.svn.server |
||
105 | </Location> |
||
106 | |||
107 | ProxyPass / http://localhost:3000/ |
||
108 | ProxyPassReverse / http://localhost:3000/ |
||
109 | </VirtualHost> |
||
110 | </pre> |