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

How the Python import system works

How the Python import system works From:  https://tenthousandmeters.com/blog/python-behind-the-scenes-11-how-the-python-import-system-works/ If you ask me to name the most misunderstood aspect of Python, I will answer without a second thought: the Python import system. Just remember how many times you used relative imports and got something like  ImportError: attempted relative import with no known parent package ; or tried to figure out how to structure a project so that all the imports work correctly; or hacked  sys.path  when you couldn't find a better solution. Every Python programmer experienced something like this, and popular StackOverflow questions, such us  Importing files from different folder  (1822 votes),  Relative imports in Python 3  (1064 votes) and  Relative imports for the billionth time  (993 votes), are a good indicator of that. The Python import system doesn't just seem complicated – it is complicated. So even though the  documentation  is really good, it d

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

Todo lists are overrated

My tasks come from a variety of sources: 1) Tasks from emails  2) Meeting notes with details of people who participated  3) Project related tasks that can have a long format and can be tagged/ delegated  4) Scratchpad for unrefined ideas  5) Detailed documentation for completed technical tasks / ideas  6) FIFO list of high priority small daily tasks No one app has been able to map all the requirements above, and I have tried a lot of them! In my lifetime I’ve tried a dozen todo apps. In the beginning they all seem different, novel and special. Slick UI, shortcuts, tags, subtasks, the list goes on and on. But all our stories were the same: I start using the new app, then after awhile I stop using it. Up until the last week I thought the problem was in myself (you probably think so too). After all, David Allen seems to have figured this shit out. Also there are people leaving long 5 star reviews on every major todo list app, they discuss them on forums, recommend them to friends. But the