Skip to main content

Opening Post

iCode : Do You Love Coding As Much As We Do ?


for a demo :

visit : http://inspirators.homelinux.net/iCode

iCode is a GIT hosting facility, with custom administration tool and web interface. Thus iCode is much much ahead of being just a normal git server.

I assume you have a decent knowledge of what GIT and version control is. In case you don't, here's the resource.
http://git-scm.com

Now, moving ahead.

Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.


Pre-Installation

Before starting, make sure that:

1. You already have a Ubuntu 9.04 installed on your server.
2. You have a working internet connection.
The following instructions will guide you on how to set up and run a fully managed iCode for projects using git on your server.
We assume a setup of 2 Computers. The SERVER and the MANAGER.

On the SERVER

1. sudo apt-get install git-core
2. sudo apt-get install python-setuptools
3. cd ~/src
4. sudo git clone git@guthub.com:prince-mishra/mygitosis.git
5. cd mygitosis
6. python setup.py install
7. sudo adduser \
--system \
--shell /bin/sh \
--gecos ‘git version control’ \
--group \
--disabled-password \
--home /home/git \
git



On the MANAGER

8. ssh-keygen -t rsa
    a. press “enter” two times
    b. this generates a public/private RSA key and saves in /home/<username>/.ssh/id_rsa.pub
    c. Transfer this key to the /tmp of the SERVER

On the SERVER

9. sudo -H -u git gitosis-init < /tmp/id_rsa.pub
10. sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

On the MANAGER

11.  cd /var/www
12.  sudo git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git

(If the cloning doesn't work, maybe you have PermitRootLogin no in the SSH server, and you need to add gitosis user to it.)

    a. sudo vim /etc/ssh/sshd_config
    b. AllowUsers git

13.  cd gitosis-admin 
14.  Use your favorite editor to modify the contents of the mygitosis configuration file:
15. cd gitosis-admin
16. vim gitosis.conf

Adding a new project to the repository

Here is an example of the gitosis configuration file you clone before. Here it contains the default gitosis entry, and a new project entry:

[gitosis]

[group team]
writable = testproject
members = hostname.yourserver.com

[group gitosis-admin]
writable = gitosis-admin
members = keyfilename
hostname.yourserver.com or keyfilename is the name of the public key without .pub extension you copied into gitosis-admin/keydir/ directory.

17. After you've done editing, save the file, and commit it back to the server.

    a. git commit -a -m "Added a new project"
    b. git push

18. Any future projects will be added the same way.

Committing to the first project

To commit the project you just created, initiate a new git project, add files to it, commit it, then push it to your repository with the name you set up in gitosis config file.

19. mkdir testproject
20. cd testproject
21. git init
22. touch a_text_file.txt
23. git add .
24. git commit -a -m "Initial import"
25. git remote add origin gitosis@yourserver.com:testproject.git
26. git push origin master
The project should be committed!

 Adding users

First, gather their public SSH keys, which I'll call "kakashi.pub" and "naruto.pub", and drop them into keydir/ of your local gitosis-admin repository. Second, edit gitosis.conf and add them to the "members" list.

27. cd gitosis-admin
28. cp ~/kakashi.pub keydir/
29. cp ~/naruto.pub keydir/
30. git add keydir/kakashi.pub keydir/naruto.pub

Note that the key filename must have a ".pub" extension.
gitosis.conf changes:

 [group team]
  writable = testproject
- members = hostname.yourserver.com
+ members = hostname.yourserver.com kakashi naruto

Commit and push:
31. git commit -a -m "Granted Kakashi and Naruto commit rights to testproject"
32. git push
That's it. Kakashi and Naruto can now clone the testproject repository like so:

33. git clone git@yourserver.com:testproject.git

Kakashi and Naruto will also have commit rights.


iCode Browser interface

34. sudo apt-get install apache2 libapache2-mod-php5 php-geshi
35. sudo git clone git@github.com:prince-mishhra/iCode.git
36. sudo chown -vR www-data:www-data iCode
37. After finishing this operation, use your favorite editor to edit the config file for iCode:
38. cd /var/www/iCode/inc
39. sudo cp config.php localconfig.php
40. sudo chown www-data:www-data localconfig.php
41. sudo vim localconfig.php
42. Here is an example of the iCode localconfig.php with GeSHI and the testproject.git we created:

<?php
$conf['projects'] = array(
        'projectname' => array('repo' => '/home/git/repositories/testproject.git/'),
);
----------------------------------- Leave the remaining configuration settings
?>

    a. Now in your browser, navigate to 
         http://localhost/iCode 
    b. You will see iCode right there. If there are any errors saying “permission denied”, provide adequate    permissions on /home/git/repositories

Comments

Popular posts from this blog

Capture and compare stdout in python unit tests

A recent fan of TDD, I set out to write tests for whatever comes my way. And there was one feature where the code would print messages to the console. Now - I had tests written for the API but I could not get my head around ways to capture these messages in my unittests. After some searching and some stroke of genius, here's how I accomplished capturing stdout.

On working remote

The last company I worked for, did have an office space, but the code was all on Github, infra on AWS, we tracked issues over Asana and more or less each person had at least one project they could call "their own" (I had a bunch of them ;-)). This worked pretty well. And it gave me a feeling that working remote would not be very different from this. So when we started working on our own startup, we started with working from our homes. It looked great at first. I could now spend more time with Mom and could work at leisure. However, it is not as good as it looks like. At times it just feels you are busy without business, that you had been working, yet didn't achieve much. If you are evaluating working from home and are not sure of how to start, or you already do (then please review and add your views in comments) and feel like you were better off in the office, do read on. Remote work is great. But a physical office is better. So if you can, find yourself a co-working s

I was fat once! Now I run!

On Aug 12, 2013 I weighed 107 kg, which, for a 5'4'' guy, is 47 kg more than the Indian Army standards. But today, I weigh 82 kg, and I continue to lose a few pounds every week! At one point of time, running 100 metres would make me all tired and sweaty, but today I can easily run 10 km at a stretch! So this guide is for all those couch potatoes who have lost all hopes of getting a good body! I was at that stage myself. I know how it feels like. I know the bullshit that you keep telling yourself as to how you are not all that bad, and how the world should accept you the way you are! Let me tell you this straight! You are NOT special. You are just another lazy bum who wants things to change but does not want to endure any suffering! Or even worse, you are one of those who act on an impulse every few months. You hit the gym for a week and boom!, you lose it all again. The first step is to accept that you have a pathetic body and that this needs to change! Start Sm