ssk’s posterous

ssk’s posterous

Jun 18 / 12:46am

ソフト/Bug Tracking/trac/MercurialPlugin - discypus

by ssk

メモ: 2008-10-24

HgWebDirStepByStep - Mercurial を見ながら、mod_wsgi経由の閲覧の設定をやってみた。

環境はDebian 4.0, Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 mod_python/3.2.10 Python/2.4.4 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_wsgi/2.3

閲覧だけ、認証無し、ならこんな感じか。 [collections]で楽しようと思ったけどいまいちconfigの動作がわからんので[paths]でリポジトリを一個ずつ指定した。

/var/www/wsgi/hgwebdir.wsgi:

from mercurial.hgweb.hgweb_mod import hgweb
from mercurial.hgweb.hgwebdir_mod import hgwebdir

CONFIG = '/var/hg/public.config'
application = hgwebdir(CONFIG)

/var/hg/config:

#[collections]
#hgsandbox = /var/hg/hgsandbox # リポジトリhgsandboxのURLがhttp://localhost/hg/var/hg/hgsandboxになる。
# /var/hg/hgsandbox = /var/hg/hgsandbox  # 見つからなくなる
# hgsandbox = hgsandbox   # 500 Internal Server Error: OSError: [Errno 2] No such file or directory: 'hgsandbox'

[paths]
hgsandbox = /var/hg/hgsandbox

/etc/apache2/sites-available/trac:

WSGIScriptAlias /hg /var/www/wsgi/hgwebdir.wsgi

既存の WSGIScriptAlias は消していいのかな

Filed under  //  apache   mercurial   wsgi  

Comments (0)

Jun 17 / 4:13am

HgWebDirStepByStep - Mercurial

by ssk

8.1.3. Configuring Apache with mod_wsgi

Using mod_wsgi is recommended over using mod_python. It's one of the faster and more efficient ways of serving hgweb(dir).

You can use the hgwebdir.wsgi script (it lives where other Mercurial scripts live, and works with Mercurial 1.0 and later), which references a hgwebdir.conf file in the CONFIG variable:

 

from mercurial.hgweb.hgweb_mod import hgweb
from mercurial.hgweb.hgwebdir_mod import hgwebdir

CONFIG = '/var/hg/public.config'
application = hgwebdir(CONFIG)

This is really an ordinary Python module, but it uses a wsgi extension to make it clear what its use is.

You then need to add this to your httpd.conf (or the vhost config):

 

WSGIScriptAlias / /var/hg/script/public.wsgi
<Directory /var/hg/script>
Order deny,allow
Allow from all
</Directory>

hg 用の WSGIScriptAlias を作らないとダメ

Filed under  //  mercurial   wsgi  

Comments (0)