Wednesday, 29 January 2014

How to: Create Passwordless SSH Remote Login

The intention is simple: just let me in without asking for password again and again!

Follow the steps to achieve this:

1. Generate RSA key from host machine (skip this if you have already got one)

ssh-keygen -t rsa -C <youremail@email.com>

Accept the default location and DO NOT give a password to it.

2. Copy the RSA key generated to your remote machine

cat ~/.ssh/id_rsa.pub | ssh root@<remotemachineipaddress> 'cat >> ~/.ssh/authorized_keys'

So far, it is all done.

3. A step further

It would be great if can we save the time on typing the hideous 'SSH' and 'blarblar@blar.blar.blar.blar' as well, wouldn't it? Set up an alias for it from your host machine then.

alias apple='ssh root@<remotemachineipaddress>'

Put the line into '~/.bashrc' so that it would persist.

And there we go, apple is your new login!

Sunday, 26 January 2014

How to: Use TAL Application Monitor to Trace Application Performance

As the scope of TV application keeps on expanding, we always get into a pitfall of being not considerate enough for low end devices. And the consequences could be devastating. Here, I am going to introduce a new way of benchmarking the performance of the TV application as new functionalities are being developed and also keeping an eye on its impact on performance.

* Pre-requisite

If your application is built upon TAL and Zend Framework, then you are good to go! 

* On the fly

1. Get TAL Performance Monitor from GitHub.

What it does is to manipulate TAL components with the custom behaviours, such as dumping FPS figures onto your terminal in this branch.

2. Create SymLink to 'talperformancemonitor.js' from tv application.

cd /<tvapplicationpath>/
ln -s /<talperformancemonitorpath>/talperformancemonitor.js talperformnacemonitor.js

3. Configure TV application header to launch with TAL Performance Monitor.

Drop in the following line in TV application header, which normally resides in <getApplicationSpecificHeader> tag in index.spv for application developed using Zend.

<script type="text/javascript" src="<?=$this->webapp->getScriptUrl('<tvapplicationname>')?>/talperformancemonitor.js"></script>

Or simply make sure 'talperformancemonitor.js' is used in the application to override TAL component.

4. Update host IP in 'talperformancemonitor.js'.

5. Turn off Firewall on the host machine, so that the loggings will not get blocked.

6. Execute 'server' script in TAL Performance Monitor and start the application. 

The remote feedback will be sent and displayed on the terminal as soon as there is any activity in the running instance.

So far, it is all done! Figures crossed :)

7. Use Cucumber to automate the scenarios and get output stacks. I will also post how to setup Cucumber BDD environment in due time.

* Improvements to TAL Performance Monitor

1. Create generic loggings for various TAL components.
2. Record performance information in database (NoSQL preferably).
3. Output and analyse recorded information as chart or other meaningful format.
4. Build into Continuos Integration to improve performance tracing.