Today I tell you how configure Trac and SVN for developers.
Goals:
Start implementation.
SVN:
Goals:
- We have SVN repository and Trac on first (old) server
- We installed SVN on second (new) server
- We have python on second (new) server
- We need move SVN repository from first (old) to second server
- We need move Trac from first to second (new) server
- We need configure SVN repository with Trac
Start implementation.
SVN:
- Create dump SVN repository on our first server
- Open directory with SVN repository, example: “cd /home/svn/”
- Create dump SVN repository, example: “svnadmin dump myrepo > myrepodump”.
Where “myrepo” name our repository.
- Copy dump SVN repository from first server to second server. For example: you can use command “wged”
- Open second server
- Open directory for SVN, example: “cd /home/svn/”
Note: we think that path equals on both servers - Copy SVN repository from old server to new, example:
“wget http://test.org/myrepodump”
- Create new SVN repository and load dump
- Create repository, example: “svnadmin create /home/svn/myrepo”
- Load from dump, example: “svnadmin load myrepo < myrepodump”
- Configure SVN repository access
- Access denied for anonymous users, example:
“nano /home/svn/myrepo/conf/svnserve.conf”
Write next line:
anon-access = none
auth-access = write
realm = myrepo repo
added password-db = passwd - Add user/password in SVN repository, example:
“nano /home/svn/myrepo/conf/passwd”
- Start SVN service on server
- You can use “xinetd”-service
Create file "/etc/xinetd.d/svn"
service svn
{
disable = no
socket_type = stream
wait = no
user = svn
group = svn
groups = yes
port = 3690
server = /usr/bin/svnserve
server_args = -i -r /home/svn
log_on_failure += USERID
}
Restart “xinetd”-service: “/etc/init.d/xinetd restart” - Or you can run SVN manual, example: “svnserve -d -r /home/svn/”
- Download Trac, example:
“cd /usr/src/”
“copy http://ftp.edgewall.com/pub/trac/trac-0.10.5.tar.gz” - Extract Trac from archive, example:
“tar xvzf Trac-0.10.5.tar.gz” - Install Trac:
“cd trac-0.10.5/”
“python ./setup.py install” - Create directory for Trac, example: "/home/trac/"
- Configure Trac environment, example:
“trac-admin /home/trac/ initenv”
Project Name [My Project]> myproject
Database connection string [sqlite:db/trac.db]>
Repository type [svn]> svnTemplates directory [/usr/share/trac/templates]> - Configure ".htpasswd" in Trac directory (add users), example:
“cd /home/trac/”
“/usr/local/apache/bin/htpasswd .htpasswd new_user” , where new_user - username - Download trac database and file attachments from old server to new server
- Open old server (first server)
- Open Trac directory, example: “cd /home/trac/”
- Create archive attachments directory, example: “tar cvzf attachments.bak attachments”
- Create dump Trac database, example: “sqlite3 /home/trac/db/trac.db ".dump" >> sqlite_trac.sql”
- Open new server (second server)
- Download “attachments.bak” and “sqlite_trac.sql” from first server, example:
“cd /home/trac/”
“wget http:// test.org /attachments.bak”
“wget http:// test.org /sqlite_trac.sql” - Extract database dump, example:
“cat sqlite_trac.sql | sqlite3 trac.db”
“cp trac.db /home/trac/db/” - Extract attachments from archive, example:
“tar xvzf attachments.bak”
- On new server open port 8000
- Configure trac.ini
- Open trac.ini, example: "nano /home/trac/conf/trac.ini"
- Change “repository_dir”, example: “repository_dir = /home/svn/myrepo”
- Create create post-commit in SVN repository, example:
- Filename: "/home/svn/myrepo/hooks/post-commit"
- Text in file:
/usr/bin/python /usr/src/trac-0.10.5/contrib/trac-post-commit-hook -p "/home/trac/" -r "$REV" -s "http://test.org:8000"
Where “http://test.org:8000” – URL for Trac - Set “0774” permission on file "/home/svn/myrepo/hooks/post-commit"
- Run trac with apache '.htpasswd', example:
“/usr/bin/python /usr/bin/tracd -d -p 8000 --basic-auth=*,/home/trac/.htpasswd,myproject /home/trac” - Sync Trac “Browse Source” with SVN repository, example:
“trac-admin /home/trac/ resync”
- Create new ticket in Track, example: “#1 Test work Trac with SVN”
- When you commit file in SVN in comments write: “refs #1”
- After this your comments appends to Trac ticket #1
- You open in Trac ticket #1 and see link to your SVN revision
- COOL!
- Check post-commit hook in line command:
“/usr/bin/python /usr/src/trac-0.10.5/contrib/trac-post-commit-hook -p "/home/trac" -r "$1" 2>&1 1>> /home/trac/log2.txt” - Add new developer on project:
- Create new entry in “/home/trac/.htpasswd”, example:
“/usr/local/apache/bin/htpasswd .htpasswd new_user” - Add "developer" permissions to new_user, example:
“trac-admin /home/trac permission add new_user developer” - Links
http://trac.edgewall.org/
http://subversion.tigris.org/
No comments:
Post a Comment