<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>ディスコ探偵冬景色 &#187; Git</title>
	<atom:link href="http://blog.udzura.jp/categories/tech/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.udzura.jp</link>
	<description>a coding class hero is something to be...</description>
	<lastBuildDate>Thu, 29 Jul 2010 05:48:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.udzura.jp/categories/tech/git/feed/" />
		<item>
		<title>今日のワンライナー: 例えばログ検索で</title>
		<link>http://blog.udzura.jp/2010/02/04/todays-one-loner-for-log-grep/</link>
		<comments>http://blog.udzura.jp/2010/02/04/todays-one-loner-for-log-grep/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 09:31:12 +0000</pubDate>
		<dc:creator>udzura</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.udzura.jp/?p=288</guid>
		<description><![CDATA[最近もっぱらGitを使用していますが、軽くて高機能ですし便利だと思います。でも今日はGitの話しません。
そんなGitのlogを見る際に、色々いじって手ワンライナーに便利そうなコマンドオプションを幾つか発見したので、鬼の首を取ったようにメモしときますね。
言っておきますが分かってる人には当然の内容ですよ。。

想定しているOSはLinux、GNU coreutilsとGNU grepです。他のOSに載っているやつで動くかは不明。
で。まずは単品の、

1
git log

これだとlessとかで見る事になります。それはそれでいいんですけど、

commit ac048f833ba3743a8d5ad313985f49571436ca57
Author: udzura &#60;udzura@hoge.udzura.jp&#62;
Date:   Thu Feb 4 15:05:13 2010 +0900

    バッチのtypo修正

commit ce9e4356c945f892b606b206534145845a9d6ce1
Author: udzura &#60;udzura@hoge.udzura.jp&#62;
Date:   Thu Feb 4 14:00:01 2010 +0900

    バッチ直した

commit 5197339ddbd701b1902c7d9b7ae9732c8b627750
Author: deadwinter &#60;deadwinter@hoge.udzura.jp&#62;
Date:   Tue Feb 2 13:37:56 2010 +0900

    app/models/hoge.rb typo直した

commit c10da34d0394415065efe4ee4d1e80eb3ae5bae7
Author: udzura &#60;udzura@hoge.udzura.jp&#62;
Date:   [...]]]></description>
			<content:encoded><![CDATA[<p>最近もっぱら<a href="http://git-scm.com/">Git</a>を使用していますが、軽くて高機能ですし便利だと思います。でも今日はGitの話しません。</p>
<p>そんなGitのlogを見る際に、色々いじって手ワンライナーに便利そうなコマンドオプションを幾つか発見したので、鬼の首を取ったようにメモしときますね。</p>
<p>言っておきますが分かってる人には当然の内容ですよ。。</p>
<p><span id="more-288"></span><br />
想定しているOSはLinux、GNU coreutilsとGNU grepです。他のOSに載っているやつで動くかは不明。</p>
<p>で。まずは単品の、</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log</pre></td></tr></table></div>

<p>これだとlessとかで見る事になります。それはそれでいいんですけど、</p>
<pre>
commit ac048f833ba3743a8d5ad313985f49571436ca57
Author: udzura &lt;udzura@hoge.udzura.jp&gt;
Date:   Thu Feb 4 15:05:13 2010 +0900

    バッチのtypo修正

commit ce9e4356c945f892b606b206534145845a9d6ce1
Author: udzura &lt;udzura@hoge.udzura.jp&gt;
Date:   Thu Feb 4 14:00:01 2010 +0900

    バッチ直した

commit 5197339ddbd701b1902c7d9b7ae9732c8b627750
Author: deadwinter &lt;deadwinter@hoge.udzura.jp&gt;
Date:   Tue Feb 2 13:37:56 2010 +0900

    app/models/hoge.rb typo直した

commit c10da34d0394415065efe4ee4d1e80eb3ae5bae7
Author: udzura &lt;udzura@hoge.udzura.jp&gt;
Date:   Mon Feb 1 12:28:56 2010 +0900
......
</pre>
<p>「ワンライナーで必要な情報だけシュバッ！　と抜き出したい」、UN*Xユーザならみんなそう思うかと考えられますので。</p>
<h3>行番号を付けたい</h3>
<p>「シュバッ」と抜き出す前段階として、表示に行番号を付けましょう。 <code style="text-decoration:underline;">cat -n</code> です。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span></pre></td></tr></table></div>

<pre>
     1  commit ac048f833ba3743a8d5ad313985f49571436ca57
     2  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
     3  Date:   Thu Feb 4 15:05:13 2010 +0900
     4
     5      バッチのtypo修正
     6
     7  commit ce9e4356c945f892b606b206534145845a9d6ce1
     8  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
     9  Date:   Thu Feb 4 14:00:01 2010 +0900
    10
    11      バッチ直した
    12
    13  commit 5197339ddbd701b1902c7d9b7ae9732c8b627750
    14  Author: deadwinter &lt;deadwinter@hoge.udzura.jp&gt;
    15  Date:   Tue Feb 2 13:37:56 2010 +0900
    16
    17      app/models/hoge.rb typo直した
    18
    19  commit c10da34d0394415065efe4ee4d1e80eb3ae5bae7
    20  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
    21  Date:   Mon Feb 1 12:28:56 2010 +0900
......
</pre>
<p>でもコレで</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> udzura<span style="color: #000000; font-weight: bold;">@</span>hoge.udzura.jp</pre></td></tr></table></div>

<pre>
     2  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
     8  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
    20  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
......
</pre>
<p>とか抜き出しても、日付すら分かりませんね。。</p>
<h3>grepした行の回りも見たい</h3>
<p>grepには <code style="text-decoration:underline;">-C</code> オプションがあります。マッチした行の前後N行も一緒に表示してくれます。</p>
<p>git logとかはちょうど、ユーザ名の前後一行に必要な情報が入ってます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-C1</span> udzura<span style="color: #000000; font-weight: bold;">@</span>hoge.udzura.jp</pre></td></tr></table></div>

<pre>
     1  commit ac048f833ba3743a8d5ad313985f49571436ca57
     2  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
     3  Date:   Thu Feb 4 15:05:13 2010 +0900
--
     7  commit ce9e4356c945f892b606b206534145845a9d6ce1
     8  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
     9  Date:   Thu Feb 4 14:00:01 2010 +0900
--
    19  commit c10da34d0394415065efe4ee4d1e80eb3ae5bae7
    20  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
    21  Date:   Mon Feb 1 12:28:56 2010 +0900
......
</pre>
<p>ここからさらに、「2010年2月1日」のコミットを探したい時は、月日と年度が分かれてるせいで以下のようにしますね。grepコマンドでAND検索をする時は<strong style="text-decoration:underline;">ひたすらgrepをパイプで重ねる</strong>のが私のジャスティスです（OR検索したいアナタには、 <code style="text-decoration:underline;">-e</code> オプションというものがあります）。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-C1</span> udzura<span style="color: #000000; font-weight: bold;">@</span>hoge.udzura.jp <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;Thu Feb 4&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000;">2010</span></pre></td></tr></table></div>

<pre>
    21  Date:   Mon Feb 1 12:28:56 2010 +0900
</pre>
<p>今思ったんだけど曜日が入ってるんだから年度要らないかも。まあサンプルということで。</p>
<p>ともかく、見事、欲しい情報が「21行目あたりに入っているんだな」と判明しました。git logの仕様的には、きっと(21 &#8211; 2 = 19)～24行目の間に入っているのでしょう。</p>
<h3>N行目からM行を見たい</h3>
<p>こういう 21 &#8211; 2 行目から6行分を見たい、という際は、 <code style="text-decoration:underline;">head</code> と <code style="text-decoration:underline;">tail</code> を組み合わせるのが便利です。便利なんですよ。<strong style="text-decoration:underline;">ハイフン＋数字で「頭から|ケツから N 行を表示」</strong>という便利オプションを使いましょう。また、算数が面倒くさい向きには、 <code style="text-decoration:underline;">$((計算式))</code> という記法があって、これはこの中身の計算を展開してくれます。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> -$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">21</span> - <span style="color: #000000;">2</span> + <span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-6</span></pre></td></tr></table></div>

<pre>
    19  commit c10da34d0394415065efe4ee4d1e80eb3ae5bae7
    20  Author: udzura &lt;udzura@hoge.udzura.jp&gt;
    21  Date:   Mon Feb 1 12:28:56 2010 +0900
    22
    23      まあ適当に直した
    24
</pre>
<p>出来ましたね！</p>
<h3>まとめ</h3>
<p>以上をまとめ、バックスラッシュという便利記法を使用すると、以下のワンライナーになりますね。バックスラッシュ <code style="text-decoration:underline;">`コマンド`</code> は中身のコマンドを先に実行し、結果の出力を文字にして、その外側のコマンドを実行します。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> -$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">`</span>git log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-C1</span> udzura<span style="color: #000000; font-weight: bold;">@</span>hoge.udzura.jp <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;Mon Feb 1&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000;">2010</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -f1<span style="color: #000000; font-weight: bold;">`</span> - <span style="color: #000000;">2</span> + <span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-6</span></pre></td></tr></table></div>

<p>すいません、まとめといいながらさらにどさくさにまぎれて <code style="text-decoration:underline;">cut -f</code> なるコマンドを混入させています。これは、空白区切り（デフォルト；区切りは <code style="text-decoration:underline;">-d</code> で指定）のテキストの、任意の列を切り出してくれます。</p>
<div class="tmkm-amazon-view">
	<p><a href="http://www.amazon.co.jp/%E3%80%90%E6%94%B9%E8%A8%82%E6%96%B0%E7%89%88%E3%80%91-Linux%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89-%E3%83%9D%E3%82%B1%E3%83%83%E3%83%88%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9-Pocket-Reference/dp/4774138169%3FSubscriptionId%3DAKIAI2SE5CBGHF3E5T4Q%26tag%3Dudzura1984-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4774138169"><img src="http://ecx.images-amazon.com/images/I/51kWaJRnGVL._SL160_.jpg" border="0" alt="" /></a></p>
	<p><a href="http://www.amazon.co.jp/%E3%80%90%E6%94%B9%E8%A8%82%E6%96%B0%E7%89%88%E3%80%91-Linux%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89-%E3%83%9D%E3%82%B1%E3%83%83%E3%83%88%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9-Pocket-Reference/dp/4774138169%3FSubscriptionId%3DAKIAI2SE5CBGHF3E5T4Q%26tag%3Dudzura1984-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4774138169">【改訂新版】 Linuxコマンド ポケットリファレンス (Pocket Reference)</a></p>
	<p><em>著者／訳者：</em>沓名 亮典 平山 智恵 </p>
	<p><em>出版社：</em>技術評論社( 2009-04-08 )</p>
	<p>単行本（ソフトカバー） ( 576 ページ )</p>
<hr class="tmkm-amazon-clear" /></div>
<h3>総括</h3>
<p><a href="http://www.moongift.jp/2008/12/tortoisegit/">TortoiseGit</a>って便利なんですね。</p>
<h3>総括２</h3>
<p>ワンライナーのコツは：</p>
<ul>
<li>コマンド一回一回ごとの「標準出力」の状態を把握する</li>
<li>バックスラッシュ記法を活用</li>
<li>その他、「<code>[条件] &#038;&#038; ～</code>」「<code>&#038;&#038;</code>」「<code>;</code>」や各種制御構造をフル活用</li>
</ul>
<p>とかな気がする。でも多分、シェルスクリプト書いたほうがいいよ。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.udzura.jp/2010/02/04/todays-one-loner-for-log-grep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.udzura.jp/2010/02/04/todays-one-loner-for-log-grep/" />
	</item>
		<item>
		<title>Gitorious入れたメモ</title>
		<link>http://blog.udzura.jp/2010/01/06/gitorious-installation-memo/</link>
		<comments>http://blog.udzura.jp/2010/01/06/gitorious-installation-memo/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 13:26:16 +0000</pubDate>
		<dc:creator>udzura</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.udzura.jp/?p=232</guid>
		<description><![CDATA[日ごろgithubさんにお世話になっておりますが、Gitoriousというサービスは自分のコードを公開し、個人でインストールできるようなので入れてみたメモ。
概要
ホストするOSはUbuntu 9.10。
手順は、9.04の場合のものが公式Wikiにあったりする（http://gitorious.org/gitorious/pages/UbuntuInstallation）のでそれを大幅に参照した。基本的にコレの通りで問題ないのだが、Gitorious自体のバージョンが上がったこともあって微妙に違う点もある。
以下、日本語Remix CDを入れたてのまっさらな状態からの構築を想定。

aptで入れたもの

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo aptitude install build-essential\
apache2 apache2-dev\
mysql-server mysql-client libmysqlclient15-dev\
git-core git-svn git-doc git-cvs\
apg\
geoip-bin libgeoip1 libgeoip-dev\
sqlite3 libsqlite3-dev\
imagemagick libmagickcore2 libmagickwand2 libmagickcore-dev libmagickwand-dev\
libpcre3 libpcre3-dev\
zlib1g zlib1g-dev\
libyaml-dev\
sendmail\
zip unzip\
memcached\
openssh-server

ログを見る限りこれらを入れていた。Synapticで入れてしまったものもあるかも。。デスクトップ版はデフォルトだとsshdも入ってないのよね。。
ソースインストール
onigurumaはソースインストールしないと、rubyバインディングをコンパイルできない。libonig2はヘッダが入らん。
（http://www.geocities.jp/kosako3/oniguruma/）
あと、sphinxという検索エンジンを使用するのでそれも入れる。
（http://www.sphinxsearch.com/downloads.html）
ImageMagickは、aptでMagick-configやヘッダファイルが入ってくれるのでソースは要らない。
あと、他の記事ではActiveMQを入れるとかいう手順もありますけど、今のバージョンでは使ってないようです。Rubyのstompserverとかいうものにメッセージングを任せてる、のかな。
Ruby周りとgemで入れたもの
rubyは、Ruby Enterprise Edition（http://www.rubyenterpriseedition.com/download.html）。ちょうど、1.8.7互換版が出ている。Ubuntuだとdebもあるので圧倒的に楽。
で、rubyバイナリのインストール先が /usr/local/bin になり、gem、gemで入れた実行ファイル（rake、stompserver）等もそこに行くので、実行ファイルを決め打ちにしている幾つかのスクリプトを修正する必要がある。なんかよく分からんけどコケた際はまずその辺を疑ってみよう。
gemは最終的に以下の如し。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
*** LOCAL GEMS ***
&#160;
actionmailer &#40;2.3.5&#41;
actionpack &#40;2.3.5&#41;
activerecord &#40;2.3.5&#41;
activeresource &#40;2.3.5&#41;
activesupport &#40;2.3.5&#41;
BlueCloth &#40;1.0.1&#41;
chronic &#40;0.2.3&#41;
daemons &#40;1.0.10&#41;
diff-lcs &#40;1.1.2&#41;
echoe &#40;4.1&#41;
eventmachine &#40;0.12.10&#41;
fastthread &#40;1.0.7&#41;
gemcutter &#40;0.2.1&#41;
geoip &#40;0.8.6&#41;
hoe &#40;2.4.0&#41;
json &#40;1.2.0&#41;
json_pure &#40;1.2.0&#41;
mime-types &#40;1.16&#41;
mysql &#40;2.8.1&#41;
oniguruma &#40;1.1.0&#41;
passenger &#40;2.2.5&#41;
pg &#40;0.8.0&#41;
plist &#40;3.0.0&#41;
rack &#40;1.0.1&#41;
rails &#40;2.3.5&#41;
rake &#40;0.8.7&#41;
rdiscount [...]]]></description>
			<content:encoded><![CDATA[<p>日ごろgithubさんにお世話になっておりますが、<a href="http://gitorious.org/">Gitorious</a>というサービスは<a href="http://gitorious.org/gitorious/">自分のコードを公開</a>し、個人でインストールできるようなので入れてみたメモ。</p>
<h3>概要</h3>
<p>ホストするOSはUbuntu 9.10。</p>
<p>手順は、9.04の場合のものが公式Wikiにあったりする（<a href="http://gitorious.org/gitorious/pages/UbuntuInstallation">http://gitorious.org/gitorious/pages/UbuntuInstallation</a>）のでそれを大幅に参照した。基本的にコレの通りで問題ないのだが、Gitorious自体のバージョンが上がったこともあって微妙に違う点もある。</p>
<p>以下、日本語Remix CDを入れたてのまっさらな状態からの構築を想定。</p>
<p><span id="more-232"></span></p>
<h3>aptで入れたもの</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential\
apache2 apache2-dev\
mysql-server mysql-client libmysqlclient15-dev\
git-core git-svn git-doc git-cvs\
apg\
geoip-bin libgeoip1 libgeoip-dev\
sqlite3 libsqlite3-dev\
imagemagick libmagickcore2 libmagickwand2 libmagickcore-dev libmagickwand-dev\
libpcre3 libpcre3-dev\
zlib1g zlib1g-dev\
libyaml-dev\
<span style="color: #c20cb9; font-weight: bold;">sendmail</span>\
<span style="color: #c20cb9; font-weight: bold;">zip</span> <span style="color: #c20cb9; font-weight: bold;">unzip</span>\
memcached\
openssh-server</pre></td></tr></table></div>

<p>ログを見る限りこれらを入れていた。Synapticで入れてしまったものもあるかも。。デスクトップ版はデフォルトだとsshdも入ってないのよね。。</p>
<h3>ソースインストール</h3>
<p>onigurumaはソースインストールしないと、rubyバインディングをコンパイルできない。libonig2はヘッダが入らん。<br />
（<a href="http://www.geocities.jp/kosako3/oniguruma/">http://www.geocities.jp/kosako3/oniguruma/</a>）</p>
<p>あと、sphinxという検索エンジンを使用するのでそれも入れる。<br />
（<a href="http://www.sphinxsearch.com/downloads.html">http://www.sphinxsearch.com/downloads.html</a>）</p>
<p>ImageMagickは、aptでMagick-configやヘッダファイルが入ってくれるのでソースは要らない。</p>
<p>あと、他の記事ではActiveMQを入れるとかいう手順もありますけど、今のバージョンでは使ってないようです。Rubyのstompserverとかいうものにメッセージングを任せてる、のかな。</p>
<h3>Ruby周りとgemで入れたもの</h3>
<p>rubyは、Ruby Enterprise Edition（<a href="http://www.rubyenterpriseedition.com/download.html">http://www.rubyenterpriseedition.com/download.html</a>）。ちょうど、1.8.7互換版が出ている。Ubuntuだとdebもあるので圧倒的に楽。</p>
<p>で、rubyバイナリのインストール先が /usr/local/bin になり、gem、gemで入れた実行ファイル（rake、stompserver）等もそこに行くので、実行ファイルを決め打ちにしている幾つかのスクリプトを修正する必要がある。なんかよく分からんけどコケた際はまずその辺を疑ってみよう。</p>
<p>gemは最終的に以下の如し。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">***</span> LOCAL GEMS <span style="color: #000000; font-weight: bold;">***</span>
&nbsp;
actionmailer <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.3.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
actionpack <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.3.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
activerecord <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.3.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
activeresource <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.3.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
activesupport <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.3.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
BlueCloth <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.0.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
chronic <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.2.3<span style="color: #7a0874; font-weight: bold;">&#41;</span>
daemons <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.0.10<span style="color: #7a0874; font-weight: bold;">&#41;</span>
diff-lcs <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.1.2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
echoe <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">4.1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
eventmachine <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.12.10<span style="color: #7a0874; font-weight: bold;">&#41;</span>
fastthread <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.0.7<span style="color: #7a0874; font-weight: bold;">&#41;</span>
gemcutter <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.2.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
geoip <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.8.6<span style="color: #7a0874; font-weight: bold;">&#41;</span>
hoe <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.4.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
json <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.2.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
json_pure <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.2.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
mime-types <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1.16</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
mysql <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.8.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
oniguruma <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.1.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
passenger <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.2.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
pg <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.8.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
plist <span style="color: #7a0874; font-weight: bold;">&#40;</span>3.0.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rack <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.0.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rails <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.3.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rake <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.8.7<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rdiscount <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.3.1.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
RedCloth <span style="color: #7a0874; font-weight: bold;">&#40;</span>4.2.2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rmagick <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.12.2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rspec <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.2.9<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rspec-rails <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.2.9<span style="color: #7a0874; font-weight: bold;">&#41;</span>
ruby-hmac <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.3.2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
ruby-openid <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.1.7<span style="color: #7a0874; font-weight: bold;">&#41;</span>
ruby-yadis <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.3.4<span style="color: #7a0874; font-weight: bold;">&#41;</span>
rubyforge <span style="color: #7a0874; font-weight: bold;">&#40;</span>2.0.3<span style="color: #7a0874; font-weight: bold;">&#41;</span>
sqlite3-ruby <span style="color: #7a0874; font-weight: bold;">&#40;</span>1.2.5<span style="color: #7a0874; font-weight: bold;">&#41;</span>
stomp <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1.1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
stompserver <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.9.9<span style="color: #7a0874; font-weight: bold;">&#41;</span>
textpow <span style="color: #7a0874; font-weight: bold;">&#40;</span>0.10.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
ultrasphinx <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1.11</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<h3>service関連の設定</h3>
<p>「<a href="http://gitorious.org/gitorious/pages/UbuntuInstallation">UbuntuInstallation</a>」の通り。git-daemon、git-ultrasphinxの起動スクリプトのrubyの場所をなどを変更。</p>
<p>stompは、Wikiのスクリプトではまったく動かなかったので、やっつけで以下のようなものを作成。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># Start/stop the stompserver</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">### BEGIN INIT INFO</span>
<span style="color: #666666; font-style: italic;"># Provides: stomp</span>
<span style="color: #666666; font-style: italic;"># Required-Start: $local_fs $remote_fs $network $syslog</span>
<span style="color: #666666; font-style: italic;"># Required-Stop:</span>
<span style="color: #666666; font-style: italic;"># Default-Start: 2 3 4 5</span>
<span style="color: #666666; font-style: italic;"># Default-Stop: 1</span>
<span style="color: #666666; font-style: italic;"># Short-Description: Stomp</span>
<span style="color: #666666; font-style: italic;"># Description: Stomp</span>
<span style="color: #666666; font-style: italic;">### END INIT INFO</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>stompserver <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
&nbsp;
. <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>lsb<span style="color: #000000; font-weight: bold;">/</span>init-functions
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> $<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;"># log_daemon_msg “Starting stompserver” “stomp”</span>
&nbsp;
     <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> git <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>stompserver <span style="color: #000000; font-weight: bold;">&amp;</span>amp;
     log_end_msg <span style="color: #007800;">$?</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;"># log_daemon_msg “Stopping stompserver” “stomp”</span>
&nbsp;
     <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-INT</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> log<span style="color: #000000; font-weight: bold;">/</span>stompserver.pid<span style="color: #000000; font-weight: bold;">`</span>
     log_end_msg <span style="color: #007800;">$?</span>
     <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
restart<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;"># log_daemon_msg “Restarting stompserver” “stomp”</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> git <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>stompserver <span style="color: #000000; font-weight: bold;">&amp;</span>amp;
    <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-INT</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> log<span style="color: #000000; font-weight: bold;">/</span>stompserver.pid<span style="color: #000000; font-weight: bold;">`</span>
    log_end_msg <span style="color: #007800;">$?</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
status<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>stompserver.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;stompserver is running. pid: <span style="color: #780078;">`cat /var/www/gitorious/log/stompserver.pid`</span>&quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;stompserver is not running.&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;"># log_action_msg “Usage: /etc/init.d/stomp {start|stop|restart|status}”</span>
&nbsp;
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
    <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

<p>大変酷いスクリプトであることは自分でも知ってますが、まあ用には足ります。</p>
<p>gistに上げてるので、以下で落とせます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>stomp http:<span style="color: #000000; font-weight: bold;">//</span>gist.github.com<span style="color: #000000; font-weight: bold;">/</span>raw<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">269240</span><span style="color: #000000; font-weight: bold;">/</span>ce6507d4387004040e73667586ee2b1ced1de9fa<span style="color: #000000; font-weight: bold;">/</span>stomp.sh <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> a+x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>stomp</pre></div></div>

<p>そしてpollerは、起動スクリプトはもちろん動かなくて、それも上手いこと直せない。。</p>
<p>とにかく使いたいなら、サーバ起動直後に以下のワンライナーで手動起動する運用で、対応できるかと思う。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">su</span> git <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;cd /var/www/gitorious &amp;amp;&amp;amp; RAILS_ENV=production ruby script/poller start &amp;amp;&amp;amp; sleep 10&quot;</span></pre></div></div>

<p>このコマンドを起動スクリプトに書いてもぜんぜんうまく行かないんだけど、何で？</p>
<p>Gitoriousの全機能が動く状態になっているか、各デーモンの状況を確認する際は以下のコマンドで。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ps-ef <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> git</pre></div></div>

<p>各デーモンは「<strong>git</strong>」ユーザで動いています。なお、Passengerの仕様として、Railsのプロセスは<code>$RAILS_ROOT/config/environment.rb</code>のオーナーなので、こっちのプロセスもgitになっているはず。</p>
<p>以下の4プロセスが存在すればOK。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">git       <span style="color: #000000;">2243</span>     <span style="color: #000000;">1</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">22</span>:<span style="color: #000000;">11</span> ?        00:00:00 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious<span style="color: #000000; font-weight: bold;">/</span>script<span style="color: #000000; font-weight: bold;">/</span>git-daemon <span style="color: #660033;">-d</span>
git       <span style="color: #000000;">2547</span>     <span style="color: #000000;">1</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">22</span>:<span style="color: #000000;">12</span> ?        00:00:00 searchd <span style="color: #660033;">--config</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>gitorious<span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>ultrasphinx<span style="color: #000000; font-weight: bold;">/</span>production.conf
git       <span style="color: #000000;">2925</span>     <span style="color: #000000;">1</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">22</span>:<span style="color: #000000;">18</span> ?        00:00:06 poller
git       <span style="color: #000000;">3213</span>     <span style="color: #000000;">1</span>  <span style="color: #000000;">0</span> <span style="color: #000000;">22</span>:<span style="color: #000000;">26</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span>    00:00:00 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>stompserver</pre></td></tr></table></div>

<p>上がってなかったらserviceコマンドで上げましょう（結局手動かよ！！！）。</p>
<h3>その他</h3>
<p>Wikiの通りやっていけば、Ubuntuならそれほど詰まらないかとは思います。</p>
<h3>細かい点</h3>
<ul>
<li>どうせローカルでしか使わないのでSSL要らない</li>
</ul>
<p><code>config/environment/production.rb</code>に、</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">SslRequirement.<span style="color:#9900CC;">disable_ssl_check</span> = <span style="color:#0000FF; font-weight:bold;">true</span></pre></td></tr></table></div>

<p>を追記する</p>
<ul>
<li>cronがなんかコケる</li>
</ul>
<p>crontab -e する際に、環境変数 <code>PATH=/usr/local/bin:/usr/bin:/bin</code> を設定した方がいい気がする。あとgitユーザで設定してるか確認。</p>
<ul>
<li>ログインできない</li>
</ul>
<p>gitorious.ymlでのホスト名と、実際にブラウザでアクセスするホスト名が、一致してないとダメっぽいです。なので「localhost」とかで動作検証しようとするとダメだった。/etc/hosts使うとか、192.168.hoge.fugaをgitorious.ymlにちゃんと書くとか。</p>
<ul>
<li>tarballがダウンロードできない</li>
</ul>
<p>gitorious.ymlで設定してる<code>archive_cache_dir</code>の場所に、ちゃんとtarballはできてるんですけど、いざブラウザから落とそうとすると1kbの空ファイルになってしまう。。。</p>
<p>ソース見る限り「X-SendFile」という手段でファイルをダウンロードさせてるようなので、Apacheなら「mod_xsendfile」を入れなければいけない模様。</p>
<ul>
<li><a href="http://tn123.ath.cx/mod_xsendfile/">http://tn123.ath.cx/mod_xsendfile/</a></li>
<li><a href="http://packages.debian.org/ja/squeeze/i386/libapache2-mod-xsendfile/download">http://packages.debian.org/ja/squeeze/i386/libapache2-mod-xsendfile/download</a> (debもあった)</li>
<li><a href="http://www.ideaxidea.com/archives/2009/11/mod_xsendfile_installed.html">http://www.ideaxidea.com/archives/2009/11/mod_xsendfile_installed.html</a></li>
</ul>
<blockquote><p>ちなみに個人的には「XSendFile on」の記述を忘れていたため、ダウンロードはされるが空のファイル、というみっともないハマリ方をしちゃいましたよ。ご注意あれ。</p></blockquote>
<p>はい、私もでした。ということでソースがtarballでも落とせて便利。</p>
<h3>未解決</h3>
<ul>
<li>日本語検索できなくね</li>
</ul>
<p>sphinx search自体が日本語対応しているか怪しい。。と思ったが。</p>
<p>UltraSphinxプラグインが起動する検索デーモンの共通設定は、</p>
<p><code>${RAILS_ROOR}/config/ultrasphinx/default.base</code></p>
<p>via: <a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/classes/Ultrasphinx.html">http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/classes/Ultrasphinx.html</a></p>
<p>見た感じ*.baseにはERB記法が使えそう。</p>
<p>そして、なにやら日本語対応のための記事っぽいものが英語であった。</p>
<ul>
<li><a href="http://crunchytoast.com/2009/04/14/sphinx-search-in-japanese/">http://crunchytoast.com/2009/04/14/sphinx-search-in-japanese/</a></li>
<li><a href="http://crunchytoast.com/2009/05/01/japanese-sphinx-explained/">http://crunchytoast.com/2009/05/01/japanese-sphinx-explained/</a></li>
</ul>
<p>この辺とか、あと <code>/usr/local/etc/sphinx.conf.dist</code> にもサンプルがあったりするのでそれを見ながら試行錯誤すれば出来るようになるのかも。でも時間無い。</p>
<p>取り急ぎは「カテゴリーは英語にする」とかそういう運用ルールでがんばるしかないか。</p>
<p>もしくは、UltraSphinx自体をハックする必要もあるかもしれない。<br />
<a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html">http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html</a></p>
<h3>まとめ</h3>
<p>知らないライブラリを沢山使ってるので勉強になった。</p>
<p>日本語情報少なくて困惑する。</p>
<p>でも、トラブルがあるたびに、ソースを追っかけたりして対処していけば、なんとなく入れられるんではないでしょうか。というか毎日のようにPUSHがあるので、一ヵ月後ぐらいにはここに書いたtips意味無くなるんじゃあないか。</p>
<h3>大変参考になった先達</h3>
<p>Wikiの他、以下の方々</p>
<ul>
<li><a href="http://d.hatena.ne.jp/bannyan/20090131/1233399237">http://d.hatena.ne.jp/bannyan/20090131/1233399237</a></li>
<li><a href="http://d.hatena.ne.jp/Hirohiro/20090522/1243016921">http://d.hatena.ne.jp/Hirohiro/20090522/1243016921</a></li>
<li><a href="http://www.araki.net/wiki/araki-wiliki.cgi?araki%3AGitorious">http://www.araki.net/wiki/araki-wiliki.cgi?araki%3AGitorious</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.udzura.jp/2010/01/06/gitorious-installation-memo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.udzura.jp/2010/01/06/gitorious-installation-memo/" />
	</item>
	</channel>
</rss>
