http://hdknr.posterous.com/mercurial-install-on-a-virtualenv で Mercurialがvirtualenvにすんなりはいったので、
apacheで動かしてみる。
(
hg)hdknr@deblen:~/.ve/hg$ mkdir repos
(
hg)hdknr@deblen:~/.ve/hg$ ls -al
合計 28
drwxr-xr-x 7 hdknr hdknr 4096 2009-10-23 11:10 .
drwxr-xr-x 10 hdknr hdknr 4096 2009-10-23 11:00 ..
drwxr-xr-x 2 hdknr hdknr 4096 2009-10-23 11:05 bin
drwxr-xr-x 2 hdknr hdknr 4096 2009-10-23 11:00 include
drwxr-xr-x 3 hdknr hdknr 4096 2009-10-23 11:00 lib
drwxr-xr-x 2 hdknr hdknr 4096 2009-10-23 11:10 repos
drwxr-xr-x 3 hdknr hdknr 4096 2009-10-23 11:00 src
レポジトリ初期化。
(
hg)hdknr@deblen:~/.ve/hg/repos$ hg init
(
hg)hdknr@deblen:~/.ve/hg/repos$ date > readme.txt
(
hg)hdknr@deblen:~/.ve/hg/repos$ hg status
? readme.txt
(
hg)hdknr@deblen:~/.ve/hg/repos$ hg add readme.txt
(
hg)hdknr@deblen:~/.ve/hg/repos$ hg status
A readme.txt
(
hg)hdknr@deblen:~/.ve/hg/repos$ hg commit -u hdknr -m "hello"
(
hg)hdknr@deblen:~/.ve/hg/repos$ hg status
設定ファイル作成。
(
hg)hdknr@deblen:~/.ve/hg$ cat > hgweb.config
[collections]
repos/ = /home/hdknr/.ve/hg/repos/
WSGIスクリプト準備。
(
hg)hdknr@deblen:~/.ve/hg$ find src/mercurial-stable/ -name "hgwebdir.*" -print
src/mercurial-stable/contrib/hgwebdir.fcgi
src/mercurial-stable/contrib/hgwebdir.wsgi
src/mercurial-stable/hgwebdir.cgi
src/mercurial-stable/.hg/store/data/contrib/hgwebdir.fcgi.i
src/mercurial-stable/.hg/store/data/contrib/hgwebdir.wsgi.i
src/mercurial-stable/.hg/store/data/hgwebdir.cgi.i
(
hg)hdknr@deblen:~/.ve/hg$ cp src/mercurial-stable/contrib/hgwebdir.wsgi .
(
hg)hdknr@deblen:~/.ve/hg$ vi hgwebdir.wsgi
#application = hgwebdir('hgweb.config')
# by HDKNR
CONFIG='/home/hdknr/.ve/hg/hgweb.config'
application = hgwebdir(CONFIG)
hg.deb というapache仮想サーバーを作成
(
hg)hdknr@deblen:~/.ve/hg$ tree apache/
apache/
|-- conf
| |-- httpd.conf
| `-- httpd.conf.d
| |-- hg.conf
| `-- wsgi.def
|-- logs
| |-- access.log
| `-- error.log
`-- www
`-- index.html
にして、
(
hg)hdknr@deblen:~/.ve/hg$ ls -l /etc/apache2/sites-enabled/hg.deb.conf
lrwxrwxrwx 1 root root 41 2009-10-23 11:48 /etc/apache2/sites-enabled/hg.deb.conf -> /home/hdknr/.ve/hg/apache/conf/httpd.conf
とする。
wsgi プロセスをapacheに認識させる。
(
hg)hdknr@deblen:~/.ve/hg$ vi apache/conf/httpd.conf
<VirtualHost *:80>
#Basic
ServerAdmin
admin@hg.deb ServerName hg.deb
DocumentRoot /home/hdknr/.ve/hg/apache/www/
#Log
ErrorLog /home/hdknr/.ve/hg/apache/logs/error.log
LogLevel warn
CustomLog /home/hdknr/.ve/hg/apache/logs/access.log combined
# Virtual Directories and Others
Include /home/hdknr/.ve/hg/apache/conf/httpd.conf.d/wsgi.def
Include /home/hdknr/.ve/hg/apache/conf/httpd.conf.d/*.conf
</VirtualHost>
こんな感じで、プロセス名は "v_hg"。
(
hg)hdknr@deblen:~/.ve/hg$ vi apache/conf/httpd.conf.d/wsgi.def
WSGIDaemonProcess v_hg user=www-data group=www-data threads=25 ¥
python-path=/home/hdknr/.ve/hg/lib/python2.5/site-packages/:/home/hdknr/.ve/hg/bin
/hg という仮想ディレクトリをWSGIScriptAliasで定義。
(
hg)hdknr@deblen:~/.ve/hg$ vi apache/conf/httpd.conf.d/hg.conf
WSGIScriptAlias /hg /home/hdknr/.ve/hg/hgwebdir.wsgi
<Location /hg >
WSGIReloadMechanism Process
WSGIProcessGroup v_hg
WSGIApplicationGroup %{SERVER}
Options All
</Location>
apacheリロード。
ブラウザで確認。
ホストのMac OSからチェックアウト。
wolf:Desktop hide$ hg clone
http://hg.deb/hg/home/hdknr/.ve/hg/repos/ destination directory: repos
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
updating working directory
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
wolf:Desktop hide$ date >>repos/readme.txt
wolf:Desktop hide$ hg status repos/
M repos/readme.txt
wolf:Desktop hide$ hg commit repos -u hdknr -m "now"
wolf:Desktop hide$ hg push repos
pushing to repos
searching for changes
新たなチェンジセットはありません
wolf:Desktop hide$ cd repos/
wolf:repos hide$ hg push
pushing to
http://hg.deb/hg/home/hdknr/.ve/hg/repos/ searching for changes
ssl required
SSLが必要? これは後で調べてみる。