Blogs

How to setup Jenkins With Grails on Ubuntu

June 17, 2013 by shashikant

In this blog I am going to share how to configure jenkins with grails on Ubuntu.

Step 1.

Install jenkins via command:

wget http://pkg.jenkins-ci.org/debian/binary/jenkins_1.518_all.deb //download jenkins.deb file.

Step 2.

I assume that Java,Grails and latest version of Git is installed on your Machine if not please install them for further configuration.

Now

Install daemon via command: sudo apt-get install daemon

Install jenkins via command: sudo dpkg -i filename.deb

Step3 :

The default port of jenkins is:8080 .If you want to change the port number go to etc/default directory and open jenkins file in editor and change the port no.

Step 4 :

Now start jenkins via command : sudo service jenkins start

you will see on terminal

Starting Jenkins Continuous Integration Server jenkins          [ OK ]

after that, type in browser http://localhost:8888 //8888 is my default port for jenkins

you will see the jenkins dashbord on browser

Step5:

Now click on manage jenkins and install required plugin

Here is the list of required plugin for grails.

1.Ant plugin 2.ChuckNorris plugin 3.Crediantials Plugin 4.External Monitor Job Type Plugin 5.Git Hub Api Plugin 6.Git hub plugin 7.java doc plugin 8.jenkins cvs plugin 9.jenkins git client plugin 10.jenkins git plugin 11.jenkins grails plugin 12.Jenkins mailer plugin 13.jenkins SSH plugin 14.Jenkins SSH slaves plugin 15.jenkins subversion plugin 16.Jenkins translation assistance plugin 17.Ldap plugin 18.Maven Integration Plugin 19.PAM Authentication plugin 20.Publish Over SSH plugin 21. SSH Crediantial plugin.

Step 6 :

After successfull installation of plugins:

create a new job like this:

  • create a Job name

  • checked the radio button of Build a free-style software project

  • click OK

Step 7 :

  • Now checked the radio button for Git

  • enter the uri of your git repeository.

 

If you will see the error like

Failed to connect to repository : Command "git ls-remote -h git@example.git HEAD" returned status code 128:

stdout:

stderr: fatal: 'git@example.git' does not appear to be a git repository

fatal: The remote end hung up unexpectedly

You have to do some more configuration:

  • Go to to the terminal

  • Run this command :sudo visudo

  • Add jenkins   ALL=(ALL:ALL) ALL  in this file where sudo previlage is defined.and close the file.

  • login as jenkins user via command :sudo su jenkins

  • Create a .ssh directory in the jenkins home directory.

  • create the public private key pair like this.

Generating SSH Keys:

Step 1: Check for SSH keys

First, we need to check for existing ssh keys on your computer. Open up Terminal and run:

cd ~/.ssh # Checks to see if there is a directory named ".ssh" in your user directory

If it says "No such file or directory" go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.

Step 2: Generate a new SSH key

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. # Enter file in which to save the key (/home/you/.ssh/id_rsa):

Now you need to enter a passphrase or file.press enter without to write any thing.

Which should give you something like this:

Your identification has been saved in /home/you/.ssh/id_rsa. # Your public key has been saved in /home/you/.ssh/id_rsa.pub. # The key fingerprint is: # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com

Step 3: Add your SSH key to GitHub

Go to your Account Settings

 

.

Click "SSH Keys" in the left sidebar

  1. Click "Add SSH

  2. key"Paste your key into the "Key" field

  3. Click "Add key"

  1. Confirm the action by entering your GitHub password

Step 4: Test everything out

To make sure everything is working you'll now SSH to GitHub. When you do this, you will be asked to authenticate this action using your password, which for this purpose is the passphrase you created earlier. Don't change the git@github.com part. That's supposed to be there.

Run the command on terminal:

ssh -T git@github.com # Attempts to ssh to github

You may see this warning:

The authenticity of host 'github.com (207.97.227.239)' can't be established. # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. # Are you sure you want to continue connecting (yes/no)?

Don't worry, this is supposed to happen. Verify that the fingerprint matches the one here and type "yes"

Hi username! You've successfully authenticated, but GitHub does not # provide shell access.

If that username is correct, you've successfully set up your SSH key. Don't worry about the shell access thing, you don't want that anyway.

 

Now go to the step 7 again

hope this time you will be successfully connected to your git repository.

Now you have to configure Jenkins Envinment.

  • go to Manage jenkins ->configure system

  • Click on Grails Installation.

  • Add name of your grails version.(optional)

  • Add path of your grails SDK to Install directory field.

  • Click on JDK Installation.

  • Add name of your Java version.(optional).

  • Add path of your JDK to Install directory field.

  • now go to Git Plugin

  • Add your git user name to Global Config user.name Value field

  • Add your email id to Global Config user.email Value field.

Click on save button. Now your jenkins is configured for your grails environment.

step 8.

  • Now click on your project->configure

  • checked the check box Pull SCM under Build Triggers

  • Enter H/5 * * * *  in the field Schedule

  • Click on Add build step->Execute Shell.

  • Add your mechine specific setting in Command field to stop the server.

  • for example:

           sudo sh /home/shashikant/apache-tomcat-7.0.40/bin/shutdown.sh

  • Click on Add build step->Build with grails.

  • change grails installation Default to your grails version.

  • Add "war target/ROOT.war" to target field

  • Again Click on Add build step->Execute Shell.

  • Add your mechine specific setting in Command field.

  • For my machine its :

sudo rm -rf /home/shashikant/apache-tomcat-7.0.40/webapps/ROOT*

sudo mv /var/lib/jenkins/jobs/OodlesVid/workspace/target/ROOT.war /home/shashikant/apache-tomcat-7.0.40/webapps/

sudo sh /home/shashikant/apache-tomcat-7.0.40/bin/startup.sh

Click on save .Now your jenkins is Ready to use.


 

Mobile application development frameworks comparison matrix , PhoneGap Vs Appcelerator Titanium

June 14, 2013 by Ajit

Should you use PhoneGap or Appcelerator Titanium for developing a mobile application ?

Well, its has been an interesting and lengthy discussion among mobile app developers. "Code once and run everywhere,” that’s what most developers want .PhoneGap and Titanium serve almost the equal purpose for developers i.e developing cross-platform mobile applications. However, they differ in several aspects.So what a mobile developer should choose if he is looking for cross platform mobile apps development?Which is better and why?

 

I have been working with these two frameworks.so lets have a short comparison between these two.

 

PhoneGap

In PhoneGap framework, developers can build applications using HTML/CSS/JavaScript, including JavaScript classes that gives us access to device’s hardware,Motion features,touch features and other APIs feature like contacts, file, camera, storage, microphone, GPS, etc. The final application is then wrapped within a platform native 'Webview' browser generated object, and then becomes a useful web application with the ability to access some and most device- specific features.

Appcelerator Titanium

In Titanium framework, developers can build application using Javascript and Titanium's APIs. The Javascript is then interpreted at runtime. The application's UI becomes completely as that of native. The Javascript code made calls to the Titanium API which are mapped to native code in the Titanium framework and generate native components. Events generated against the call in those components are sent back to the code in Javascript where we can handle them.The end result is a fast performance app.

 

Lets have a look to both frameworks directory structure which will clear most of the things.

 Titanium’s IDE                                          Phonegap with Eclipse IDE

Lets have an one-to-one comparison between both frameworks based on some specific points.

                                            Phonegap                      Titanium              Extra Notes

Support for different Platforms

Android,BlackBerry WebWorks (OS 5.0 and up),iOS,Windows Phone 7 and 8,Bada 1.2 & 2.x,webOS,Tizen.

iOS, Android,Mobile Web (beta),Blackberry (beta),Tizen.

Phonegap supports several more platforms than Titanium.

Native-UI Support

No, there are currently attempts made to fix this.

Yes

Phonegap is limited to the device’s WebView.

Installation Requirements

Ruby, Java SDK, Platform SDKs, PhoneGap

Titanium, Platform SDKs, Java SDK

 

Application Performance

Not as good as Titanium since everything is rendered within a ‘Web View’ of a browser.

Not as good as a native app, but better than Phonegap since native code is produced in the backend.

One advantage of Titanium over Phonegap is that Titanium provides access to device native UI functionalities ,thus provides better performance.

Javascript API support

yes

yes

Both platforms support Javascript API’s in different ways.

Support HTML/CSS

PhoneGap uses HTML5, Javascript and CSS3 for creating application UI and functionality.

Titanium uses just pure Javascript for creating both UI and functionality.

Phonegap is web app that runs on a native web browser view.

App Development cost & effort

Using PhoneGap, any developer can quickly develop a cool application using HTML, CSS and JS.Additionally you can use any back end technology such as PHP, .NET or Ruby.   i’ve used PhoneGap with jQuery Mobile to produce a great looking business application.

Titanium is more complex and requires a JS SDK to do its heavy tasks. Thus, development times are more and it costs more to produce an Application.   You will also need a expert JavaScript developer with good skills of development.

Most developers may not agree with this but personally, i found phonegap as time and effort saving for developing an application as compared to Titanium.

Ease of Debugging

Easy to debug Application.

Not so better debugging like Phonegap.

Debugging PhoneGap application is way better than Titanium because they depend on the standard Webkit which can be debugged using web developer tools.

Data Storage

PhoneGap supports local storage, IndexedDB, and WebSQL etc.

Titanium supports only SQLite embedded database.

Phonegap storage API is based on the W3C Web SQL Database Specification and W3C Web Storage API Specification.

 

To conclude I would say,If you are looking to create an app with native look and feel using some good JavaScript development skills inhouse Titanium is the right choice, but if you want to be able to “port” your app to various platforms and devices more easily with less time and efforts, PhoneGap is the better option to go for.

 

So pick the one that suits your requirement.Happy Developing.

 

Cheers !!

 

Live video stream recording using Wowza Media Server

June 06, 2013 by Ashish Sharma

Wowza provide two methods for starting and stoping the live streaming process:-

  • to start recording "startRecording(streamName, recordOptions);"
  • to stop recording "stopRecording(streamName);"

The recording in live streaming generally happens in two formats: FLV and MP4.Some of the other available setting by Wowza

  • append=> if a file already exist then appends the recording, by default it is false.
  • version/overwrite=> This creates different version of live stream if set to version or overrides if any file exists. Default is version
  • startonkeyframe=> This starts recording when a key frame occurs in live stream, by default it is false.
  • recorddata=> Cuepoints and metadata are included by this option, by default it is false.
  • output=> An absolute path along with stream name and extension is used to save the recording. This is empty by default. Application's content folder saves the recording with stream name, and using the extension like ".flv" or ".mp4"
  • Install Application Module

    1. Add jar files wms-plugin-integrationrecord.jar and wms-plugin-livestreamrecord.jar to the lib folder where you have installed the Wowza media server.
    2. Edit Application.xml in the conf/[application] directory of the installation directory with the following code:
      		<Module>
      			<Name>ModuleLiveStreamRecord</Name>
      			<Description>ModuleLiveStreamRecord</Description>
      			<Class>com.wowza.wms.plugin.livestreamrecord.ModuleLiveStreamRecord</Class>
      		</Module>
    3. Run using Flash client Double click client\livestreamrecord.html and change the Server and Stream fields to the RTMP URL and Stream name of your live stream and click the Play button. Once the live stream playing, click the Start Recording button to start recording the stream. Click Stop Recording when you want to stop recording the stream.

Creating Installer using IZPack

May 24, 2013 by Ashish Sharma

-Download and install IZPack from the given link (http://izpack.org/downloads/)

(Note: I have tried both the version 4.3.5 and 5.0.0, and 4.3.5 version seems more promising)

-create a separate folder which will contain all your files for the installation (i have created it in a D Drive with name myInstaller)

-copy the bin folder from the directory where you have installed your IZPack to you newly created directory.

-create a xml file with name "install.xml"

	<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
	<installation version="1.0">
		<info>
			<appname>Your AppName</appname>
			<appversion>1.0</appversion>
			<authors>
				<author name="Name" email="mymail@gmail.com"/>
			</authors>
			<url>ThisIsMyProject.com</url>
		</info>
		<guiprefs width="640" height="480" resizable="yes"/>
		<variables>
			<variable name="DesktopShortcutCheckboxEnabled" value="true"/>
		</variables>
		<locale>
			<langpack iso3="eng"/>
		</locale>
		<resources>
			<res src="shortcutSpec.xml" id="shortcutSpec.xml"/><!--This is used for creating shortcuts in desktop and program group-->
			<res id="LicencePanel.licence" src="License.txt"/>
			<res id="InfoPanel.info" src="Readme.txt"/>
			<res id="Installer.image.0" src="logo.png" />
		</resources>
		<panels>
			<panel classname="HelloPanel"/>
			<panel classname="LicencePanel"/>
			<panel classname="TargetPanel"/>
			<panel classname="PacksPanel"/>
			<panel classname="InstallPanel"/>
			<panel classname="ShortcutPanel"/>
			<panel classname="FinishPanel"/>
		</panels>
		<dependency>
			<groupId>org.codehaus.izpack</groupId>
			<artifactId>izpack-standalone-compiler</artifactId>
			<version>4.3.5</version>
		</dependency>
		<packs>
			<pack name="Base" required="yes">
				<description>Base Files</description>
				<file src="app.ico" targetdir="$INSTALL_PATH"/>
				<file src="MyProgram.exe" targetdir="$INSTALL_PATH"/>
				<file src="License.txt" targetdir="$INSTALL_PATH"/>
				<file src="Readme.txt" targetdir="$INSTALL_PATH"/>
				<fileset dir="myFolder" targetdir="$INSTALL_PATH/myFolder">
					<include name="**"/>
				</fileset>	
			</pack>
			<pack name="XYZServices" required="no">
				<description>XYZServices files</description>
				<file src="someMoreFile.txt" targetdir="$INSTALL_PATH"/>
			</pack>
		</packs>
		<native type="izpack" name="ShellLink.dll"/>
		<native type="3rdparty" name="COIOSHelper.dll" stage="both">
			<os family="windows"/>
		</native>
	</installation>

-create shortcutSpec.xml for creating shortcuts of your installed files

	<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
	<shortcuts>
		<skipIfNotSupported/>
		<programGroup defaultName="Tpsynergy Transform Client" location="applications"/>
		  <shortcut
			name="My Application"
			programGroup="yes"
			desktop="yes"
			applications="yes"
			startMenu="yes"
			startup="no"
			target="$INSTALL_PATH\MyProgram.exe"
			commandLine=""
			description="My Application Description"
			iconFile="$INSTALL_PATH\app.ico"
			iconIndex="0"
			initialState="noShow"
			workingDirectory="$INSTALL_PATH">
			 <createForPack name="Base"/>
		   </shortcut>
		<shortcut
			   name="My App Uninstaller"
			   programGroup="yes"
			   desktop="no"
			   applications="no"
			   startMenu="no"
			   startup="no"
			   target="$INSTALL_PATH\Uninstaller\uninstaller.jar"
			   commandLine=""
			   iconFile="%SystemRoot%\system32\SHELL32.dll"
			   iconIndex="31"
			   description="Uninstall My Application">
			<createForPack name="Base"/>
		</shortcut>
	</shortcuts>

-If you have runnable jar file of your project then you can use launch4j to create an exe of the jar file.

-Now to create the installer

   1. first open the command prompt

   2. go to the bin directory of IZPack installation directory

   3. now run the following command "compile D:\myInstaller\install.xml -b D:\myInstaller"

-you will get an install.jar file in the "D:\myInstaller" directory, use it to install the application

Debugging php files in IDE using xdebug

May 23, 2013 by Ashish Sharma

1. Download xdebug from "http://xdebug.org/download.php"

2. The downloaded file contains the dll file

3. Copy the dll file to the following path "C:\wamp\bin\php\php5.4.3\zend_ext"

4. Now open the php.ini file and add the following lines:

(php.ini file contains in both the folders that is apache and php, it is advisable to configure the file which is present in apache folder)

zend_extension = "c:/wamp/bin/php/php5.4.3/zend_ext/php_xdebug-2.2.0-5.4-vc9.dll"(use zend_extension_ts as variable name if you are using php version below 5.3)
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp"

5. zend_optimizer is not compatible with xdebug so comment the line in php.ini which has a zend _optimizer written in it.

6. Make sure that "c:/wamp/tmp" exist in file system, if not then create that directory

7. Restart your apache services

8. Open your NetBeans or eclipse IDE and configure xdebug in settings

Powered byApache Solr

Follow Us

Recent Entries