trac on FreeBSD なんだか、SVN Tracの記事が散漫で見にくくなっているので、改訂しる

subversion のインストール

portinstall devel/subversion
# echo svnserve_enable="YES" >> /etc/rc.conf

http://www.caldron.jp/~nabetaro/svn/svnbook-1.5-final/svn-book.html#svn.basic

svn起動

/usr/local/etc/rc.d/svnserve start

Jun  9 14:50:15 blackcube kernel: Starting svnserve.
Jun  9 14:50:15 blackcube kernel: su: 
Jun  9 14:50:15 blackcube kernel: unknown login: svn

http://blog.perl.tv/2007/01/freebsd_60subversion_trac.html

# pw groupadd -n svn -g 90
# pw useradd -n svn -u 90 -g svn -d /nonexistent -s /nonexistent

デフォルトだと svnserve に -r オプションがついているので該当箇所をコメントアウトしておく。

# diff -u /usr/local/etc/rc.d/svnserve.sh.orig /usr/local/etc/rc.d/svnserve.sh
--- /usr/local/etc/rc.d/svnserve.sh.orig Sun Jan 14 17:11:17 2007
+++ /usr/local/etc/rc.d/svnserve.sh Sun Jan 14 17:12:01 2007
@@ -30,6 +30,6 @@
rcvar=`set_rcvar`
load_rc_config $name
command=/usr/local/bin/svnserve
-command_args="-r ${svnserve_data}"
+#command_args="-r ${svnserve_data}"

run_rc_command "$1"

svn再起動

k222# /usr/local/etc/rc.d/svnserve restart
Stopping svnserve.
Starting svnserve.

WordPress ( リポジトリ ) の作成

# mkdir -p /usr/local/var/svn/repos
# svnadmin create /usr/local/var/svn/repos/wordpress
# cd /usr/local/var/svn/repos/wordpress
# mkdir -p tmp/trunk tmp/tags tmp/branches
# chown -R svn:svn /usr/local/var/svn/repos/wordpress

/usr/local/var/svn/repos/wordpress/tmp/trunk へ管理したいデータを入れる。今回は、WordPress で。

blackcube# svn import /usr/local/var/svn/repos/wordpress/tmp/ file:///usr/local/var/svn/repos/wordpress/ -m "Initial import"
 
Adding         /usr/local/var/svn/repos/wordpress/tmp/trunk/wordpress/wp-admin/user/index.php
Adding         /usr/local/var/svn/repos/wordpress/tmp/trunk/wordpress/wp-admin/user/admin.php
Adding         /usr/local/var/svn/repos/wordpress/tmp/trunk/wordpress/wp-admin/user/index-extra.php
Adding         /usr/local/var/svn/repos/wordpress/tmp/trunk/wordpress/wp-feed.php
Adding         /usr/local/var/svn/repos/wordpress/tmp/branches
Adding         /usr/local/var/svn/repos/wordpress/tmp/tags
Committed revision 1.

ここで、TrotoiseSVN(Win)または(Mac)で確認したいところだが、HTTPプロトコールでの確認ができないので、ApacheにDAVを設定。

Apache WebDAV on Subversion †

# vi /usr/local/etc/apache22/Includes/subversion.conf

<Location /svn>
	DAV svn
	SVNParentPath /usr/local/var/svn/repos
	SVNListParentPath On

	<LimitExcept GET PROPFIND OPTIONS REPORT>
		Deny from all
	</LimitExcept>
</Location>

リポジトリ一覧を見せたくない場合は SVNListParentPath? を off にする。

# vi /usr/local/etc/apache22/Includes/subversion.conf

<Location /svn>
	DAV svn
	SVNParentPath /usr/local/var/svn/repos
	SVNListParentPath On

#	<LimitExcept GET PROPFIND OPTIONS REPORT>
	<LimitExcept GET POST OPTIONS PROPFIND MKACTIVITY CHECKOUT MKACTIVITY DELETE PROPPATCH MKCOL MERGE REPORT PUT COPY>
		Deny from all
	</LimitExcept>
</Location>

ココで一応TortoiseSVNで確認。

TortoiseSVN_WP.png このように見ていて居ればおk。一番最初は時間がかかるけど、任意のフォルダへ「チェックアウト」しておく。

trac

portinstall www/trac

使用準備

k222# mkdir -p /usr/local/www/apache22/data/trac/sandbox
k222# trac-admin /usr/local/www/apache22/data/trac/sandbox initenv
Creating a new Trac environment at /usr/local/www/apache22/data/trac/sandbox

Project Name [My Project]> sandbox ( Enter )
Database connection string [sqlite:db/trac.db]> ( Enter )
Repository type [svn]> ( Enter )
Path to repository [/path/to/repos]> /usr/local/var/svn/repos/sandbox ( Enter )
---------------------------------------------------------------------
Warning: couldn't index the repository.

This can happen for a variety of reasons: wrong repository type,
no appropriate third party library for this repository type,
no actual repository at the specified repository path...

You can nevertheless start using your Trac environment, but
you'll need to check again your trac.ini file and the [trac]
repository_type and repository_path settings in order to enable
the Trac repository browser.

---------------------------------------------------------------------
Project environment for 'sandbox' created.

You may now configure the environment by editing the file:

/usr/local/www/apache22/data/trac/sandbox/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

 tracd --port 8000 /usr/local/www/apache22/data/trac/sandbox

Then point your browser to http://localhost:8000/sandbox.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

 http://trac.edgewall.org/

Congratulations!
k222# chown -R www:www /usr/local/www/apache22/data/trac/sandbox

mod_python Install

k222# portinstall www/mod_python3
================================================================================

Also remember to add to your Apache configuration in the appropriate context:

PythonPath "['/path/to/foo', '/path/to/bar']"
AddHandler python-program .py
PythonHandler foobar
PythonDebug On

For more information, see http://www.modpython.org/.

================================================================================

Apache Setting

# vi /usr/local/etc/apache22/httpd.conf

追加。

LoadModule python_module libexec/apache22/mod_python.so

後は見えるように設定。

# vi /usr/local/etc/apache22/Includes/trac.conf

<Location /trac>
	SetHandler mod_python
	PythonHandler trac.web.modpython_frontend
	PythonOption TracEnvParentDir /usr/local/www/apache22/data/trac
	PythonOption TracUriRoot /trac
</Location>

OpenSSH on Subversion

svn専用ユーザを追加する。

# pw groupadd -n svn
# pw useradd -n svn -c "Subversion Comit User" -d /home/svn -g svn -h - -s /bin/sh
# mkdir -p /home/svn/.ssh
# chown -R svn:svn /home/svn

一般ユーザの公開鍵を /home/svn/.ssh にコピーする。 通常の公開鍵だとシェルでのログインも出来てしまうので、 command 等を公開鍵の先頭に追記する。 ( 実際は一行 )

command="svnserve -t --tunnel-user=コミットユーザ名 -r /usr/local/var/svn/repos"
,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-dss AAAAB
(中略)M6BA== ****@examle.com

sshd_config で AllowUsers を設定している場合は svn ユーザを追加する。

# grep AllowUsers /etc/ssh/sshd_config
AllowUsers user svn
# /etc/rc.d/sshd restart
k222# cd /home/svn/
k222# svnadmin create repos
k222# chown -R svn:svn repos

k222# /usr/local/etc/rc.d/svnserve start

vi /etc/rc.conf

svnserve_enable="YES"

k222# k222#

Apache WebDAV on Subversion

# vi /usr/local/etc/apache22/Includes/subversion.conf

<Location /svn>
	DAV svn
	SVNParentPath /usr/local/var/svn/repos
	SVNListParentPath On

	<LimitExcept GET PROPFIND OPTIONS REPORT>
		Deny from all
	</LimitExcept>
</Location>

リポジトリ一覧を見せたくない場合は SVNListParentPath を off にする。

error

k222# trac-admin /usr/local/www/apache22/data/trac/sandbox resync
Resyncing repository history...
Command failed: /usr/local/www/apache22/data/trac/sandbox does not appear to be a Subversion repository.
k222#

http://mishuku.net/archives/2008/04/trac.php

portinstall www/trac-webadmin

TracWebAdmin のeggファイルは添付ファイルにあります。

この添付ファイルをDLし、.zip 拡張子を除去し、プロジェクトのpluginsフォルダへコピー

その後、

chown www:www TracWebAdmin-0.1.2dev_r6060-py2.4.egg

してから、権限を与えたいユーザ が kuji であれば、

k222# trac-admin /usr/local/www/apache22/data/trac/RS_Base permission add kuji TRAC_ADMIN

する。と、『管理』というバーが出てくる。


Counter: 5225, today: 1, yesterday: 0

2015-08-06 (木) 18:07:22



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS