Posts Tagged ‘gitweb’

Install alm system in ubuntu (redmine/gerrit/openldap)

Wednesday, June 29th, 2011

Sometimes it is better to use virtual machine to demo, so I need to install the alm environment on ubunut os, below are just some records for myself.

Preparation

Start from the redmine turnkey image since I have no knowledge on ruby, better to use an established environment, besides default redmine, there is some nice features we could learn, like etckeeper, which worth another blog

image

Load it into virtual box (create from its virtual disk), then add one network to access from outside (192.168.56.181 like for me)

Install LDAP server

For later ubuntu (10.x for me), the ldap server use dynamic configuration method, therefore I need different way to handle it, after some tries, below is working way, see https://help.ubuntu.com/10.04/serverguide/C/openldap-server.html as detail

Import schema files over command line
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetorgperson.ldif
Import ldap config files

originally it is in slapd.conf, now it is sent to config, I use the example ldif file directly

ldapadd -Y EXTERNAL -H ldapi:/// -f backend.example.com.ldif
Import ldap ldif files

the example frontend looks nice as well, don’t forget to give passwd, default is “secret”

ldapadd -x -D cn=admin,dc=example,dc=com -W -f frontend.example.com.ldif

To keep simple, I create seperate ldif for my own account with password since gerrit needs it

# larry.ldif
dn: uid=rdccaiy,ou=people,dc=example,dc=comobjectClass: inetOrgPerson
uid: rdccaiy
userpassword: passwd
sn: Cai
givenName: Larry
cn: Larry Cai
displayName: Larry Cai
mail: larry.caiyu@gmail.com

And I import it separately

ldapadd -x -D cn=admin,dc=example,dc=com -W -f larry.ldif

If there is something wrong, I just reinstall it completely as I am not good at ldap.

apt-get purge slapdrm -rf /var/lib/ldap/*apt-get install slapd

see reference http://isartor.org/wiki/OpenLdap_with_dynamic_config_backend_on_Ubuntu_10.04 for more information on this.

Now you can follow earlier post to install gerrit for it, surely you need install java-sdk by adding

deb http://archive.canonical.com/ lucid partner

in your /etc/apt/source.list (or similar)

apt-get update
apt-get install sun-java6-jdk

Install gitweb

In gerrit, you need to add the url in its configuration and in gitweb, you need to point project root into git repo inside gerrit…

No,no, it is interesting, after installed my gitweb package, it seems I need not to configure, anyway, if needs, then

/etc/gitweb.conf & <reviewsite>/etc/gerrit.conf

Now I got them all inside, my git integration with redmine is back

image image

Summary

Now they all sit inside the virtual machine for demo.

Ubuntu with root permission helps me well for trying different application and from it, I can also learn a lot, hope we can use it more freely soon.

// Also try to see whether this is automatically poped into weibo

ALM first setup for designers – 1

Thursday, December 30th, 2010

imageIn ALM (Application Lifecycle Management), for designers, it needs to

  1. deal with issue management system to fetch requirement/tasks
  2. coding towards version control system
  3. montior/trigger CI building system after commit
  4. And all this are better to be integrated into IDE system

Here we use teamforge as issue management system, git as VCS, and hudson as CI, and we use eclipse as IDE, now it is possible to work together, this free version is not integrated perfect, but we can see what it could be.

Mylyn connector is used in eclipse IDE to deal with the issue management system

What we needed

Now you be able to do them all in one IDE, I ask some colleagues to demo this in more practically, but you can start to experience.

I will also hack the gitweb script to let you link commited codes directly to the issues (requirement)

Let’s play with git – gitolite & gitweb

Friday, July 2nd, 2010

Try to anwser some own questions yesterday (Let’s play with Git – settig up gitolite (not done))

  1. (question 1:, do I need to set the git-daemon for this? , seems not)
    No, it doesn’t need the git-daemon, it hooks into ssh protocol to forward the authentication to git command (sth. like this)
       1: git@ubuntu:~$ more .ssh/authorized_keys

       2: # gitolite start

       3: command="/usr/share/gitolite/gl-auth-command rdccaiy",no-port-forwarding,no-X11-forwarding,no-a

       4: gent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4gfE1pdb0kpDeHAZ0olyMizYg0tMwikt3hOC

       5: iYRMdXKmn6LX2ybhfgVWixwOb88IOdiW2pOS3g1....

  2. (question 2: I have to use git clone git@192.168.56.151:repositories/gitolite-admin, in document, repositories should not be included)

    It is a typical error on the public key (my problem is use openssh to generate key, while using putty’s ssh to connect), see 6-ssh-troubleshooting.mkd in gitolite

  3. (question 3: rdccaiy is not used in current step ?)

    It is answered in question 1, the private key will be matched (no password used), it will be done automatically

Anyway, playing with git server, you need strong ssh knowledge, otherwise you will be confused, let’s continue on the configuration, and I try to add another user “user” into gitolite admin

Add user to admin the gitolite

One of the neat thing in gitolite is most of tasks are finished in config file, and it is under git control (fullfil some audit pilicy)

   1: $ git clone git@192.168.56.151:gitolite-admin

   2: $ cd gitolite-admin

   3: # edit conf/gitolite.conf

   4: $ more gitolite-admin/conf/gitolite.conf

   5:        repo    gitolite-admin

   6:                 RW+     =   rdccaiy user

   7: # copy user's public key to 

   8: $ scp user@192.168.56.151:.ssh/id_rsa.pub keydir/user.pub

   9: $ git add keydir/user.pub

  10: $ git commit -a -m "add user"

  11: $ git push

Then switch to user “user” in my virtual machine, I can clone out the gitolite-admin as well (since I am admin now)

Add new repository

It is similar to the above the configure, clone out, update the conf file (I add new repo proj), and commit

   1: user@ubuntu:~/git/gitolite-admin$ vi conf/gitolite.conf

   2: user@ubuntu:~/git/gitolite-admin$ more conf/gitolite.conf

   3: ..

   4:         repo    proj

   5:                 RW+     =   @all

   6: ..

   7: user@ubuntu:~/git/gitolite-admin$ git commit -a -m "add new repo"

   8: [master 87cf1b1] add new repo

   9:  1 files changed, 3 insertions(+), 0 deletions(-)

  10: user@ubuntu:~/git/gitolite-admin$ git push

  11: Counting objects: 7, done.

  12: Compressing objects: 100% (3/3), done.

  13: Writing objects: 100% (4/4), 370 bytes, done.

  14: Total 4 (delta 1), reused 0 (delta 0)

  15: remote: Already on 'master'

  16: remote: creating proj...

  17: remote: Initialized empty Git repository in /home/git/repositories/proj.git/

  18: To git@192.168.56.151:gitolite-admin

  19:    09a85e3..87cf1b1  master -> master

See Line 16/17: the gitolite will automatically create the repository for me, excellent. see reference : 2-admin.mkd and http://progit.org/book/ch4-8.html

Then it is more time to understand the config files to config the authority.

Config it with Gitweb

The document is not clear, http://github.com/sitaramc/gitolite/blob/pu/doc/3-faq-tips-etc.mkd#helping_with_gitweb, after hacking into gitweb cgi script (bring me back to 10 years ago on perl script ;-) , I just want to give quick solution, it is possible to arrange access control on http as well.

Create projects.list and give read permission 755 to that repo, add description under it to describe your project

   1: git@ubuntu:~$ more projects.list

   2: proj.git rdccaiy

   3: git@ubuntu:~$ ls -al repositories/proj.git/

   4: ..

   5: -rwxr-xr-x 1 git git   11 2010-06-30 14:14 description

And update gitweb’s configuration

   1: git@ubuntu:~$ more /etc/gitweb.conf

   2: # path to git projects (<project>.git)

   3: $projectroot = "/home/git/repositories";

   4: # file with project list; by default, simply scan the projectroot dir.

   5: $projects_list = "/home/git/projects.list";

Good to see this again with gitolite.

image

Summary with gitolite over gitosis

- development is more active (it means it is improving ..)

- easy setup, and all changes are in git repositories (changes are logged, audit)

- better access control

One small disadvantage is it is less popular and less documentation, while when u understand it, it is ok.
[updated after Sitaram's comments], the documentation here means the public information you can find in google, the document from the tool itself (in github) are quite good, and author Sitaram is willing to answer your questions related to gitolite

Let’s play with Git – setting up git server

Wednesday, June 30th, 2010

Using ssh protocal (git clone ssh://user@gitserver/app) is one way for git, and git protocol should be more native (git clone git://gitserver/app), and it provides better speed.

It should be smoothly using git-daemon, while I still spend half-day to figure it out. ;-(

Install git-daemon

Simple install it by apt-get “sudo apt-get install git-daemon-run”, it contains the git-daemon to support git protocol (http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html), let’s see what happen in Ubuntu after installation

   1: user@ubuntu:/var/cache$ dpkg -L git-daemon-run

   2: /.

   3: /etc

   4: /etc/sv

   5: /etc/sv/git-daemon

   6: /etc/sv/git-daemon/log

   7: /etc/sv/git-daemon/log/run

   8: /etc/sv/git-daemon/run

   9: /usr

  10: /usr/share

  11: /usr/share/doc

  12: /usr/share/doc/git-daemon-run

  13: /usr/share/doc/git-daemon-run/copyright

  14: /usr/share/doc/git-daemon-run/README.Debian

  15: /usr/share/doc/git-daemon-run/changelog.gz

  16: /usr/share/doc/git-daemon-run/changelog.Debian.gz

It is installed as service, see file in Line 8 (run) and Line 14 (README) to understand,

   1: user@ubuntu:/var/cache/git$ more /etc/sv/git-daemon/run

   2: #!/bin/sh

   3: exec 2>&1

   4: echo 'git-daemon starting.'

   5: exec chpst -ugitdaemon \

   6:   /usr/lib/git-core/git-daemon --verbose --base-path=/var/cache /var/cache/git

Generally it use /var/cache as base, so when you “git clone git://gitserver/git” it will redirect to /var/cache/git, what I make mistake is the last directory “/var/cache/git”, I misunderstand this, and put my existing myproj.git into /var/cache/, then it doesn’t work. It should be put under /var/cache/git

Also another is –-export-all parameter in git-daemon, if not specified as default, you need touch one “git-daemon-export-ok” file inside /var/cache/git, see detail in http://stackoverflow.com/questions/2538015/why-wont-git-daemon-serve-my-repository

Install gitweb

It is straightforward, since it is combined with apache2, no extra config after install

   1: user@ubuntu:~$ sudo apt-get install gitweb apache2

   2: user@ubuntu:~$ more /etc/gitweb.conf

   3: # path to git projects (<project>.git)

   4: $projectroot = "/var/cache/git";

   5: ...

See the result on browser

image

Later this week I will look into security part using gitosis