|
|
(8 intermediate revisions by the same user not shown) |
Line 6: |
Line 6: |
| | | |
| | | |
− | =SVN server (Linux)= | + | =Setup SVN server= |
| | | |
| ==installation== | | ==installation== |
Line 29: |
Line 29: |
| | | |
| | | |
− | ==Server automatic startup== | + | ==Automatic startup== |
| | | |
| | | |
Line 116: |
Line 116: |
| | | |
| | | |
− | ==Create SVN repository==
| + | |
| + | =Create SVN repository= |
| | | |
| To do any advanced task, you've to use "svnadmin" | | To do any advanced task, you've to use "svnadmin" |
Line 125: |
Line 126: |
| | | |
| | | |
− | ===1. Create root folder===
| + | ==1. Create root folder== |
| | | |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
Line 141: |
Line 142: |
| | | |
| | | |
− | ===2. Adjust rights===
| + | ==2. Adjust rights== |
| | | |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| + | mkdir -p /var/svn/myRepo/conf/ |
| vim /var/svn/myRepo/conf/svnserve.conf | | vim /var/svn/myRepo/conf/svnserve.conf |
| </syntaxhighlight> | | </syntaxhighlight> |
Line 149: |
Line 151: |
| Adjust values: | | Adjust values: |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
− | anon-access = none → disable anonymous access | + | anon-access = none |
− | auth-access = write → allow read / write to all users | + | auth-access = write |
− | password-db = passwd → password required to log-in | + | password-db = passwd |
− | realm = 'java' → Name of the current repo (without quotes!) | + | realm = 'java' |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | ===3. Create users===
| + | ==3. Create users== |
| | | |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
Line 164: |
Line 166: |
| | | |
| | | |
− | ===Repository access===
| + | ==Repository access== |
| You can use the repository with the following SVN URL: svn://server/''java'' | | You can use the repository with the following SVN URL: svn://server/''java'' |
| | | |
Line 170: |
Line 172: |
| | | |
| | | |
− | =Web access (Linux)=
| |
− |
| |
− | ==Required packages==
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | # Apache2 modules
| |
− | apt-get install libapache2-mod-svn
| |
− | apt-get install libapache2-mod-ldap-userdir
| |
− | # Enable modules
| |
− | a2emod dav_svn
| |
− | a2enmod ldap authnz_ldap ldap_userdir
| |
− | # Restart server
| |
− | service apache2 restart
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− |
| |
− | ==Configuration==
| |
− |
| |
− | You have 2 solutions to setup the SVN dav.
| |
− | * Use the /etc/apache2/mods-enabled/'''dav.conf'''
| |
− | * VirtualHost configuration
| |
− |
| |
− | From a maintenance point of view it's '''better to use the VirtualHost configuration'''.
| |
− |
| |
− |
| |
− | Add the following declaration:
| |
− |
| |
− | <syntaxhighlight lang="apache">
| |
− | <Location /svn>
| |
− | <IfModule dav_svn_module>
| |
− | # Enable DAV module
| |
− | DAV svn
| |
− |
| |
− | # SVN root
| |
− | SVNParentPath /var/svn
| |
− | SVNListParentPath On
| |
− |
| |
− | # LDAP authentication
| |
− | AuthType Basic
| |
− | AuthName "SVN Repository"
| |
− | AuthBasicProvider ldap
| |
− | AuthLDAPURL "ldap://localhost:389/ou=people,dc=vehco,dc=com?uid"
| |
− | Require valid-user
| |
− | #Require ldap-group cn=vehco_staff
| |
− | </IfModule>
| |
− | </Location>
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | !! Note that is it recommended to AVOID ''"/svn"'' !!
| |
− |
| |
− |
| |
− |
| |
− | Reload apache2 server
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | service apache2 restart
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | ==Firewall==
| |
− |
| |
− | You need to adjust your FW if you plan to serve SVN by HTTP.
| |
| | | |
| + | =Upgrade repository (Linux)= |
| | | |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
− | IPT=`which iptables`
| + | cd /var/svn/ |
− | # Only serve SVN by HTTP to some servers
| + | svnadmin upgrade myRepo |
− | CODE_VEHCO_COM=192.168.1.45
| |
− | PROXY_VEHCO_COM=192.168.1.44
| |
− | | |
− | $IPT -A INPUT -p tcp --dport 80 -s $CODE_VEHCO_COM -j ACCEPT
| |
− | $IPT -A INPUT -p tcp --dport 80 -s $PROXY_VEHCO_COM -j ACCEPT
| |
− | $IPT -A INPUT -p tcp --dport 80 -s 0.0.0.0/0 -j DROP # DROP all the rest !
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
| | | |
| + | Then you can check the SVN repository version: |
| | | |
− | ==Web access==
| |
− |
| |
− | Now instead of “svn://” + dedicated SVN user you can use “https://myServer/dav_svn/” + LDAP user.
| |
− |
| |
− | try http://myServer/svn
| |
− |
| |
− |
| |
− |
| |
− | ==Improving website==
| |
− |
| |
− | Source: http://www.reposstyle.com/
| |
− |
| |
− | >>Summary<<
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | cd /var/www/
| |
− | wget http://downloads.sourceforge.net/project/reposserver/reposstyle/repos-style-with-plugins-2.4.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Freposserver%2Ffiles%2Freposstyle%2F&ts=1410467806&use_mirror=optimate
| |
− | mv repos-style-with-plugins-2.4.zip\?r\=http%3A%2F%2Fsourceforge.net%2Fprojects%2Freposserver%2Ffiles%2Freposstyle%2F repos-style-with-plugins-2.4.zip
| |
− |
| |
− | # unzip the archive
| |
− | unzip repos-style-with-plugins-2.4.zip
| |
− | rm repos-style-with-plugins-2.4.zip
| |
− |
| |
− | # set rights
| |
− | chown -R www-data:www-data /var/www/
| |
− |
| |
− | # Update VHost
| |
− |
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =SVN server (Windows)=
| |
− |
| |
− |
| |
− | ==Installation==
| |
− | * Download Visual SVN server for windows: http://www.visualsvn.com/server/download/
| |
− | * Install Visual SVN server. Choose your installation folder + repository directory
| |
− |
| |
− |
| |
− | ==Users / groups configuration==
| |
− | * Open the '''Visual SVN server''' application.
| |
− | * Open properties
| |
− | Action > Properties
| |
− | [[File:SVN server windows 1.png|none|Windows SVN server 01]]
| |
− |
| |
− | *Click Repositories, adjust “Everyone” rights to Read Only
| |
− | [[File:SVN server windows 2.png|none|Windows SVN server 02]]
| |
− |
| |
− | * Add a new user and add 'read / write' permissions to this new user
| |
− | [[File:SVN server windows 3.png|none|Windows SVN server 03]]
| |
− |
| |
− | [[File:SVN server windows 4.png|none|Windows SVN server 04]]
| |
− |
| |
− |
| |
− | ==Create a new repository (1) – standalone use==
| |
− | Right click on “repositories” -> create New Repository
| |
− | [[File:SVN server windows 5.png|none|Windows SVN server 05]]
| |
− |
| |
− | Enter the repository name and let the server create the default structure for you:
| |
− | [[File:SVN server windows 6.png|none|Windows SVN server 06]]
| |
− |
| |
− | → Note the SVN URL. You’ll need it later when you’re gonna setup your project, within the maven pom.
| |
− |
| |
− |
| |
− | ==Create a new repository (2) – mirror Google Code==
| |
− | Google provides a free subversion service through its “Google Code” service. However, there’s no quality analysis. … So, in order to provide quality checks we will mirror the google code repository.
| |
− |
| |
− | Therefore, we’ll be able to perform quality scans.
| |
− |
| |
− | * Create a new repository, see previous chapter
| |
− | [[File:SVN server windows 7.png|none|Windows SVN server 07]]
| |
− |
| |
− | * Right click on the repository -> All tasks -> Manage hooks
| |
− | [[File:SVN server windows 8.png|none|Windows SVN server 08]]
| |
− |
| |
− | You have to '''edit''' the “pre-revision property change hook” and put the following command:
| |
− | <syntaxhighlight lang="bash">
| |
− | exit 0
| |
− | </syntaxhighlight>
| |
− |
| |
− | This will check that the execution (synchronization) was successful.
| |
− | [[File:SVN server windows 9.png|none|Windows SVN server 09]]
| |
− |
| |
− |
| |
− |
| |
− | =SVN client=
| |
− | The SVN client version must match the server version for better performances and to avoid errors.
| |
− |
| |
− |
| |
− | ==Windows==
| |
− | Tortoise SVN is the best one available.
| |
− | http://tortoisesvn.tigris.org/
| |
− |
| |
− | !! During installation, don't forget to install the '''svn command line tools''' !!
| |
− |
| |
− |
| |
− | ==Linux==
| |
− |
| |
− | ===Command line client===
| |
− | <syntaxhighlight lang="bash">
| |
− | apt-get install subversion
| |
− | </syntaxhighlight>
| |
− | Then you can use the ''svn'' command:
| |
− | * svn co --username=''yourUserName'' --password=''yourpassword'' http://path-to-your-svn
| |
− | * svn add ''file''
| |
− | * svn commit -m "my revision comment"
| |
− |
| |
− | ===Graphical client===
| |
− | RabbitVCS is a good alternative to tortoise SVN: http://rabbitvcs.org/
| |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
− | apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus
| + | cat /var/svn/myRepo/db/format |
| </syntaxhighlight> | | </syntaxhighlight> |
SVN is used to managed file revisions, branches and application releases.
You have to install a SVN server, then a client on each remote computer.
Setup SVN server
installation
Required package
apt-get install subversion
Source folder
You must indicate to subversion how it's going to work
mkdir /var/svn
mkdir /var/svn/myRepository
Set rights
chown -R www-data:www-data /var/svn/myRepository
chmod -R 777 /var/svn/myRepository
→ Use "www-data" user:group if you want to setup web access through HTTP(S) protocol later on.
Automatic startup
Create SVN startup script
vim /etc/init.d/subversionServer
Put the following content
#!/bin/sh
### BEGIN INIT INFO
# Provides: svn
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SVN server
### END INIT INFO
do_start () {
svnserve -d -r /var/svn --pid-file /var/run/svnserve.pid
}
do_stop () {
start-stop-daemon --stop --quiet --pidfile /var/run/svnserve.pid
}
case "$1" in
start)
do_start
;;
stop)
do_stop
exit $?
;;
restart)
do_stop
sleep 1s
do_start
;;
*)
echo "Usage: $0 start|stop|restart" >&2
exit 3
;;
esac
Set execution flags:
chmod 750 /etc/init.d/subversionServer
Create symlinks:
ln -s /etc/init.d/subversionServer /usr/bin/subversionServer
Update boot sequence
Register SVN server to server startup
cd /etc/init.d
update-rc.d subversionServer defaults
Start SVN server
/etc/init.d/subversionServer start
How to remove SVN from boot?
Just execute the following sequence
update-rc.d -f subversionServer remove
Create SVN repository
To do any advanced task, you've to use "svnadmin"
To create repository you have to:
1. Create folder
2. Defines rights
3. Creates users
1. Create root folder
svnadmin create /var/svn/myRepo
Create repo structure
cd /var/svn/myRepo
mkdir trunk
mkdir tags
mkdir branches
chmod -R 755 */
2. Adjust rights
mkdir -p /var/svn/myRepo/conf/
vim /var/svn/myRepo/conf/svnserve.conf
Adjust values:
anon-access = none
auth-access = write
password-db = passwd
realm = 'java'
3. Create users
vim /var/svn/myRepo/conf/passwd
Restart your server to use the new repository.
Repository access
You can use the repository with the following SVN URL: svn://server/java
Upgrade repository (Linux)
cd /var/svn/
svnadmin upgrade myRepo
Then you can check the SVN repository version:
cat /var/svn/myRepo/db/format