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

Learn frontend to get good at backend : lessons for my 20 year old self

Only when you are the consumers of your own products, can you design the best ones! Same philosophies go for API design and programming in general.

This advice may seem counter-intuitive at first, but trust me, the best way to get better at backend programming is to spend some time doing frontend! It will teach you a lot about how your APIs are being used in the "real world". A first-hand experience of API consumption will tell you a lot about your design philosophies!

The economics of crypto investing

If you believe in the greater fool theory, there is no other market as speculative and volatile as the crypto market today. We are perhaps living in the biggest bubble of our times. I am not bullish on this market in particular. I am bullish on the mania. 90% of the cryptos we see today will crash. They are just tokens with no tangible value generation capability. However, I believe that the mania and euphoria will stay.

Having said that, should one consider investing in this market? Certainly!
The risk/reward is lovely, potential upsides and margins are huge and with 3-5% of your net worth, the bet on the mania is worth it.

How does one choose where to invest?

If you follow the stock markets, you are expected to do thorough Fundamental Analysis before investing. Expect the same for the crypto market. I invest in large caps. I invest in index funds. And I invest over and over again. Markets rise, always. Extrapolating the same strategy - invest in indices - the top 10 tokens by perfo…

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.