ポジローぽけっと

昨日より今日、今日より明日を信じて、トライトライ

etckeeperのログを可視化したくなったら

簡易表示でよければgit標準cgiのgitwebを使う

install

gitが入っていればgitwebは入ってるはず。

gitwebは/usr/share/gitweb/gitweb.cgiにあるcgiなので、
cgiを動作させるために以下をインストールする

sudo apt install fcgiwrap spawn-fcgi

gitwebの設定

sudo vi /etc/gitweb/gitweb.conf

$projectrootに*.gitディレクトリを配置するディレクトリを設定する
以下の例は/var/lib/git

our $git_temp = "/tmp";

# The directories where your projects are. Must not end with a slash.
# our $projectroot = "/path/to/your/repositories";
our $projectroot = "/var/lib/git";
# Base URLs for links displayed in the web interface.
#our @git_base_url_list = qw(git://<your_server> http://git@<your_server>);

/var/lib/gitにetckeeperの.gitである/etc/.gitへのシンボリックリンクを張る ※otherから見れるように権限も変える

sudo chmod -R 755 /etc/.git
sudo ln -s /etc/.git /var/lib/git/etckeeper.git

nginxの設定

/etc/nginx/conf.dに以下のようなgitweb.confを作成する

server {
    listen [ip]:[port];
        server_name [server_name];
        location /gitweb.cgi {
        include fastcgi_params;
        gzip off;
        fastcgi_param   SCRIPT_FILENAME  /usr/share/gitweb/gitweb.cgi;
        fastcgi_param   GITWEB_CONFIG  /etc/gitweb/gitweb.conf;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }
    location / {
        root /usr/share/gitweb;
        index gitweb.cgi;
    }
}  

作成後はnginxに設定を読み込ませるため

sudo service nginx restart

以上で、http:/[ip]:[port]/にアクセスすればgitwebが見れる。