Showing posts with label gitosis. Show all posts
Showing posts with label gitosis. Show all posts

Wednesday, July 14, 2010

cgit - on Debian Apache2

cgit - a very fast web frontend for git repositories

installation to Apache2 on debian lenny

  • Setup git server by gitosys. ref.-link1(lang_JP),link2(lang_EN)
  • add permission by chomod 755 to git repo for cgit exec .git.(Maybe chmod 755 -R /home/git/repositories/)
  • build & install cgit.(I had error curl for getting git and extract tar.bz2 at make get-git.)
  • config file:/etc/cgitrc
  • virtual-root=/cgi-bin/

    # Enable caching of up to 1000 output entriess
    cache-size=1000

    # Show extra links for each repository on the index page
    enable-index-links=1

    # Show number of affected files per commit on the log pages
    enable-log-filecount=1

    # Show number of added/removed lines per commit on the log pages
    enable-log-linecount=1

    # Enable statistics per week, month and quarter
    max-stats=quarter

    # Set the title and heading of the repository index page
    root-title=tknv git repositories

    # Set a subheading for the repository index page
    root-desc=tracking the tknv development

    # Include some more info about foobar.com on the index page
    root-readme=/var/www/htdocs/about.html

    # Allow download of tar.gz, tar.bz2 and zip-files
    snapshots=tar.gz tar.bz2 zip

    ##
    ## List of common mimetypes
    ##

    mimetype.gif=image/gif
    mimetype.html=text/html
    mimetype.jpg=image/jpeg
    mimetype.jpeg=image/jpeg
    mimetype.pdf=application/pdf
    mimetype.png=image/png
    mimetype.svg=image/svg+xml


    ##
    ## List of repositories.
    ## PS: Any repositories listed when section is unset will not be
    ## displayed under a section heading
    ## PPS: This list could be kept in a different file (e.g. '/etc/cgitrepos')
    ## and included like this:
    ## include=/etc/cgitrepos
    ##


    repo.url=SuperEngine
    repo.path=/home/git/repositories/SuperEngine.git
    repo.desc=the SUperEngine repository
    repo.owner=foo@bar.com

    repo.url=OSGi-module
    repo.path=/home/git/repositories/OSGi-module.git
    repo.desc=the OSGi-module repository
    repo.owner=foo@bar.com
  • config file:/etc/apache2/httpd.conf

  • ServerName halryporya.co.foo
    DocumentRoot /var/www/htdocs/cgit/
    ScriptAlias /cgi-bin/ "/var/www/htdocs/cgit/cgit.cgi/"

    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all

    Alias /cgit.png /var/www/htdocs/cgit/cgit.png
    Alias /cgit.css /var/www/htdocs/cgit/cgit.css
    Alias / /var/www/htdocs/cgit/cgit.cgi/

  • check by w3m http://localhost/cgi-bin/

http://halryporya.co.foo/cgi-bin/

by browser

watching CGIT site...

Thursday, September 3, 2009

redmine & git repo on debian

1.setup redmine

普通にrubyの環境があって、passengerが入ってて、redmineが/var/wwwの下に展開されています。
サーバのホスト名:base08。
セットアップしているマシンのユーザがtknv。
#/etc/apache2/httpd.conf
LoadModule passenger_module /home/tknv/.gem/ruby/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /home/tknv/.gem/ruby/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8

PassengerDefaultUser www

ServerName base08
DocumentRoot /var/www/redmine/public


で、redmineで使用するdbの準備が完了していれば、http://base08でredmineが表示されるはず。
表示されないようだったらサイトで確認
サーバで/var/log/apache2のログを見てもおかしいところがなければ、redmine/tmpのパーミッションが強すぎだったり、666では起動する。または、/etc/apache2/.htaccessファイルがあっていないとか、、、
2.git リポジトリーを立てる。

このサイトが参考になります。
概要:ここで作成したgitユーザがこのbase08ホストで、gitのリポジトリーを立てたり、アップデートしたりします。
注意は説明で行われている、gitリポジトリーを使用するユーザ、gitユーザもbase08ホストで使用しますが、通常業務(趣味ではやらない)で使用するほうで、gitosisの設定を行います。
下記ユーザのマシンでの設定
#~/gitosis-admin/gitosis.conf
[gitosis]

[group gitosis-admin]
writable = gitosis-admin
members = aaa@TKNV bbb@bbc usr1@base08 root@base08

[group dev-Ateam]
writable = project1 project2 project-foo project-wow
members = aaa@TKNV tuka@REP USER1@thinkpad-x300 usr1@base08 root@base08 git@base08

# git@base08が今回の肝です。

[repo project1]
gitweb = yes
owner = tknv@amateras
description = module for UI and support Ajax

大事なのはgit@base08
アカウントをredmineで登録したいリポジトリーのグループに入れておくこと。
あとは、リンクにあるように、/gitosis-admin/keydirに、git@base.pubのように、sshの公開鍵を入れて、gitでサーバにプッシュ。必要なユーザ分、全部おこなう。
3.サーバ上でどうやって、gitリポジトリーを作成しpushのたびに更新するか。

ここ参考になります。しかしながら、ネットにある大抵のHowToは簡単には最近、うまくゆかない。こちらのスキルレベルもあるが、こんだけユーザが多いと、ゴミ情報がたくさん、また、最近は新しいこうゆうテクノロジーが出てくると、とにかくやってみて(やればいいのだが、未検証もあり)サイトにアップする人が多く、間違えもそのままコピペしていたり、、、で
#~/home/git/repositories//hooks/post-update
export GIT_DIR=/home/git/checkout//.git

pushd /home/git/checkout/ > /dev/null
git reset --hard
git pull
popd > /dev/null

WORKDIR="/home/git/checkout/"

/usr/bin/git-update-server-info

unset GIT_DIR

で、先のサイトにもあるが、Don’t forget to create a _local git copy_ (via git clone git@localhost:.git in /home/git/checkout (or whatever folder you prefer)
しかし、このままでも、まだ、無理で、もう2つやることが必要で、まずは、


1.先の今回の肝、git@base08がこの、cloneした、ソースのユーザになっている必要がある。
2.ssh-agentでこのgit@base08ユーザの秘密鍵の方を登録して、パスワード認証を無しにする必要がある。


チェックリスト
  • git@~ ユーザがredmineでブラウジングしたいgitリポジトリーのアクセス許可グループに入っているか?(gitosis.conf)
  • git@~ ユーザのsshの秘密鍵がサーバ(redmineとgitリポジトリのある)にてssh-agentで追加され、パスワード認証が不要になっているか?
  • サーバ(redmineとgitリポジトリのある)の/home/git/checkout/のユーザがgit@~ であるか?

勘違いでした。
git clone で問題ない、、、

How to create repo from remote(not at server)