May 29, 2006
[Trac] Trac にチャレンジ
Trac とは
Trac は Web インターフェースの Wiki + BugTracker + Subversion Viewer。 聞くところによると結構便利らしい。 WebSVN をインストールしようかと思っていたのだけれど、どうせなら BugTracker も一緒に欲しいということで Trac にしてみた。
- Trac
- http://www.edgewall.com/trac/
- The Trac Configuration File
- http://projects.edgewall.com/trac/wiki/TracIni
Trac のインストールや設定は以下のサイトを参考にさせていただいた。多謝。 (参考というより、指示通りに作業しただけ・・・)
- 鷹の島 - Trac をインストールしてみたよ
- http://espion.just-size.jp/archives/05/297225719.html
- [trac] default_charset
- http://zippo.taiyo.co.jp/~gotoh/diary/?200502a&to=200502023#200502023
Trac のインストール
Trac を Debian Sarge にインストールしたときのメモ。 Debian では apt で Trac をインストールできる。便利。 Trac 本体と Python でマルチバイトを扱うライブラリをインストールする。
# apt-get install trac Reading Package Lists... Done Building Dependency Tree... Done The following extra packages will be installed: libsqlite0 python python-clearsilver python-sqlite python2.3 python2.3-clearsilver python2.3-sqlite python2.3-subversion Suggested packages: python-doc python-tk python-profiler python2.3-doc python2.3-profiler enscript python-docutils Recommended packages: python2.3-iconvcodec python2.3-cjkcodecs python2.3-japanese-codecs python-egenix-mxdatetime The following NEW packages will be installed: libsqlite0 python python-clearsilver python-sqlite python2.3 python2.3-clearsilver python2.3-sqlite python2.3-subversion trac 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 4654kB of archives. After unpacking 15.7MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://www.jp.debian.org sarge/main libsqlite0 2.8.16-1 [176kB] Get:2 http://www.jp.debian.org sarge/main python2.3 2.3.5-3sarge1 [2906kB] Get:3 http://www.jp.debian.org sarge/main python 2.3.5-2 [127kB] Get:4 http://www.jp.debian.org sarge/main python2.3-clearsilver 0.9.13-3.2 [81.0kB] Get:5 http://www.jp.debian.org sarge/main python-clearsilver 0.9.13-3.2 [4820B] Get:6 http://www.jp.debian.org sarge/main python2.3-sqlite 1.0.1-2 [29.1kB] Get:7 http://www.jp.debian.org sarge/main python-sqlite 1.0.1-2 [2608B] Get:8 http://www.jp.debian.org sarge/main python2.3-subversion 1.1.4-2 [1130kB] Get:9 http://www.jp.debian.org sarge/main trac 0.8.1-3sarge4 [199kB] Fetched 4654kB in 22s (209kB/s) Preconfiguring packages ... ...略 # apt-get install python2.3-japanese-codecs Reading Package Lists... Done Building Dependency Tree... Done The following NEW packages will be installed: python2.3-japanese-codecs 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 273kB of archives. After unpacking 1237kB of additional disk space will be used. Get:1 http://www.jp.debian.org sarge/main python2.3-japanese-codecs 1.4.9-3 [273kB] Fetched 273kB in 1s (241kB/s) Selecting previously deselected package python2.3-japanese-codecs. (Reading database ... 15287 files and directories currently installed.) Unpacking python2.3-japanese-codecs (from .../python2.3-japanese-codecs_1.4.9-3_i386.deb) ... Setting up python2.3-japanese-codecs (1.4.9-3) ... #
Trac の設定
Trac プロジェクトの作成
# mkdir /tmp/trac # cd /tmp/trac # trac-admin myprojects initenv Creating a new Trac environment at /tmp/trac/myprojects Trac will first ask a few questions about your environment in order to initalize and prepare the project database. Please enter the name of your project. This name will be used in page titles and descriptions. Project Name [My Project]> my projects Please specify the absolute path to the project Subversion repository. Repository must be local, and trac-admin requires read+write permission to initialize the Trac database. Path to repository [/var/svn/test]> /var/svn/svndb Please enter location of Trac page templates. Default is the location of the site-wide templates installed with Trac. Templates directory [/usr/share/trac/templates]> Creating and Initializing Project Inserting default data Configuring Project trac.repository_dir ...略 Congratulations! # chown -R www-data:www-data /tmp/trac
Trac と Apache2 の連携
私の環境では、Trac のメインの用途は Subversion に対する Web インターフェースとなる。 そのため、Trac も Subversion と同一のユーザを使用することにした。 また、アクセス元制限もついでにかけておくことに。
# cat /etc/apache2/sites-available/trac Alias /trac "/usr/share/trac/htdocs/" ScriptAlias /proj "/usr/share/trac/cgi-bin/trac.cgi" <Location "/proj"> SetEnv TRAC_ENV "/tmp/trac/myprojects" SSLRequireSSL AuthType Basic AuthName "please login" AuthUserFile /var/svn/svndb/.svnpasswd Require valid-user order allow,deny allow from 192.168.1. </Location> <Location "/trac"> SSLRequireSSL AuthType Basic AuthName "please login" AuthUserFile /var/svn/svndb/.svnpasswd Require valid-user order allow,deny allow from 192.168.1. </Location> # a2ensite trac Site trac installed; run /etc/init.d/apache2 reload to enable. # /etc/init.d/apache2 reload Reloading web server config...done.cts" #
Trac の設定
Trac 画面のヘッダ、フッタを設定する。 Subversion 内のファイルの文字エンコーディングも設定する。
# cat /tmp/trac/myprojects/conf/trac.ini [header_logo] src = trac_banner.png alt = my projects height = 73 link = https://www.example.com/proj width = 236 [trac] default_charset = japanese.shift_jis ...略 #