<?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/"
	>

<channel>
	<title>Transrain &#187; CentOS</title>
	<atom:link href="http://transrain.net/blog/tag/centos/feed" rel="self" type="application/rss+xml" />
	<link>http://transrain.net/blog</link>
	<description>悠希のだらだらメモ</description>
	<lastBuildDate>Wed, 01 Feb 2012 06:16:55 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://transrain.net/blog/?pushpress=hub'/>
		<item>
		<title>gitにpushしたwebサイトを自動的に同期させる</title>
		<link>http://transrain.net/blog/2011/04/05/211200</link>
		<comments>http://transrain.net/blog/2011/04/05/211200#comments</comments>
		<pubDate>Tue, 05 Apr 2011 12:12:00 +0000</pubDate>
		<dc:creator>yuki</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[開発]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[サーバ]]></category>

		<guid isPermaLink="false">http://transrain.net/?p=115</guid>
		<description><![CDATA[earthquake_jpに関連して作業したので備考録としてメモ。 前提 gitのリモートリポジトリとHTTPサーバが同一のサーバに存在している状態です。 別サーバで行う場合はgit cloneを行う際にパス無し秘密鍵で &#8230; <a href="http://transrain.net/blog/2011/04/05/211200">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>earthquake_jpに関連して作業したので備考録としてメモ。</p>
<h2>前提</h2>
<p>gitのリモートリポジトリとHTTPサーバが同一のサーバに存在している状態です。</p>
<p>別サーバで行う場合は<code>git clone</code>を行う際にパス無し秘密鍵でcloneして<br />
おかないと上手く動作しないと思われます。</p>
<h2>処理の流れ</h2>
<p>開発者 → コミット → プッシュ → post-receive → Web API → git pull</p>
<h2>失敗</h2>
<ul>
<li>最初はpost-receiveでpullを発行しようとしたが、HTTPサーバとgitosisの権限が異なる。</li>
<li>sudoを発行してみたが、エラーが発生して処理が行えない。</li>
</ul>
<h2>結果</h2>
<ul>
<li>post-receiveはWeb APIへとアクセスする。</li>
<li>Web APIはHTTPサーバの権限で動作する。</li>
<li>Web APIではシェルスクリプトを実行する。</li>
<li>HTTPサーバの権限でpullが行われる。</li>
</ul>
<h2>例</h2>
<h3>リポジトリ.git/hooks/post-receive</h3>
<pre>#!/bin/sh
wget -q -O - http://APIのURL</pre>
<h3>API(update.php)</h3>
<pre>&lt;?php
$cmd = dirname(__FILE__) . '/update.sh';
$res = system($cmd);
if (false === $res) {
    echo "NGn";
} else {
    echo "OK:{$res}n";
}</pre>
<h3>シェルスクリプト(update.sh)</h3>
<pre>#!/bin/sh
cd /var/www/html/
/usr/bin/git --git-dir=/var/www/html/.git pull</pre>
<p>post-receive、update.shは実行権限を付加するのを忘れずに。update.phpはweb上から実行可能であれば問題ない。</p>
<p>念の為、127.0.0.1か自身のグローバルIPでのみアクセス可能にしている。</p>
]]></content:encoded>
			<wfw:commentRss>http://transrain.net/blog/2011/04/05/211200/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>muninのRPMパッケージ for CentOS5</title>
		<link>http://transrain.net/blog/2007/04/16/161518</link>
		<comments>http://transrain.net/blog/2007/04/16/161518#comments</comments>
		<pubDate>Mon, 16 Apr 2007 07:15:18 +0000</pubDate>
		<dc:creator>yuki</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://transrain.net/2007/04/16/161518</guid>
		<description><![CDATA[仕事でとあるサーバをCentOSにて構築しているのですが、muninのRPMパッケージが無かったので、RHELのSRPMからRPMを構築しました。&#160; まぁ、作成自体は簡単で、下記のコマンドで出来ます。 # wg &#8230; <a href="http://transrain.net/blog/2007/04/16/161518">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://transrain.net/wordpress/wp-content/uploads/munin001.jpg" alt="munin001.jpg" width="400" height="200" />
</p>
<p>
仕事でとあるサーバをCentOSにて構築しているのですが、muninのRPMパッケージが無かったので、RHELのSRPMからRPMを構築しました。&nbsp;
</p>
<p><span id="more-24"></span></p>
<p>
まぁ、作成自体は簡単で、下記のコマンドで出来ます。</p>
<pre>
# wget http://jaist.dl.sourceforge.net/sourceforge/munin/munin-1.2.5-1rhel.src.rpm
# rpm -i munin-1.2.5-1rhel.src.rpm
# rpmbuild -ba /usr/src/redhat/SPECS/munin.spec
</pre>
<p>すると「/usr/src/redhat/RPMS/noarch/munin-*.rpm」が出来上がるので、それを普段通りにインストールするだけです。
</p>
<p>と言っても判らないとか言う人が居るとは思うので、取りあえず公開しておきます。負荷が大きすぎたりした場合には削除しますのでご了承ください。</p>
<table>
<tr>
<th>munin 1.2.5-1</th>
<td><a href="http://www.transrain.net/trash/centos5/munin-1.2.5-1rhel.noarch.rpm">wget http://www.transrain.net/trash/centos5/munin-1.2.5-1rhel.noarch.rpm</a></td>
</tr>
<tr>
<th>munin node 1.2.5-1</th>
<td><a href="http://www.transrain.net/trash/centos5/munin-node-1.2.5-1rhel.noarch.rpm">wget http://www.transrain.net/trash/centos5/munin-node-1.2.5-1rhel.noarch.rpm</a></td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://transrain.net/blog/2007/04/16/161518/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

