Поднимаем svn и web-интерфейс к нему

Сегодня мы поднимем систему контроля версий subversion а также WebSVN для просмотра хранилищ с помощью браузера. Устанавливал это все я на Ubuntu Server 10.04, в качестве web сервера использовал Cherokee.

Установка subversion:

apt-get install subversion


Создаем директорию для хранилищ:

mkdir /srv/svn


Переходим в созданную директорию и создаем хранилища, например, такие:

svnadmin create openemr
svnadmin create vlite


Для того, чтобы сервис subversion работал, добавляем для запуска при старте системы в /etc/rc.local строку:

svnserve --daemon --root /srv/svn


И тоже самое выполняем в консоли. Теперь служба svn запущена и работает на порту 3690. Конечно, можно использовать svn в связке с apache для обеспечения работы по http протоколу, но ставить ради svn тяжеловесный apache как-то не очень удобно.

Настройки доступа к репозитариям нужно менять для каждого из 2х созданных нами хранилищ. Файлы настроек хранятся в директориях conf, там ничего сложного, просто добавляем тех, кто может возвращать свои изменения в хранилище в файл /srv/svn/хранилище/conf/passwd:

[users]
username1 = password
username2 = password


Загружаем первую версию исходников, например, в хранилище openemr:

svn import /var/www/openemr/ file:///srv/svn/openemr/trunk -m "Первая загрузка OpenEMR"


Теперь можно без проблем работать с нашим svn с помощью, например, клиента TortoiseSVN под Windows. Под Linux замечательно работается и консольным клиентом. Почитать на русском языке по использованию subversion можно здесь. Правда, в данной книге рассматривается версия 1.4, но основы там изложены хорошо.

Устанавливаем Cherokee. Я устанавливал из PPA, для краткости — просто добавьте в /etc/apt/sources.list репозитарий:

deb http://ppa.launchpad.net/cherokee-webserver/ppa/ubuntu lucid main 
deb-src http://ppa.launchpad.net/cherokee-webserver/ppa/ubuntu lucid main


Обновляем базу данных пакетов, устанавливаем Cherokee:

apt-get update
apt-get install cherokee cherokee-admin


Также нам нужен будет php и zip (для скачивания исходников в WebSVN):

apt-get install php5 php5-cgi zip


Для краткости привожу здесь готовый конфиг Cherokee, на который нужно заменить содержимое /etc/cherokee/cherokee.conf. Cherokee будет работать на порту 8080, архив WebSVN нужно распаковать в /srv/websvn:

config!version = 001002101
server!bind!1!port = 8080
server!bind!1!tls = 0
server!group = www-data
server!keepalive = 1
server!keepalive_max_requests = 500
server!panic_action = /usr/share/cherokee/cherokee-panic
server!pid_file = /var/run/cherokee.pid
server!server_tokens = full
server!timeout = 15
server!user = www-data
vserver!1!directory_index = index.php
vserver!1!document_root = /srv/websvn
vserver!1!error_writer!filename = /var/log/cherokee/cherokee.error
vserver!1!error_writer!type = file
vserver!1!logger = combined
vserver!1!logger!access!buffsize = 16384
vserver!1!logger!access!filename = /var/log/cherokee/cherokee.access
vserver!1!logger!access!type = file
vserver!1!nick = default
vserver!1!rule!220!handler = file
vserver!1!rule!220!match = directory
vserver!1!rule!220!match!directory = /templates
vserver!1!rule!120!handler = file
vserver!1!rule!120!match = directory
vserver!1!rule!120!match!directory = /javascript
vserver!1!rule!20!encoder!gzip = allow
vserver!1!rule!20!flcache = allow
vserver!1!rule!20!flcache!policy = explicitly_allowed
vserver!1!rule!20!handler = fcgi
vserver!1!rule!20!handler!balancer = round_robin
vserver!1!rule!20!handler!balancer!source!10 = 2
vserver!1!rule!20!handler!error_handler = 1
vserver!1!rule!20!match = extensions
vserver!1!rule!20!match!check_local_file = 1
vserver!1!rule!20!match!extensions = php
vserver!1!rule!20!match!final = 0
vserver!1!rule!20!timeout = 30
vserver!1!rule!10!handler = redir
vserver!1!rule!10!handler!balancer = round_robin
vserver!1!rule!10!handler!balancer!source!10 = 1
vserver!1!rule!10!handler!check_file = 0
vserver!1!rule!10!handler!error_handler = 0
vserver!1!rule!10!handler!iocache = 1
vserver!1!rule!10!handler!pass_req_headers = 1
vserver!1!rule!10!handler!rewrite!10!regex = ^(.*)$
vserver!1!rule!10!handler!rewrite!10!show = 0
vserver!1!rule!10!handler!rewrite!10!substring = ./index.php
vserver!1!rule!10!handler!xsendfile = 0
vserver!1!rule!10!match = default
source!2!env!PHP_FCGI_CHILDREN = 5
source!2!env!PHP_FCGI_MAX_REQUESTS = 490
source!2!env_inherited = 0
source!2!host = 127.0.0.1:47990
source!2!interpreter = /usr/bin/php-cgi -b 127.0.0.1:47990
source!2!nick = PHP Interpreter
source!2!type = interpreter
icons!default = page_white.png
icons!directory = folder.png
icons!file!bomb.png = core
icons!file!page_white_go.png = *README*
icons!parent_directory = arrow_turn_left.png
icons!suffix!camera.png = jpg,jpeg,jpe
icons!suffix!cd.png = iso,ngr,cue
icons!suffix!color_wheel.png = png,gif,xcf,bmp,pcx,tiff,tif,cdr,psd,xpm,xbm
icons!suffix!control_play.png = bin,exe,com,msi,out
icons!suffix!css.png = css
icons!suffix!cup.png = java,class,jar
icons!suffix!email.png = eml,mbox,box,email,mbx
icons!suffix!film.png = avi,mpeg,mpe,mpg,mpeg3,dl,fli,qt,mov,movie,flv,webm
icons!suffix!font.png = ttf
icons!suffix!html.png = html,htm
icons!suffix!music.png = au,snd,mid,midi,kar,mpga,mpega,mp2,mp3,sid,wav,aif,aiff,aifc,gsm,m3u,wma,wax,ra,rm,ram,pls,sd2,ogg
icons!suffix!package.png = tar,gz,bz2,zip,rar,ace,lha,7z,dmg,cpk
icons!suffix!page_white_acrobat.png = pdf
icons!suffix!page_white_c.png = c,h,cpp
icons!suffix!page_white_office.png = doc,ppt,xls
icons!suffix!page_white_php.png = php
icons!suffix!page_white_text.png = txt,text,rtf,sdw
icons!suffix!printer.png = ps,eps
icons!suffix!ruby.png = rb
icons!suffix!script.png = sh,csh,ksh,tcl,tk,py,pl
mime!application/bzip2!extensions = bz2
mime!application/gzip!extensions = gz
mime!application/hta!extensions = hta
mime!application/java-archive!extensions = jar
mime!application/java-serialized-object!extensions = ser
mime!application/java-vm!extensions = class
mime!application/json!extensions = json
mime!application/mac-binhex40!extensions = hqx
mime!application/msaccess!extensions = mdb
mime!application/msword!extensions = doc,dot
mime!application/octet-stream!extensions = bin
mime!application/octetstream!extensions = ace
mime!application/oda!extensions = oda
mime!application/ogg!extensions = ogx
mime!application/pdf!extensions = pdf
mime!application/pgp-keys!extensions = key
mime!application/pgp-signature!extensions = pgp
mime!application/pics-rules!extensions = prf
mime!application/postscript!extensions = ps,ai,eps
mime!application/rar!extensions = rar
mime!application/rdf+xml!extensions = rdf
mime!application/rss+xml!extensions = rss
mime!application/smil!extensions = smi,smil
mime!application/vnd.mozilla.xul+xml!extensions = xul
mime!application/vnd.ms-excel!extensions = xls,xlb,xlt
mime!application/vnd.ms-pki.seccat!extensions = cat
mime!application/vnd.ms-pki.stl!extensions = stl
mime!application/vnd.ms-powerpoint!extensions = ppt,pps
mime!application/vnd.oasis.opendocument.chart!extensions = odc
mime!application/vnd.oasis.opendocument.database!extensions = odb
mime!application/vnd.oasis.opendocument.formula!extensions = odf
mime!application/vnd.oasis.opendocument.graphics!extensions = odg
mime!application/vnd.oasis.opendocument.image!extensions = odi
mime!application/vnd.oasis.opendocument.presentation!extensions = odp
mime!application/vnd.oasis.opendocument.spreadsheet!extensions = ods
mime!application/vnd.oasis.opendocument.text!extensions = odt
mime!application/vnd.oasis.opendocument.text-master!extensions = odm
mime!application/vnd.oasis.opendocument.text-web!extensions = oth
mime!application/vnd.pkg5.info!extensions = p5i
mime!application/vnd.visio!extensions = vsd
mime!application/vnd.wap.wbxml!extensions = wbxml
mime!application/vnd.wap.wmlc!extensions = wmlc
mime!application/vnd.wap.wmlscriptc!extensions = wmlsc
mime!application/x-7z-compressed!extensions = 7z
mime!application/x-abiword!extensions = abw
mime!application/x-apple-diskimage!extensions = dmg
mime!application/x-bcpio!extensions = bcpio
mime!application/x-bittorrent!extensions = torrent
mime!application/x-cdf!extensions = cdf
mime!application/x-cpio!extensions = cpio
mime!application/x-csh!extensions = csh
mime!application/x-debian-package!extensions = deb,udeb
mime!application/x-director!extensions = dcr,dir,dxr
mime!application/x-dvi!extensions = dvi
mime!application/x-flac!extensions = flac
mime!application/x-font!extensions = pfa,pfb,gsf,pcf,pcf.Z
mime!application/x-freemind!extensions = mm
mime!application/x-gnumeric!extensions = gnumeric
mime!application/x-gtar!extensions = gtar,tgz,taz
mime!application/x-gzip!extensions = gz,tgz
mime!application/x-httpd-php!extensions = phtml,pht,php
mime!application/x-httpd-php-source!extensions = phps
mime!application/x-httpd-php3!extensions = php3
mime!application/x-httpd-php3-preprocessed!extensions = php3p
mime!application/x-httpd-php4!extensions = php4
mime!application/x-internet-signup!extensions = ins,isp
mime!application/x-iphone!extensions = iii
mime!application/x-iso9660-image!extensions = iso
mime!application/x-java-jnlp-file!extensions = jnlp
mime!application/x-javascript!extensions = js
mime!application/x-kchart!extensions = chrt
mime!application/x-killustrator!extensions = kil
mime!application/x-koan!extensions = skp,skd,skt,skm
mime!application/x-kpresenter!extensions = kpr,kpt
mime!application/x-kspread!extensions = ksp
mime!application/x-kword!extensions = kwd,kwt
mime!application/x-latex!extensions = latex
mime!application/x-lha!extensions = lha
mime!application/x-lzh!extensions = lzh
mime!application/x-lzx!extensions = lzx
mime!application/x-ms-wmd!extensions = wmd
mime!application/x-ms-wmz!extensions = wmz
mime!application/x-msdos-program!extensions = com,exe,bat,dll
mime!application/x-msi!extensions = msi
mime!application/x-netcdf!extensions = nc
mime!application/x-ns-proxy-autoconfig!extensions = pac
mime!application/x-nwc!extensions = nwc
mime!application/x-object!extensions = o
mime!application/x-oz-application!extensions = oza
mime!application/x-pkcs7-certreqresp!extensions = p7r
mime!application/x-pkcs7-crl!extensions = crl
mime!application/x-python-code!extensions = pyc,pyo
mime!application/x-quicktimeplayer!extensions = qtl
mime!application/x-redhat-package-manager!extensions = rpm
mime!application/x-sh!extensions = sh
mime!application/x-shar!extensions = shar
mime!application/x-shockwave-flash!extensions = swf,swfl
mime!application/x-stuffit!extensions = sit,sea
mime!application/x-sv4cpio!extensions = sv4cpio
mime!application/x-sv4crc!extensions = sv4crc
mime!application/x-tar!extensions = tar
mime!application/x-tcl!extensions = tcl
mime!application/x-tex-pk!extensions = pk
mime!application/x-texinfo!extensions = texinfo,texi
mime!application/x-trash!extensions = ~,bak,old,sik
mime!application/x-troff!extensions = t,tr,roff
mime!application/x-troff-man!extensions = man
mime!application/x-troff-me!extensions = me
mime!application/x-troff-ms!extensions = ms
mime!application/x-ustar!extensions = ustar
mime!application/x-x509-ca-cert!extensions = crt
mime!application/x-xcf!extensions = xcf
mime!application/x-xfig!extensions = fig
mime!application/x-xpinstall!extensions = xpi
mime!application/xhtml+xml!extensions = xhtml,xht
mime!application/xml!extensions = xml,xsl
mime!application/zip!extensions = zip
mime!audio/basic!extensions = au,snd
mime!audio/midi!extensions = mid,midi,kar
mime!audio/mpeg!extensions = mpga,mpega,mp2,mp3,m4a
mime!audio/ogg!extensions = ogg,oga
mime!audio/prs.sid!extensions = sid
mime!audio/x-aiff!extensions = aif,aiff,aifc
mime!audio/x-gsm!extensions = gsm
mime!audio/x-mpegurl!extensions = m3u
mime!audio/x-ms-wax!extensions = wax
mime!audio/x-ms-wma!extensions = wma
mime!audio/x-pn-realaudio!extensions = ra,rm,ram
mime!audio/x-realaudio!extensions = ra
mime!audio/x-scpls!extensions = pls
mime!audio/x-sd2!extensions = sd2
mime!audio/x-wav!extensions = wav
mime!chemical/x-cache!extensions = cac,cache
mime!chemical/x-cache-csf!extensions = csf
mime!chemical/x-cdx!extensions = cdx
mime!chemical/x-cif!extensions = cif
mime!chemical/x-cmdf!extensions = cmdf
mime!chemical/x-cml!extensions = cml
mime!chemical/x-compass!extensions = cpa
mime!chemical/x-crossfire!extensions = bsd
mime!chemical/x-csml!extensions = csml,csm
mime!chemical/x-ctx!extensions = ctx
mime!chemical/x-cxf!extensions = cxf,cef
mime!chemical/x-isostar!extensions = istr,ist
mime!chemical/x-jcamp-dx!extensions = jdx,dx
mime!chemical/x-kinemage!extensions = kin
mime!chemical/x-pdb!extensions = pdb,ent
mime!chemical/x-swissprot!extensions = sw
mime!chemical/x-vamas-iso14976!extensions = vms
mime!chemical/x-vmd!extensions = vmd
mime!chemical/x-xtel!extensions = xtel
mime!chemical/x-xyz!extensions = xyz
mime!image/gif!extensions = gif
mime!image/jpeg!extensions = jpeg,jpg,jpe
mime!image/pcx!extensions = pcx
mime!image/png!extensions = png
mime!image/svg+xml!extensions = svg,svgz
mime!image/tiff!extensions = tiff,tif
mime!image/vnd.djvu!extensions = djvu,djv
mime!image/vnd.wap.wbmp!extensions = wbmp
mime!image/x-icon!extensions = ico
mime!image/x-ms-bmp!extensions = bmp
mime!image/x-photoshop!extensions = psd
mime!image/x-portable-anymap!extensions = pnm
mime!image/x-portable-bitmap!extensions = pbm
mime!image/x-portable-graymap!extensions = pgm
mime!image/x-portable-pixmap!extensions = ppm
mime!image/x-xbitmap!extensions = xbm
mime!image/x-xpixmap!extensions = xpm
mime!image/x-xwindowdump!extensions = xwd
mime!model/iges!extensions = igs,iges
mime!model/mesh!extensions = msh,mesh,silo
mime!model/vrml!extensions = wrl,vrml
mime!text/calendar!extensions = ics,icz
mime!text/comma-separated-values!extensions = csv
mime!text/css!extensions = css
mime!text/h323!extensions = 323
mime!text/html!extensions = html,htm,shtml
mime!text/iuls!extensions = uls
mime!text/mathml!extensions = mml
mime!text/plain!extensions = asc,txt,text,diff,pot
mime!text/richtext!extensions = rtx
mime!text/rtf!extensions = rtf
mime!text/scriptlet!extensions = sct,wsc
mime!text/tab-separated-values!extensions = tsv
mime!text/vnd.sun.j2me.app-descriptor!extensions = jad
mime!text/vnd.wap.wml!extensions = wml
mime!text/vnd.wap.wmlscript!extensions = wmls
mime!text/x-boo!extensions = boo
mime!text/x-c++hdr!extensions = h++,hpp,hxx,hh
mime!text/x-c++src!extensions = c++,cpp,cxx,cc
mime!text/x-chdr!extensions = h
mime!text/x-csh!extensions = csh
mime!text/x-csrc!extensions = c
mime!text/x-dsrc!extensions = d
mime!text/x-haskell!extensions = hs
mime!text/x-java!extensions = java
mime!text/x-literate-haskell!extensions = lhs
mime!text/x-moc!extensions = moc
mime!text/x-pascal!extensions = p,pas
mime!text/x-pcs-gcd!extensions = gcd
mime!text/x-perl!extensions = pl,pm
mime!text/x-python!extensions = py
mime!text/x-setext!extensions = etx
mime!text/x-sh!extensions = sh
mime!text/x-tcl!extensions = tcl,tk
mime!text/x-tex!extensions = tex,ltx,sty,cls
mime!text/x-vcalendar!extensions = vcs
mime!text/x-vcard!extensions = vcf
mime!video/dl!extensions = dl
mime!video/dv!extensions = dif,dv
mime!video/fli!extensions = fli
mime!video/gl!extensions = gl
mime!video/mp4!extensions = mp4
mime!video/mpeg!extensions = mpeg,mpg,mpe
mime!video/ogg!extensions = ogv
mime!video/quicktime!extensions = qt,mov
mime!video/vnd.mpegurl!extensions = mxu
mime!video/webm!extensions = webm
mime!video/x-flv!extensions = flv
mime!video/x-la-asf!extensions = lsf,lsx
mime!video/x-mng!extensions = mng
mime!video/x-ms-asf!extensions = asf,asx
mime!video/x-ms-wm!extensions = wm
mime!video/x-ms-wmv!extensions = wmv
mime!video/x-ms-wmx!extensions = wmx
mime!video/x-ms-wvx!extensions = wvx
mime!video/x-msvideo!extensions = avi
mime!video/x-sgi-movie!extensions = movie
mime!x-conference/x-cooltalk!extensions = ice
mime!x-world/x-vrml!extensions = vrm,vrml,wrl
admin!ows!enabled = 0


Теперь нам нужно подправить настройки WebSVN, чтобы он знал какие репозитарии показывать. Правим /srv/websvn/include/config.php. Мои настройки выглядят так:

$config->addRepository('Выписки', 'file:///srv/svn/vlite');
$config->addRepository('OpenEMR', 'file:///srv/svn/openemr');
$config->addTemplatePath($locwebsvnreal.'/templates/calm/');
$config->setDefaultLanguage('ru');
$config->ignoreUserAcceptedLanguages();
$config->addInlineMimeType('text/plain');
$config->allowDownload();
$config->setDefaultFileDlMode('plain');
$config->setDefaultFolderDlMode('zip');
$config->setMinDownloadLevel(1);
$config->useGeshi();
set_time_limit(0);


Перезапускаем Cherokee, заходим по адресу хост:8080 и видим интерфейс WebSVN:





WebSVN поддерживает подсветку синтаксиса и помогает легко сравнивать различные ревизии:



Вот такие вот дела…

Комментарии (2)

RSS свернуть / развернуть
+
+1
А я уж думал svn никто не девелопит. Вроде как рулят CVS поновее, типа git, Mercurial и иже с ними.
avatar

yababay

  • 18 февраля 2012, 23:53
+
+1
Меня svn вполне устраивает, например. Для небольших коллективов svn вполне подходит.
avatar

Sergei_T

  • 19 февраля 2012, 11:52

Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.