Tuesday, July 7, 2015

Install Citrix Receiver on Ubuntu 14.04

Last week I need to install Citrix on my Ubuntu machine to access a remote server until I get the permissions for the network. I found [1] is useful during setting up Citrix on ubuntu servers.

Once installed when opening a session I got the following error ‘“Thawte Premium Server CA”, the issuer of the server’s security certificate (SSL error 61)’ to resolve this when searching I found steps to resolve on [2].

Hope this will be useful to me or anyone in future.

[1] https://help.ubuntu.com/community/CitrixICAClientHowTo
[2] https://www.geekpete.com/blog/ssl-error-61-using-citrix-ica-client-on-linux/

Monday, May 4, 2015

Carbon Pluggable Runtime Framework - Part 2

The Carbon Pluggable Runtime Framework is the core module on kernel level for handling 3rd party Runtime management on Carbon server. A high level architecture of the runtime framework is shown in below diagram.

Runtime service
For runtime to be registered on the Runtime Framework, it should extend the provided Runtime SPI and expose the corresponding runtime service.

Runtime Service Listener
This will be listening to runtime register/unregister events and once runtime service is registered, the Runtime Service Listener will notify the RuntimeManager.

Runtime Manager
This will keep the information about available runtimes.



Once all the required runtime instances get registered, the Runtime Framework will register the Runtime Service which provides the utility functionalities on the Runtime Framework.

What will be the advantage of using Pluggable Runtime Framework

With Carbon Pluggable Runtime Framework we can integrate/plug different 3rd party Runtime implementations to Carbon server. Not only that this framework facilitate the server to manage the registered Runtime's in a controlled manner. For example during server maintenance the underlying framework will handle the Runtime's by putting them on maintenance mode and start back when server is back on normal state. The developer or user did not need to know underlying process once you registered the Runtime on the framework.

Introduction to CARBON Runtimes - Part 1

What is a Runtime

When we considering a Runtime many aspects of a Runtime can be taken into consideration depending on its capabilities and features of it. For example if we consider Apache Axis2 Runtime it is a web service engine, Apache Tomcat is a implementation of the Java Servlet and JavaServer and Apache Synapse is a mediation engine likewise. Each of these Runtimes has its own features and capabilities. 


How features of a Runtime can be used

To facilitate its features a Runtime can expose different services that can be used. For example if we consider Axis2 Runtime it has Axis2Deployer which is responsible for artifact deployment and Axis2Runtime which is responsible about the Runtime aspect.


The Runtime can be utilized in Carbon by implementing the provided SPI implementations on the server. For example, by implementing the Deployer SPI, server can expose its custom deployer in such a way that it is recognised by the Deployment Engine. Likewise, Runtime SPI can be used to implement the runtime service.


Carbon Runtime Status

In the Carbon context, Runtime can be defined as an application level runtime instance that can run on top of Carbon OSGI framework. Runtime can have a different runtime status, depending on the state of the carbon server. Following diagram shows the available status options of a runtime.



Pending : A given Runtime is in idle state (before the Runtime initialization).

Inactive : The runtime has being initialized successfully. Runtimes can perform operations such as deploying artifacts.

Active : After the start() method of the runtime has been completed, the given runtime is fully functional and it can server requests to the runtime.

Maintenance : In this status, the runtime is on hold for maintenance work. That is, we are temporarily holding the serving of requests while the runtime is on intermediate/maintenance mode.

Git Branching Model

In Git version control system we can maintains multiple branches. For this example lets take Master branch and Development Branch.
  • Master Branch
This branch contains the most recently released Carbon Kernel. This is the main branch where the source code of HEAD always reflectsproduction-ready state.
  • Development Branch 
This branch is the main branch where the HEAD always reflects a state with the latest on going trunk development changes for the next release.

Start working on new feature

When you start to work on a new feature, you can create a separate feature branch for your self from the develop branch and start working. You can then merge your changes to the development branch once you complete the feature. The following instructions will guide you to start.


Task
Command
Description
Commit your changesgit commit -a -m "your commit message"Committing your changes to your local git repository
Creating a feature branchgit checkout -b myfeature developmentYou can create a new feature branch called myfeature from thedevelopment branch
Delete the worked feature branchgit branch -d myfeature
Incorporating changes to development branchgit checkout developmentThis will add your changes to your local development branch
Push the changes to development branchgit push origin developmentPush the changes to the central git repository under development branch


For more information visit http://nvie.com/posts/a-successful-git-branching-model/

Friday, September 5, 2014

Install SVN on RedHat Linux RHEL and configure DepSync on WSO2 worker manager nodes

  • After loggin in change the user into root user 
    • sudo -i 
  • You can install required packages using (This command will install Apache if its not already installed)
    • yum install mod_dav_svn subversion 
  • After this step SVN will be installed in the server and now we can configure it :) 
    • Navigate to /etc/httpd/conf.d/subversion.conf and modify it as below

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so<Location /svn>
<Location>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Basic
   AuthName "Subversion repositories"
   AuthUserFile /etc/svn-auth-users
   Require valid-user
</Location>
  • You can create SVN users using following commands 
    • htpasswd -cm /etc/svn-auth-users testuser
  • This will request password for for the user
  • Now finally since we sucessfully installed SVN created SVN user next we can create the repository :) 
    • mkdir /var/www/svn
    • cd /var/www/svn
    • svnadmin create mySvnRepo
    • chown -R apache.apache mySvnRepo
  • Next we need to restart the Apache server 
    • service httpd restart
Goto http://localhost/svn/mySvnRepo address using your browser. Now by giving the SVN user credentials you can login to the repo and view the content.


Once you provided the credentials you will be able to check the your repository and the content if any,


    Now lets configure WSO2 servers as Manager and Workers

Enabling DepSync on the manager node

You can configure DepSync in the /repository/conf/carbon.xml file on the manager node by making the following changes,

<DeploymentSynchronizer>
    <Enabled>true</Enabled>
    <AutoCommit>true</AutoCommit>
    <AutoCheckout>true</AutoCheckout>
    <RepositoryType>svn</RepositoryType>
    <SvnUrl>http://localhost/svn/mySvnRep/</SvnUrl>
    <SvnUser>testuser</SvnUser>
    <SvnPassword>testpass</SvnPassword>
    <SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
</DeploymentSynchronizer>

Enabling DepSync on the worker nodes

In worker node you need to set the AutoCommit property to false as below,

<DeploymentSynchronizer>
    <Enabled>true</Enabled>
    <AutoCommit>false</AutoCommit>
    <AutoCheckout>true</AutoCheckout>
    <RepositoryType>svn</RepositoryType>
    <SvnUrl>http://localhost/svn/mySvnRep/</SvnUrl>
    <SvnUser>testuser</SvnUser>
    <SvnPassword>testpass</SvnPassword>
    <SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
</DeploymentSynchronizer>

[1] https://docs.wso2.com/display/CLUSTER420/SVN-based+Deployment+Synchronizer
[2] www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel

Friday, June 13, 2014

WSO2 ESB - JSON to SOAP (XML) transformation using Script sample


  • Reqired SOAP request as generated using SoapUI
 <?xml version="1.0" encoding="utf-8"?>  
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">  
 <soapenv:Body>  
 <m:newOrder xmlns:m="http://services.com">  
 <m:customerName>WSO2</m:customerName>  
 <m:customerEmail>customer@wso2.com</m:customerEmail>  
 <m:quantity>100</m:quantity>  
 <m:recipe>check</m:recipe>  
 <m:resetFlag>true</m:resetFlag>  
 </m:newOrder>  
 </soapenv:Body>  
 </soapenv:Envelope>  

  • The object that I used to test on Advanced REST Client[2]:

POST request
Content-Type   : application/json
Payload           : {"newOrder": { "request": {"customerName":"WSO2", "customerEmail":"customer@wso2.com", "quantity":"100", "recipe":"check", "resetFlag":"true"}}}


  • Proxy configuration

 <?xml version="1.0" encoding="UTF-8"?>  
 <proxy xmlns="http://ws.apache.org/ns/synapse"  
 name="IntelProxy"  
 transports="https,http"  
 statistics="disable"  
 trace="disable"  
 startOnLoad="true">  
 <target>   
 <inSequence>  
 <script language="js"><![CDATA[  
 var customerName = mc.getPayloadXML()..*::customerName.toString();  
 var customerEmail = mc.getPayloadXML()..*::customerEmail.toString();  
 var quantity = mc.getPayloadXML()..*::quantity.toString();  
 var recipe = mc.getPayloadXML()..*::recipe.toString();  
 var resetFlag = mc.getPayloadXML()..*::resetFlag.toString();  
 mc.setPayloadXML(  
 <m:newOrder xmlns:m="http://services.com">  
 <m:request>  
 <m:customerName>{customerName}</m:customerName>  
 <m:customerEmail>{customerEmail}</m:customerEmail>  
 <m:quantity>{quantity}</m:quantity>  
 <m:recipe>{recipe}</m:recipe>  
 <m:resetFlag>{resetFlag}</m:resetFlag>  
 </m:request>  
 </m:newOrder>);  
 ]]></script>  
 <header name="Action" value="urn:newOrder"/>  
 <log level="full"/>  
 </inSequence>  
 <outSequence>  
 <log level="full"/>  
 <property name="messageType" value="application/json" scope="axis2"/>  
 <send/>  
 </outSequence>  
 <endpoint>  
 <address uri="http://localhost/services/BusinessService/" format="soap11"/>  
 </endpoint>  
 </target>  
 <description/>  
 </proxy> 


Referance

[1] https://docs.wso2.org/display/ESB481/Sample+441%3A+Converting+JSON+to+XML+Using+JavaScript

[2] https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

Did you forgot your MySQL password

I have installed MySQL server on my machine for many testing purposes and after that I forgot the password I used in many cases :D

There is a very simple way to reconfigure MySQL in Linux. 

manoj@manoj-Thinkpad:~$ sudo dpkg-reconfigure mysql-server-5.5 

This will allow us to reset the password on our MySql server.