Difference between revisions of "Configuring the biowikifarm subversion repository"

From Biowikifarm Metawiki
Jump to: navigation, search
m (+Adding log edit feature)
Line 12: Line 12:
  
 
Create password file and users:
 
Create password file and users:
 +
<source lang="bash">
 
  sudo htpasswd -c /etc/apache2/dav_svn.passwd user ## only for first user
 
  sudo htpasswd -c /etc/apache2/dav_svn.passwd user ## only for first user
 
  sudo htpasswd /etc/apache2/dav_svn.passwd user1
 
  sudo htpasswd /etc/apache2/dav_svn.passwd user1
 
  sudo htpasswd /etc/apache2/dav_svn.passwd user2 ## etc.
 
  sudo htpasswd /etc/apache2/dav_svn.passwd user2 ## etc.
 +
</source>
  
 
Create access control file and reload:
 
Create access control file and reload:
 +
<source lang="bash">
 
  sudo nano /etc/apache2/dav_svn.authz
 
  sudo nano /etc/apache2/dav_svn.authz
 +
</source>
 +
<blockquote>
 +
<pre>
 
  # Read/write permission for all SVN users:
 
  # Read/write permission for all SVN users:
 
  [/]
 
  [/]
 
  * = rw
 
  * = rw
+
</pre>
 +
</blockquote>
 +
<source lang="bash">
 
  sudo /etc/init.d/apache2 reload
 
  sudo /etc/init.d/apache2 reload
 +
</source>
  
 
Creating SVN-Repository, access only to Webserver:
 
Creating SVN-Repository, access only to Webserver:
 +
<source lang="bash">
 
  sudo mkdir /var/lib/svn
 
  sudo mkdir /var/lib/svn
 
  sudo svnadmin create /var/lib/svn/
 
  sudo svnadmin create /var/lib/svn/
 
  sudo chown -R www-data.www-data /var/lib/svn/
 
  sudo chown -R www-data.www-data /var/lib/svn/
 +
</source>
  
 
Now one can check versions directly inside the browser using https://biowikifarm.net/svn/ or check locally out using a svn client:
 
Now one can check versions directly inside the browser using https://biowikifarm.net/svn/ or check locally out using a svn client:
 +
<source lang="bash">
 
  svn co https://biowikifarm.net/svn/
 
  svn co https://biowikifarm.net/svn/
 +
</source>
  
 
To increase comfort we can ensure that webserver shows the most recent version:
 
To increase comfort we can ensure that webserver shows the most recent version:
 +
<source lang="bash">
 
  sudo htpasswd /etc/apache2/dav_svn.passwd www-data
 
  sudo htpasswd /etc/apache2/dav_svn.passwd www-data
 
  <PASSWORD>
 
  <PASSWORD>
Line 44: Line 58:
 
  (www-data$) svn co https://biowikifarm.net/svn
 
  (www-data$) svn co https://biowikifarm.net/svn
 
  (<PASSWORD> angeben)
 
  (<PASSWORD> angeben)
 +
</source>
  
 
Continuing as normal user, create file /var/lib/svn/hooks/post-commit with:
 
Continuing as normal user, create file /var/lib/svn/hooks/post-commit with:
 +
<source lang="bash">
 
  #!/bin/sh
 
  #!/bin/sh
 
  cd /var/www/v-artenquiz
 
  cd /var/www/v-artenquiz
 
  HOME=/var/www  
 
  HOME=/var/www  
 
  /usr/bin/svn update
 
  /usr/bin/svn update
 
+
</source>
and set this file as executable
+
…and set this file as executable:
 +
<source lang="bash">
 
  sudo chmod +x /var/lib/svn/hooks/post-commit
 
  sudo chmod +x /var/lib/svn/hooks/post-commit
 +
</source>
  
 
By means of this commit-hook, whenever a commit to SVN occurs, www/v-artenquiz is automatically updated as well!
 
By means of this commit-hook, whenever a commit to SVN occurs, www/v-artenquiz is automatically updated as well!
 +
 +
== Adding log edit feature ==
 +
 +
<source lang="bash" >
 +
cd /var/lib/svn/hooks/
 +
# use templates provided by subversion
 +
sudo cp  pre-revprop-change.tmpl pre-revprop-change
 +
# make it executable
 +
sudo chmod +x pre-revprop-change
 +
</source>
 +
Now you are able to edit/or set log entries from a specific subversion revision number <code>-r</code> by:
 +
<source lang="bash" line start="1" highlight="3,5">
 +
cd /path/to/versioned/directory/
 +
# edit log entry with editor
 +
sudo svn propedit -r123 --revprop svn:log
 +
# set log entry
 +
sudo svn propset -r123 --revprop svn:log "new log message"
 +
</source>
 +
See also http://subversion.apache.org/faq.html#change-log-msg.

Revision as of 09:55, 25 March 2011

Configuring a subversion repository, with svn already installed through apt-get, on Debian 5. The procedure was contributed by an anonymous helper. First: in /etc/apache2/mods-enabled/dav_svn.conf enable several lines:

<Location /svn>
DAV svn
SVNPath /var/lib/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
AuthzSVNAccessFile /etc/apache2/dav_svn.authz
</Location>

Create password file and users:

 sudo htpasswd -c /etc/apache2/dav_svn.passwd user ## only for first user
 sudo htpasswd /etc/apache2/dav_svn.passwd user1
 sudo htpasswd /etc/apache2/dav_svn.passwd user2 ## etc.

Create access control file and reload:

 sudo nano /etc/apache2/dav_svn.authz
 # Read/write permission for all SVN users:
 [/]
 * = rw
 sudo /etc/init.d/apache2 reload

Creating SVN-Repository, access only to Webserver:

 sudo mkdir /var/lib/svn
 sudo svnadmin create /var/lib/svn/
 sudo chown -R www-data.www-data /var/lib/svn/

Now one can check versions directly inside the browser using https://biowikifarm.net/svn/ or check locally out using a svn client:

 svn co https://biowikifarm.net/svn/

To increase comfort we can ensure that webserver shows the most recent version:

 sudo htpasswd /etc/apache2/dav_svn.passwd www-data
 <PASSWORD>
 sudo -s
 # chown -R www-data.www-data /var/www/v-artenquiz
 # www-data needs a folder to store svn-configuration:
 sudo mkdir /var/www/.subversion
 sudo chown www-data.www-data /var/www/.subversion/
 su - www-data # change user to www-data
 (www-data$) cd /var/www/v-artenquiz
 (www-data$) svn co https://biowikifarm.net/svn
 (<PASSWORD> angeben)

Continuing as normal user, create file /var/lib/svn/hooks/post-commit with:

 #!/bin/sh
 cd /var/www/v-artenquiz
 HOME=/var/www 
 /usr/bin/svn update

…and set this file as executable:

 sudo chmod +x /var/lib/svn/hooks/post-commit

By means of this commit-hook, whenever a commit to SVN occurs, www/v-artenquiz is automatically updated as well!

Adding log edit feature

cd /var/lib/svn/hooks/
# use templates provided by subversion
sudo cp  pre-revprop-change.tmpl pre-revprop-change 
# make it executable
sudo chmod +x pre-revprop-change

Now you are able to edit/or set log entries from a specific subversion revision number -r by:

1 cd /path/to/versioned/directory/
2 # edit log entry with editor
3 sudo svn propedit -r123 --revprop svn:log
4 # set log entry
5 sudo svn propset -r123 --revprop svn:log "new log message"

See also http://subversion.apache.org/faq.html#change-log-msg.