Category Archives: Just for archive

How to setup a remote GIT repository and play with branching

Given, you are a new GIT user/admin and want to setup an SVN like client-server architecture for your git repositories, wherein a server hosts the repository and many developers use that repository to track source code.

Do checkout Peepcode’s screencast on using Git. It is a MUST watch for any new Git user/admin.

ORIGIN
(we cannot create a –bare repo as redmine needs a .git directory, while –bare does not creates a .git dir)
git init
git add .
git commit -m “initial import”

LOCALHOST
git clone user@origin_server.com:/path/to/git/repo
git remote show origin # Confirm that master is tracking master
git commit -a -m “some changes”
git push # push to origin, content from local master as master is tracking master

## Creating a new branch on the clone
git branch experiment
git commit -av “changes i made”
git push origin experiment # To be done only once after creating a branch. Next time onwards, just “git pull/push”.
git remote show origin # confirm that master is tracking master, experiment on local is tracking experiment on origin

## Using someone’s branch from origin
git branch -a
-> *master
-> origin/master
-> origin/new_experiment
git branch –track new_experiment origin/new_experiment # Creates a new tracker with new_experiment of local is tracking new_experiment on origin
git branch -a
-> *master
-> new_experiment
-> origin/master
-> origin/new_experiment
git checkout -b new_experiment
git commit -av “my changes to new_experiment”
git push # Commits changes to new_experiment branch

Once you are through with creating initial repos, and your branches on local are tracking the respective branches on remote, pushing/pulling is just a matter of doing “git push” and “git pull”.

I am simply loving it… err… git :)

How to create subdomains for domains bought via Google Apps (Enom)

This was supposed to be the easiest thing (as in CPanel – goto Subdomains, click create a new subdomain, specify a directory and you’r done!)… but allas! It took me a full day to figure this out :(
I’m sad…

Anyways… as Enom’s Domain control panel is, there is no way of doing this. All you can do, is create A/CNAME/Redirection/TXT records. Ofcourse, they are not providing the hosting… so them knowing about the directory structure is perfectly – a valid problem.

After conversing with Enom’s helpful support staff (in near realtime), I was able to solve the problem…

Problem
But then, how do you create a subdomain on a domain which is bought via Google Apps and who’s DNS is managed by Enom?

Assumptions

  • You want to create a subdomain test.example.com
  • You have a r00t access
  • You are using Ubuntu with Apache2
  • Your example.com resolves to 1.2.3.4

Solution
At Enom control panel – add an “A” record with the value of 1.2.3.4 (address field) and “test” as hostname field (without the “”) and save.

At your hosting server end…
Apache2 needs to be told to create a VirtualHost for your subdomain
Your /etc/apache2/sites-available/example-com file (example-com is just a random name, replace it with your virtual hosts file name) should look like

NameVirtualHost *:80

<VirtualHost *:80>
ServerName example.com
DocumentRoot /my/document/root
</VirtualHost>

<VirtualHost *:80>
ServerName test.example.com
DocumentRoot /my/document/root/test
</VirtualHost>

Restart apache2 and you’r done!
Wait for a few minutes for the changes to propogate… and try hitting http://test.example.com in your browser.

Good Luck!

Super easy SUB-URI hosting with mod_rails

With an Amazon EC2 instance up, next very obvious task was to get the hosting up. Objective was to host static content along with multiple Rails apps on the same EC2 instance. Purists might not agree to this, but getting up and running was the first target.

Apache is configured with DocumentRoot as /mnt/app/shared

My Rails apps live inside /mnt/app/releases/<app_name>/<app_dir_structure>

<app_name_1> should be exposed as http://blah-blah.com/dev

/etc/apache2/sites-available/ looks like

<VirtualHost *:80>
DocumentRoot /mnt/app/shared
RailsBaseURI /dev
</VirtualHost>

<VirtualHost *:80>

DocumentRoot /mnt/app/shared

RailsBaseURI /dev

</VirtualHost>

(This is important)
Inside the /mnt/app/shared directory, my /dev symlink now points to /mnt/app/releases/<app_name_1>/public

And inside my <app_name_1>/config/environment.rb, just before the Initializer block ends, add

config.action_controller.relative_url_root = "/dev"

And you’r done! Touch the <app_name_1>/tmp/restart.txt file and reload your app in the browser! It should be running!

Some excellent material to read before attempting this…

Oh yeah, the AMI being used is Webficient’s Ubuntu 8.04 image, with Rails 2.3.2, passenger, etc etc.

Next target – move over the configuration to Puppet!

Good Luck :)

Understanding the XMMS equalizer

For people like me, who have almost no technical knowledge of what elements compose a sound stream – specially today’s music, managing the equalizer to get just the right music is bit too much experimenting. All I want is my music to sound just right!

Admist all the preparation I’m doing for tomorrow, I managed to get hold of Tyronne (my new roomy, the earlier Sinhalese language maintainer at Red Hat, now working with the JBoss team) and asked him to explain me the equalizer settings & what frequency means what & how to best utilize it.

ATM, i’m listening to Salim Shahzada’a Aaja Nachle & the setting I did a few songs back is still rocking my ears! I’ve tried configuring xmms’s equalizer for pleasant vocals & the following setting is seemingly good for what I wanted :D

Following will help you to decide the best setting for you (what follows is not technical info but what I understood from what Tyronne told me – but the above setting is nice for lyrics heavy songs)

  • 60 – Heavy Base
  • 170 – Base
  • 310 – Muddy Base
  • 1K and 3K – Vocals
  • 6K and 12K – Distortion
  • 14K and 16K – Sharp highes

The above equalizer setting is sounding soo good that I’ve saved it as the default preset :D