Difference between revisions of "Configuring the biowikifarm subversion repository"
(→SVN-Repository and post-commit-hook) |
(→SVN-Repository and post-commit-hook) |
||
Line 79: | Line 79: | ||
sudo svn checkout file:///var/lib/svn/LocalSVNextensions /usr/share/mediawikistaging/ext-LOCAL-svn | sudo svn checkout file:///var/lib/svn/LocalSVNextensions /usr/share/mediawikistaging/ext-LOCAL-svn | ||
sudo chown -R www-data.www-data /usr/share/mediawikistaging/ext-LOCAL-svn | sudo chown -R www-data.www-data /usr/share/mediawikistaging/ext-LOCAL-svn | ||
+ | |||
+ | # new for the 1.20 git version with new folder arrangement (this may be temporary, check later) | ||
+ | # first check out into separate folder, then change owner, then move to final extensions folder shared with the git-clone | ||
+ | cd /usr/share/mediawiki20/phase3/ | ||
+ | sudo mkdir ext-LOCAL-svn; cd ext-LOCAL-svn; | ||
+ | sudo svn checkout file:///var/lib/svn/LocalSVNextensions /usr/share/mediawiki20/phase3/ext-LOCAL-svn | ||
+ | sudo chown -R www-data.www-data /usr/share/mediawiki20/phase3/ext-LOCAL-svn | ||
+ | sudo mv /usr/share/mediawiki20/phase3/ext-LOCAL-svn/* /usr/share/mediawiki20/phase3/extensions | ||
+ | sudo rm /usr/share/mediawiki20/phase3/ext-LOCAL-svn -r | ||
</source> | </source> | ||
+ | |||
+ | NEXT STep is: | ||
+ | cd /var/www/testwiki_v20; sudo -u www-data php ./maintenance/update.php --quick --conf ./LocalSettings.php | ||
+ | |||
Continuing as normal user, edit/create file | Continuing as normal user, edit/create file |
Revision as of 21:31, 22 September 2012
This topic is about creating and configuring the repository on the server itself. For help with using or managing subversion, see Help: Subversion.
Contents
Configuration
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>
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
SVN-Repository and post-commit-hook
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 committing to the webserver the most recent version is updated also in server’s repositories (i.e. with every commit from a normal subversion user, the webserver-local checkout is updated by a post-commit later on):
# set password for www-data, use a random password, it will be stored plain text:
sudo htpasswd /etc/apache2/dav_svn.passwd www-data
<PASSWORD>
sudo -s # -s (shell)
# chown -R www-data.www-data /var/www/v-artenquiz
# www-data needs a folder to store svn-configuration (esp. a plaintext password needs to be set and then stored):
sudo mkdir /var/www/.subversion
sudo chown www-data.www-data /var/www/.subversion/
sudo mv /var/www/v-artenquiz /var/www/v-artenquiz-DELETE-ME-LATER
sudo mkdir /var/www/v-artenquiz; cd /var/www/v-artenquiz
sudo svn checkout file:///var/lib/svn/artenquiz /var/www/v-artenquiz
sudo chown -R www-data.www-data /var/www/v-artenquiz
sudo mv /usr/share/mediawiki/ext-LOCAL-svn /usr/share/mediawiki/ext-LOCAL-svn-DELETE-ME-LATER
sudo mkdir /usr/share/mediawiki/ext-LOCAL-svn; cd /usr/share/mediawiki/ext-LOCAL-svn;
sudo svn checkout file:///var/lib/svn/LocalSVNextensions /usr/share/mediawiki/ext-LOCAL-svn
sudo chown -R www-data.www-data /usr/share/mediawiki/ext-LOCAL-svn
sudo mv /usr/share/mediawikistaging/ext-LOCAL-svn /usr/share/mediawikistaging/ext-LOCAL-svn-DELETE-ME-LATER
sudo mkdir /usr/share/mediawikistaging/ext-LOCAL-svn; cd /usr/share/mediawikistaging/ext-LOCAL-svn;
sudo svn checkout file:///var/lib/svn/LocalSVNextensions /usr/share/mediawikistaging/ext-LOCAL-svn
sudo chown -R www-data.www-data /usr/share/mediawikistaging/ext-LOCAL-svn
# new for the 1.20 git version with new folder arrangement (this may be temporary, check later)
# first check out into separate folder, then change owner, then move to final extensions folder shared with the git-clone
cd /usr/share/mediawiki20/phase3/
sudo mkdir ext-LOCAL-svn; cd ext-LOCAL-svn;
sudo svn checkout file:///var/lib/svn/LocalSVNextensions /usr/share/mediawiki20/phase3/ext-LOCAL-svn
sudo chown -R www-data.www-data /usr/share/mediawiki20/phase3/ext-LOCAL-svn
sudo mv /usr/share/mediawiki20/phase3/ext-LOCAL-svn/* /usr/share/mediawiki20/phase3/extensions
sudo rm /usr/share/mediawiki20/phase3/ext-LOCAL-svn -r
NEXT STep is:
cd /var/www/testwiki_v20; sudo -u www-data php ./maintenance/update.php --quick --conf ./LocalSettings.php
Continuing as normal user, edit/create file
sudo nano /var/lib/svn/hooks/post-commit
with:
#!/bin/sh
REPOS="$1"
REV="$2"
HOME=/var/www # define HOME for settings in $HOME/.subversion
cd /var/www/v-artenquiz; /usr/bin/svn update
cd /usr/share/mediawiki/ext-LOCAL-svn; /usr/bin/svn update
cd /usr/share/mediawikistaging/ext-LOCAL-svn; /usr/bin/svn update
… and set this file as executable:
sudo chmod +x /var/lib/svn/hooks/post-commit
By means of this post-commit-hook, whenever a commit to SVN occurs, www/v-artenquiz is automatically updated as well!
Adding new directories
Adding new directories to the repository, the easiest way is to use a GUI like TortoiseSVN (Windows) or kdesvn (Linux KDE).
- check out the repository
- add or copy your folders you wish to add to the repository and add them to subversion control first (now subversion add them to version control)
- commit those new files or folders (needs a user account in dav)
An alternative is to use svn import in command line with
sudo svn import LocalSVNextensions file:///var/lib/svn/LocalSVNextensions -m 'import of mediawiki LocalSVNextensions'
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.