<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geek 2.0</title>
	<atom:link href="http://www.stormacq.com/feed/?amp;p=435" rel="self" type="application/rss+xml" />
	<link>http://www.stormacq.com</link>
	<description>Some not-so random thoughts about this small IT World</description>
	<lastBuildDate>Fri, 12 Apr 2013 13:57:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Python Script for AWS&#8217; Route 53 API Authentication</title>
		<link>http://www.stormacq.com/python-script-for-aws-route-53-api-authentication/</link>
		<comments>http://www.stormacq.com/python-script-for-aws-route-53-api-authentication/#comments</comments>
		<pubDate>Fri, 12 Apr 2013 10:18:31 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[Amazon]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[hmac]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[route53]]></category>
		<category><![CDATA[signature]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=544</guid>
		<description><![CDATA[In my last post entry &#8211; Setting Up a Private VPN Server on Amazon EC2 &#8211; I end up by providing tips to rely on a fixed DNS name every time you start your server. For the impatient : the full script is available on GitHub.  For all the others, let&#8217;s understand the problem and [...]]]></description>
				<content:encoded><![CDATA[<p>In my last post entry &#8211; <a href="http://www.stormacq.com/build-a-private-vpn-server-on-amazons-ec2/">Setting Up a Private VPN Server on Amazon EC2</a> &#8211; I end up by providing tips to rely on a fixed DNS name every time you start your server.</p>
<p>For the impatient : <a href="https://github.com/sebsto/AWSDNSAuth">the full script is available on GitHub</a>.  For all the others, let&#8217;s understand the problem and the proposed solution.</p>
<h2>Why automating DNS configuration ?</h2>
<p>This is a common problem with public cloud machines : at every start, the machine receives a different public IP address and public DNS name.  There are two methods to keep a consistent name to access your machine :</p>
<ul>
<li>bundle a <a href="http://en.wikipedia.org/wiki/Dynamic_DNS">Dynamic DNS</a> client (such as <a href="http://www.inatech.eu/inadyn/">inadyn</a>) and access your machine through its DynDNS domain name.</li>
<li>create a DNS A (address) or CNAME record (an alias) to point to the public IP address of your machine</li>
</ul>
<p>The latter solution is only valid if you have your own domain name.  It offers the maximum flexibility as you can configure the DNS as you need.</p>
<p>To automatize the task, your DNS provider must provide you with a programmatic way to change its configuration : an API. This is exactly what Amazon&#8217;s <a href="http://aws.amazon.com/route53/">Route 53 DNS Service</a> offers you.</p>
<p>To complete my previous article, I choose to add at the end of my script a command to dynamically associate the instance public IP name to my own domain name, such as myservice.aws.stormacq.com.  I choose to define an alias to the public DNS name setup by AWS, using a <a href="http://en.wikipedia.org/wiki/CNAME_record">CNAME</a> record.</p>
<h2>How to programmatically configure your Route 53 DNS ?</h2>
<p>AWS&#8217; <a href="http://aws.amazon.com/documentation/route53/">Route 53 API</a> is <a href="https://en.wikipedia.org/wiki/Representational_state_transfer">RESTful</a>, making it easy to manipulate it with command line, using &#8220;<a href="http://curl.haxx.se">curl</a>&#8221; command for example.  curl can be used to issue GET requests to read configuration data and POST requests to change DNS configuration.</p>
<p>Requests payload is defined in XML.  An example GET query would be</p>
<pre lang="xml" escape="true">&lt;?xml version="1.0"?&gt;
&lt;ListHostedZonesResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/"&gt;
  &lt;HostedZones&gt;
    &lt;HostedZone&gt;
      &lt;Id&gt;/hostedzone/MY_ZONE_ID&lt;/Id&gt;
      &lt;Name&gt;aws.mydomain.com.&lt;/Name&gt;
      &lt;CallerReference&gt;22F684C6-3886-3FFF-8437-E22C5DCB56E7&lt;/CallerReference&gt;
      &lt;Config&gt;
        &lt;Comment&gt;AWS Route53 Hosted subdomain&lt;/Comment&gt;
      &lt;/Config&gt;
      &lt;ResourceRecordSetCount&gt;4&lt;/ResourceRecordSetCount&gt;
    &lt;/HostedZone&gt;
  &lt;/HostedZones&gt;
  &lt;IsTruncated&gt;false&lt;/IsTruncated&gt;
  &lt;MaxItems&gt;100&lt;/MaxItems&gt;
&lt;/ListHostedZonesResponse&gt;</pre>
<p>To restrict access to  your DNS configuration, the <a href="http://aws.amazon.com/documentation/route53/">API</a> requires authentication.  Route 53 mandate the use of a proprietary HTTP header to authenticate requests.</p>
<p>Full details about <a href="http://docs.aws.amazon.com/Route53/latest/APIReference/Welcome.html">Route 53 API</a> is available on Amazon&#8217;s documentation.</p>
<h2>The problem when using authentication and curl</h2>
<p>AWS&#8217; <a href="http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/RESTAuthentication.html">Route 53 authentication is described</a> with great details and examples in the official documentation. Basically, it is based on a HMAC signature computed from the current date/time and your AWS Secret Key.</p>
<p>The HTTP header to be added to the request is as following</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">AWS3-HTTPS <span style="color: #007800;">AWSAccessKeyId</span>=MyAccessKey,<span style="color: #007800;">Algorithm</span>=ALGORITHM,<span style="color: #007800;">Signature</span>=Base64<span style="color: #7a0874; font-weight: bold;">&#40;</span> Algorithm<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>ValueOfDateHeader<span style="color: #7a0874; font-weight: bold;">&#41;</span>, SigningKey<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>The Algorithm can be HMacSHA1 or HMacSHA256. The date is the current system time.  You can use your system time or you can ask AWS what is their system time.  The latter needs an additional HTTP call but this method will avoid time synchronisation issues between your machine and AWS. While curl is very versatile and can accommodate to many different situations, it can not compute an HMac signature to send as authentication header, a short python script is my solution.</p>
<h2>The Python Solution</h2>
<p>I choose to wrap the curl call into Python, let Python compute the signature, generate the appropriate HTTP header and then call curl, passing all remaining command line arguments to curl itself. The general idea is as following :</p>
<ul>
<li>collect AWS_ACCESS_KEY and AWS_SECRET_KEY</li>
<li>Compute the Signature</li>
<li>Call curl with correct parameters to inject the authentication HTTP header and all command line parameters we have received</li>
</ul>
<h4>Signature</h4>
<p>The signature is generated with this code.  It receives two String as input (the text to sign and the key). I hard-coded the algorithm. The function returns the base64 encoded signature.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> getSignatureAsBase64<span style="color: black;">&#40;</span>text<span style="color: #66cc66;">,</span> key<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">hmac</span><span style="color: #66cc66;">,</span> hashlib<span style="color: #66cc66;">,</span> <span style="color: #dc143c;">base64</span>
    hm  <span style="color: #66cc66;">=</span> <span style="color: #dc143c;">hmac</span>.<span style="color: #dc143c;">new</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">bytes</span><span style="color: black;">&#40;</span>key<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;ascii&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #dc143c;">bytes</span><span style="color: black;">&#40;</span>text<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;utf-8&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> hashlib.<span style="color: black;">sha256</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">base64</span>.<span style="color: black;">b64encode</span><span style="color: black;">&#40;</span>hm.<span style="color: black;">digest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.<span style="color: black;">decode</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h4>AWS&#8217;s date</h4>
<p>Retrieving AWS&#8217;s date is similarly easy</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> getAmazonDateTime<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>.<span style="color: black;">request</span>
    httpResponse<span style="color: #66cc66;">=</span><span style="color: #dc143c;">urllib</span>.<span style="color: black;">request</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;https://route53.amazonaws.com/date&quot;</span><span style="color: black;">&#41;</span>
    httpHeaders<span style="color: #66cc66;">=</span>httpResponse.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> httpHeaders<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Date'</span><span style="color: black;">&#93;</span></pre></td></tr></table></div>

<h4>Formatting the header</h4>
<p>And the header is formatted with</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> getAmazonV3AuthHeader<span style="color: black;">&#40;</span>accessKey<span style="color: #66cc66;">,</span> signature<span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;"># AWS3-HTTPS AWSAccessKeyId=MyAccessKey,Algorithm=ALGORITHM,Signature=Base64( Algorithm((ValueOfDateHeader), SigningKey) )</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;AWS3-HTTPS AWSAccessKeyId=%s,Algorithm=HmacSHA256,Signature=%s&quot;</span> % <span style="color: black;">&#40;</span>accessKey<span style="color: #66cc66;">,</span>signature<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<h4>Calling curl</h4>
<p>Finally, we just have to call the curl command :</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;">        <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">subprocess</span>
        curlCmd <span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;/usr/bin/curl&quot;</span><span style="color: #66cc66;">,</span>
                        <span style="color: #483d8b;">&quot;-v&quot;</span> <span style="color: #ff7700;font-weight:bold;">if</span> DEBUG <span style="color: #ff7700;font-weight:bold;">else</span> <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #66cc66;">,</span>
                        <span style="color: #483d8b;">&quot;-s&quot;</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">&quot;-S&quot;</span><span style="color: #66cc66;">,</span>
                        <span style="color: #483d8b;">&quot;--header&quot;</span><span style="color: #66cc66;">,</span>
                        <span style="color: #483d8b;">&quot;X-Amzn-Authorization: %s&quot;</span> % AWS_AUTH<span style="color: #66cc66;">,</span>
                        <span style="color: #483d8b;">&quot;--header&quot;</span><span style="color: #66cc66;">,</span>
                        <span style="color: #483d8b;">&quot;x-amz-date: %s&quot;</span> % AWS_DATE<span style="color: black;">&#93;</span>
        curlCmd +<span style="color: #66cc66;">=</span> args.<span style="color: black;">curl_parameters</span>
        curlCmd +<span style="color: #66cc66;">=</span> <span style="color: black;">&#91;</span>args.<span style="color: black;">curl_url</span><span style="color: black;">&#93;</span>
        <span style="color: #dc143c;">logging</span>.<span style="color: black;">debug</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>curlCmd<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>                
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">call</span><span style="color: black;">&#40;</span>curlCmd<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>The full script <a href="https://github.com/sebsto/AWSDNSAuth">is available under a BSD license</a> on GitHub.  There is some additional plumbery to handle command line arguments, to load the AWS credentials etc &#8230; which is out of the scope of this article.</p>
<h2>Conclusion</h2>
<p>Using this script, you can easy use curl command to GET or POST REST requests to Route 53&#8242;s API.</p>
<p>I am using this script to create custom CNAME records whenever an EC2 instance is started, allowing me to reuse a well known, stable DNS public name to access my instance.  A sample XML to define a CNAME <a href="https://github.com/sebsto/AWSDNSAuth/blob/master/src/CreateResourceRecordSet.xml">is posted on GitHub together with the source code</a>.</p>
<p>Enjoy !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/python-script-for-aws-route-53-api-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build a private VPN Server on Amazon&#8217;s EC2</title>
		<link>http://www.stormacq.com/build-a-private-vpn-server-on-amazons-ec2/</link>
		<comments>http://www.stormacq.com/build-a-private-vpn-server-on-amazons-ec2/#comments</comments>
		<pubDate>Tue, 26 Mar 2013 05:11:42 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[Amazon]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ipsec]]></category>
		<category><![CDATA[l2tp]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=534</guid>
		<description><![CDATA[This article describes how to run your private VPN gateway in Amazon&#8217;s cloud.  Although this article describes a 100% automatic (scripted) method to start and configure your VPN server, it assumes some basic knowledge of Amazon&#8217;s EC2 platform and &#8211; obviously &#8211; requires you to have an account on EC2. If you are totally new [...]]]></description>
				<content:encoded><![CDATA[<p>This article describes how to run your private VPN gateway in <a href="http://aws.amazon.com">Amazon&#8217;s cloud</a>.  Although this article describes a 100% automatic (scripted) method to start and configure your VPN server, it assumes some basic knowledge of <a href="http://aws.amazon.com/ec2/">Amazon&#8217;s EC2</a> platform and &#8211; obviously &#8211; requires you to have an account on EC2.</p>
<p>If you are totally new to EC2, I strongly advise you to follow a <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html">Getting Started guide</a> before going through this article.</p>
<p>The VPN server I am using for the purpose of this article is based on <a href="http://en.wikipedia.org/wiki/IPsec" target="_blank">IPSec</a> / <a href="http://en.wikipedia.org/wiki/Layer_2_Tunneling_Protocol" target="_blank">L2TP</a> security protocols implemented by open source projects <a href="https://github.com/xelerance/Openswan" target="_blank">OpenSWAN</a> and <a href="https://github.com/xelerance/xl2tpd" target="_blank">XL2LTP</a>.</p>
<p>For the impatient, <a href="https://github.com/sebsto/AWSVPN">the scripts are available on github</a>, along with basic configuration and setup information.  Should you need more details, I encourage you to read the following.</p>
<h2>Why a private VPN server ?</h2>
<p>Sometime, it is legitimate to create an encrypted tunnel of data to another machine on the internet. Think about situations like</p>
<ul>
<li>Being connected on a public network in an hotel, a conference, a restaurant or coffee shop</li>
<li>Willing to escape your ISP or Service Provider limitations (<a href="http://blog.rootshell.be/2011/10/04/the-great-firewall-of-belgium-is-back/">Belgium DNS Blocking</a>, French <a href="http://en.wikipedia.org/wiki/HADOPI_law">Hadopi</a>, &#8230;)</li>
<li>Accessing services not being distributed in your country (Deezer, Spotify etc ..)</li>
<li>or simply to ensure no one can snoop your network traffic</li>
</ul>
<h2>How to start a customised machine on EC2 ? Some Background.</h2>
<p>AWS provides several ways to start customised machines. Either you can create your own virtual machine image (<a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ComponentsAMIs.html">AMI</a>) based on one of the many images <a href="https://aws.amazon.com/amis">available</a>.  Either you can start a standard image and run a script at startup time to customise it. Either you can boot from an EBS backed machine image (AMI) and create a snapshot of your root volume.</p>
<p>The first method is more labor intensive (install the software, maintain the image, &#8230;) and more expensive (you have to pay for the storage of your customised image) but has the advantage of faster startup times as the image does not need to install and to configure required softwares at boot time.</p>
<p>Running a script at boot time is easier as you do not need to enter into the details of creating and maintaining custom images.  It is cheaper as you do no need to store that custom image. But the machine is slower to boot as it requires to download, install and configure required softwares at every boot.  This is the method I choose to setup the VPN server.</p>
<p>The latter method (EBS Snapshot of root volume) is <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html">described in extenso in the documentation</a> and &#8211; based on my own experience &#8211; provides the best ratio between labour, price and effectiveness.  This is probably the method I would recommend for production workloads.</p>
<p>But &#8230; How to start a customisation / installation script just after booting a standard linux distribution or one of the prepared Amazon Machine Image ?  This is where <a href="https://help.ubuntu.com/community/CloudInit">cloud-init</a> kicks in.</p>
<p>Cloud-Init is an open source library initiated by Canonical (the maker Ubuntu) to initialise Virtual Machines running in the cloud. It allows, amongst others, to do post-boot configuration like</p>
<ul>
<li>setting the correct locale</li>
<li>setting the hostname</li>
<li>initialising (or installing) ssh keys</li>
<li>setup mount points</li>
<li>etc &#8230;</li>
</ul>
<p>It also allows to pass a user defined script to the instance to perform any additional setup and configuration tasks.  This is the technique I am using to download, install, configure and start IPSec and L2TP daemons on the server.</p>
<p>Cloud-Init is included by default in Ubuntu machine images and in Amazon Linux machine images on EC2.</p>
<p>For the purpose of this article, I choose to use the <a href="http://aws.amazon.com/amazon-linux-ami/">Amazon Linux</a> machine image because it is lightweight and specifically designed to run on EC2.</p>
<p>This is enough background information, let&#8217;s start to do real stuffs.</p>
<h2>How to start a machine from your command line ?</h2>
<p>To start an EC2 instance form your machine command line, you will need the following :</p>
<ul>
<li>an Amazon Web Service account and a credit card <img src='http://www.stormacq.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>to create a SSH key pair</li>
<li>to create a VPN security group</li>
</ul>
<p>The VPN Security Group must allow TCP and UPD port 500 and UPD port 4500 as shown on the screenshot below.</p>
<div id="attachment_535" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-11.54.52.png"><img class="size-medium wp-image-535" alt="VPN Security Group" src="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-11.54.52-300x70.png" width="300" height="70" /></a><p class="wp-caption-text">VPN Security Group</p></div>
<p>Please refer to the <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html">getting started guide</a> to learn how to perform these. Be sure to write down the name of your key pair and the name of your security group as we will need these later.</p>
<p>Once your basic setup of EC2 is done, you will need to install and configure EC2 Command line tools on your machine.</p>
<ul>
<li>Download and Install EC2 <a href="http://aws.amazon.com/developertools/351">Command Line Tools</a></li>
<li>Configure your environment</li>
</ul>
<p>To configure your environment, you will need to setup a couple of environment variables, typically in $HOME/.profile</p>
<ul>
<li>EC2_HOME environment variable points to command line tools</li>
<li>EC2_URL environment variables contains AWS endpoint (http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region)</li>
<li>AWS_ACCESS_KEY environment variable contains your AWS access key</li>
<li>AWS_SECRET_KEY environment variable contains your AWS secret key</li>
</ul>
<p>Do not change the name of these environment variables as these are used in the script.</p>
<p>For example, here is my own .profile file (on Mac OS X) :</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>java_home<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">EC2_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>sst<span style="color: #000000; font-weight: bold;">/</span>Projects<span style="color: #000000; font-weight: bold;">/</span>aws<span style="color: #000000; font-weight: bold;">/</span>ec2-api-tools-latest
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">AWS_ACCESS_KEY</span>=<span style="color: #000000; font-weight: bold;">&amp;</span>lt;access key<span style="color: #000000; font-weight: bold;">&amp;</span>gt;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">AWS_SECRET_KEY</span>=<span style="color: #000000; font-weight: bold;">&amp;</span>lt;secret key<span style="color: #000000; font-weight: bold;">&amp;</span>gt;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">EC2_URL</span>=http:<span style="color: #000000; font-weight: bold;">//</span>ec2.eu-west-<span style="color: #000000;">1</span>.amazonaws.com</pre></td></tr></table></div>

<p>Once this setup is done, you can start to use the EC2 command line tools as demonstrated in the script below :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#to be run on my laptop</span>
<span style="color: #666666; font-style: italic;"># create and start an instance</span>
<span style="color: #666666; font-style: italic;">#AMI = AMZN Linux 64 Bits</span>
<span style="color: #666666; font-style: italic;">#AMI_DESCRIPTION=&quot;amazon/amzn-ami-pv-2012.09.0.x86_64-ebs&quot;</span>
<span style="color: #007800;">AMI_ID</span>=ami-c37474b7
<span style="color: #007800;">KEY_ID</span>=sst-ec2
<span style="color: #007800;">SEC_ID</span>=VPN
<span style="color: #007800;">BOOTSTRAP_SCRIPT</span>=vpn-ec2-install.sh
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting Instance...&quot;</span>
<span style="color: #007800;">INSTANCE_DETAILS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$EC2_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ec2-run-instances <span style="color: #007800;">$AMI_ID</span> <span style="color: #660033;">-k</span> <span style="color: #007800;">$KEY_ID</span> <span style="color: #660033;">-t</span> t1.micro <span style="color: #660033;">-g</span> <span style="color: #007800;">$SEC_ID</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$BOOTSTRAP_SCRIPT</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> INSTANCE<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$INSTANCE_DETAILS</span>
&nbsp;
<span style="color: #007800;">AVAILABILITY_ZONE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$INSTANCE_DETAILS</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $9}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">INSTANCE_ID</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$INSTANCE_DETAILS</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$INSTANCE_ID</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>vpn-ec2.id
&nbsp;
<span style="color: #666666; font-style: italic;"># wait for instance to be started</span>
<span style="color: #007800;">DNS_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$EC2_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ec2-describe-instances <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;image-id=<span style="color: #007800;">$AMI_ID</span>&quot;</span> <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;instance-state-name=running&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> INSTANCE <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DNS_NAME</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">do</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Waiting for instance to start....&quot;</span>
 <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>
 <span style="color: #007800;">DNS_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$EC2_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ec2-describe-instances <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;image-id=<span style="color: #007800;">$AMI_ID</span>&quot;</span> <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;instance-state-name=running&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> INSTANCE <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Instance started&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Instance ID = &quot;</span> <span style="color: #007800;">$INSTANCE_ID</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;DNS = &quot;</span> <span style="color: #007800;">$DNS_NAME</span> <span style="color: #ff0000;">&quot; in availability zone &quot;</span> <span style="color: #007800;">$AVAILABILITY_ZONE</span></pre></td></tr></table></div>

<p>You will need to slightly customise this script to make it run :</p>
<ul>
<li>Line 5 : <a href="http://aws.amazon.com/amazon-linux-ami/">check what is the AMI ID</a> in your geography</li>
<li>Line 6 : replace &#8220;sst-ec2&#8243; with the name of your ssh key pair</li>
<li>Line 7 : replace &#8220;VPN&#8221; with the name you choose for your Security Group</li>
</ul>
<h3>How is it working ?</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>10
11
12
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting Instance...&quot;</span>
<span style="color: #007800;">INSTANCE_DETAILS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$EC2_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ec2-run-instances <span style="color: #007800;">$AMI_ID</span> <span style="color: #660033;">-k</span> <span style="color: #007800;">$KEY_ID</span> <span style="color: #660033;">-t</span> t1.micro <span style="color: #660033;">-g</span> <span style="color: #007800;">$SEC_ID</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$BOOTSTRAP_SCRIPT</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> INSTANCE<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$INSTANCE_DETAILS</span></pre></td></tr></table></div>

<p>This script starts an EC2 instance (line 11) of the given type with the specified SSH key pair and Security Group.  It uses the &#8220;-f&#8221; option to pass a cloud-init user data script that will download install and configure IPSec and L2TP once the machine is booted.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># wait for instance to be started</span>
<span style="color: #007800;">DNS_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$EC2_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ec2-describe-instances <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;image-id=<span style="color: #007800;">$AMI_ID</span>&quot;</span> <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;instance-state-name=running&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> INSTANCE <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DNS_NAME</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">do</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Waiting for instance to start....&quot;</span>
 <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span>
 <span style="color: #007800;">DNS_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #007800;">$EC2_HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ec2-describe-instances <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;image-id=<span style="color: #007800;">$AMI_ID</span>&quot;</span> <span style="color: #660033;">--filter</span> <span style="color: #ff0000;">&quot;instance-state-name=running&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> INSTANCE <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $4}'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>The script then waits for the machine to be ready (lines 19-26) and, once available, the script reports the machine public DNS name (to be used to configure your VPN client software) (line 30 &#8211; 31)</p>
<h2>How to Install and to Configure VPN into your new machine ?</h2>
<p>Now that the machine is started, it receives the customisation script through the -f option.  Cloud-Init will execute this script to finalise the setup of the machine.</p>
<p>Here is the script allowing to install and configure IPSec and L2TP automatically.  Some details are given after the code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Please define your own values for those variables</span>
 <span style="color: #007800;">IPSEC_PSK</span>=SharedSecret
 <span style="color: #007800;">VPN_USER</span>=username
 <span style="color: #007800;">VPN_PASSWORD</span>=password
&nbsp;
<span style="color: #666666; font-style: italic;"># Those two variables will be found automatically</span>
 <span style="color: #007800;">PRIVATE_IP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">-O</span> - <span style="color: #ff0000;">'http://instance-data/latest/meta-data/local-ipv4'</span><span style="color: #000000; font-weight: bold;">`</span>
 <span style="color: #007800;">PUBLIC_IP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">-O</span> - <span style="color: #ff0000;">'http://instance-data/latest/meta-data/public-ipv4'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">yum install</span> <span style="color: #660033;">-y</span> <span style="color: #660033;">--enablerepo</span>=epel openswan xl2tpd
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ipsec.conf <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
 version 2.0
&nbsp;
config setup
 dumpdir=/var/run/pluto/
 nat_traversal=yes
 virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12,%v4:25.0.0.0/8,%v6:fd00::/8,%v6:fe80::/10
 oe=off
 protostack=netkey
 nhelpers=0
 interfaces=%defaultroute
&nbsp;
conn vpnpsk
 auto=add
 left=$PRIVATE_IP
 leftid=$PUBLIC_IP
 leftsubnet=$PRIVATE_IP/32
 leftnexthop=%defaultroute
 leftprotoport=17/1701
 rightprotoport=17/%any
 right=%any
 rightsubnetwithin=0.0.0.0/0
 forceencaps=yes
 authby=secret
 pfs=no
 type=transport
 auth=esp
 ike=3des-sha1
 phase2alg=3des-sha1
 dpddelay=30
 dpdtimeout=120
 dpdaction=clear
 EOF
&nbsp;
cat &gt; /etc/ipsec.secrets &lt;&lt;EOF
 $PUBLIC_IP %any : PSK &quot;$IPSEC_PSK&quot;
 EOF
&nbsp;
cat &gt; /etc/xl2tpd/xl2tpd.conf &lt;&lt;EOF
 [global]
 port = 1701
&nbsp;
;debug avp = yes
 ;debug network = yes
 ;debug state = yes
 ;debug tunnel = yes
&nbsp;
[lns default]
 ip range = 192.168.42.10-192.168.42.250
 local ip = 192.168.42.1
 require chap = yes
 refuse pap = yes
 require authentication = yes
 name = l2tpd
 ;ppp debug = yes
 pppoptfile = /etc/ppp/options.xl2tpd
 length bit = yes
 EOF
&nbsp;
cat &gt; /etc/ppp/options.xl2tpd &lt;&lt;EOF
 ipcp-accept-local
 ipcp-accept-remote
 ms-dns 8.8.8.8
 ms-dns 8.8.4.4
 noccp
 auth
 crtscts
 idle 1800
 mtu 1280
 mru 1280
 lock
 connect-delay 5000
 EOF
&nbsp;
cat &gt; /etc/ppp/chap-secrets &lt;&lt;EOF
 # Secrets for authentication using CHAP
 # client server secret IP addresses
&nbsp;
$VPN_USER l2tpd $VPN_PASSWORD *
 EOF
&nbsp;
iptables -t nat -A POSTROUTING -s 192.168.42.0/24 -o eth0 -j MASQUERADE
 echo 1 &gt; /proc/sys/net/ipv4/ip_forward
&nbsp;
iptables-save &gt; /etc/iptables.rules
&nbsp;
cat &gt; /etc/network/if-pre-up.d/iptablesload &lt;&lt;EOF
 #!/bin/sh
 iptables-restore &lt; /etc/iptables.rules
 echo 1 &gt; /proc/sys/net/ipv4/ip_forward
 exit 0
EOF</span>
&nbsp;
service ipsec start
service xl2tpd start
chkconfig ipsec on
chkconfig xl2tpd on</pre></td></tr></table></div>

<p>As promised, here are some details</p>
<ul>
<li>Lines 4-6 defines your security credentials for the VPN.  They must be changed before executing this script.</li>
<li>Line 12 uses yum to install IPSec &amp; L2TP implementation (OpenSWAN and xl2tpd) from the Amazon&#8217;s provided EPEL repository</li>
<li>Lines 14-93 creates IPSec and L2TP configuration files, reusing the credentials you provided at the head of the script.</li>
<li>Lines 95-96 setup proper network NATing</li>
<li>Lines 98-105 ensure the network NATing settings will be restored in case the network interface is shutdown and up again.</li>
<li>Finally, lines 107-110 start required services and ensure they will be restarted in case of reboot.</li>
</ul>
<p>Congrats for those of you still reading.  You now should have a valid VPN server running in the cloud.  If everything went well, you should now be able to configure your VPN client.</p>
<h2>How to connect from Mac OS X ?</h2>
<p>Once the server is up and running, you simply add a VPN interface in your Network Preferences</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-15.56.04.png"><img class="aligncenter size-medium wp-image-536" alt="VPN IPSec Network Preference" src="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-15.56.04-300x266.png" width="300" height="266" /></a></p>
<p>Then, use the public DNS hostname as server address and your username, as shown below</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-16.47.36.png"><img class="aligncenter size-medium wp-image-537" alt="VPN Host and username" src="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-16.47.36-300x266.png" width="300" height="266" /></a></p>
<p>Finally, click on &#8220;Authentication Settings&#8221; to enter the shared secret and your password.</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-16.51.57.png"><img class="aligncenter size-medium wp-image-538" alt="VPN Password and Shared Secret" src="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-16.51.57-293x300.png" width="293" height="300" /></a></p>
<p>&nbsp;</p>
<p>Then click on Apply, then Connect</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-17.01.55.png"><img class="aligncenter size-medium wp-image-539" alt="VPN Connected" src="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-17.01.55-300x266.png" width="300" height="266" /></a></p>
<p>If everything is OK, you should connect to your new VPN Server.</p>
<h2>How to be sure you&#8217;re connecting through the VPN ?</h2>
<p>The easiest way to check that indeed all your network traffic is routed through the VPN tunnel is to connect to one of the many IP Address Geolocalisation web sites.</p>
<p>The web site I found on Google reported an Amazon IP address from Ireland, which is the geographical region I choose to deploy my VPN server.</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-17.00.09.png"><img class="aligncenter size-medium wp-image-540" alt="Geolocalisation IP Address" src="http://www.stormacq.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-25-at-17.00.09-300x264.png" width="300" height="264" /></a></p>
<h2>A note for Windows users</h2>
<p>Microsoft published <a href="http://technet.microsoft.com/en-us/library/bb742553.aspx" target="_blank">an extensive technical note</a> describing the details of setting up a IPSec client on Windows.</p>
<p>Also, Windows <a href="http://serverfault.com/questions/474742/simple-l2tp-ipsec-server-not-working-openswan-xl2tpd-ubuntu-windows" target="_blank">does not support IPsec NAT-T</a> by default, which is used whenever the server is behind a NAT (as in this case). You have to add a registry key to enable this &#8211; see <a href="http://support.microsoft.com/kb/926179/en-us" rel="nofollow">http://support.microsoft.com/kb/926179/en-us</a> (still applies to Windows 8)</p>
<h2>How to hook up a DNS alias to avoid to change client configuration ?</h2>
<p>Every time you will startup a new VPN server, you will need to enter its public DNS name to your VPN client configuration.  It is possible to avoid this if you have a domain name of your own, just by creating a DNS CNAME record pointing to the public DNS address of your server, such as</p>
<pre>vpn.mydomain.com CNAME ec2-176-34-71-204.eu-west-1.compute.amazonaws.com.</pre>
<p>If you are using Amazon&#8217;s Route 53 DNS service, this step can be entirely automated using scripts.  More about this in another article.</p>
<p>&nbsp;</p>
<p>Congrats if you manage to read this article to the end.  Once again, <a href="https://github.com/sebsto/AWSVPN">the script source code is available on GitHub</a>.</p>
<p>Enjoy !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/build-a-private-vpn-server-on-amazons-ec2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Devoxx 2012</title>
		<link>http://www.stormacq.com/devoxx-2012/</link>
		<comments>http://www.stormacq.com/devoxx-2012/#comments</comments>
		<pubDate>Sun, 11 Nov 2012 08:16:03 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[antwerp]]></category>
		<category><![CDATA[cordova]]></category>
		<category><![CDATA[devoxx]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[rtc]]></category>
		<category><![CDATA[worklight]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=526</guid>
		<description><![CDATA[Tomorrow, Antwerp will host &#8211; for the 11th year in a row &#8211; the biggest European Java Developers conference : Devoxx. This year I will celebrate my 10th Devoxx attendance !  And for the first time I will have the pleasure to host two talks. On Monday at 18:05 (Room #9), during a &#8220;Tools in [...]]]></description>
				<content:encoded><![CDATA[<p>Tomorrow, <a href="http://en.wikipedia.org/wiki/Antwerp" target="_blank">Antwerp</a> will host &#8211; for the 11th year in a row &#8211; the biggest European Java Developers conference : <a href="http://www.devoxx.com/display/DV12/Home" target="_blank">Devoxx</a>.</p>
<p>This year I will celebrate my 10th Devoxx attendance !  And for the first time I will have the pleasure to host two talks.</p>
<p>On <a href="http://www.devoxx.com/display/DV12/Hybrid+mobile+application+development+using+Apache+Cordova" target="_blank">Monday at 18:05</a> (Room #9), during a &#8220;Tools in Action&#8221; session, my colleague <a href="http://www.devoxx.com/display/DV12/Abdoul+gadiri+Diallo" target="_blank">Abdoul</a> and <a href="http://www.devoxx.com/display/DV12/sebastien+stormacq" target="_blank">myself</a> will build, live in front of the audience, a mobile application allowing to take pictures and capture geo localisation information and to send these for publishing on a web site. This demo will be built with open-source frameworks like <a href="http://dojotoolkit.org/" target="_blank">DoJo</a> and Apache&#8217;s <a href="http://incubator.apache.org/cordova/" target="_blank">Cordova</a>, using IBM&#8217;s <a href="http://www-01.ibm.com/software/mobile-solutions/worklight/" target="_blank">Worklight</a> development IDE.  The architecture for this demo is depicted here under.</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/11/devoxx-demo.png"><img class="aligncenter size-medium wp-image-527" title="devoxx-demo" src="http://www.stormacq.com/wp-content/uploads/2012/11/devoxx-demo-300x115.png" alt="" width="300" height="115" /></a></p>
<p>On <a href="http://www.devoxx.com/display/DV12/Mobile+Applications+Development+Lifecycle" target="_blank">Wednesday at 16:40</a> (Room #6), during the Conference, my colleague <a href="http://www.devoxx.com/display/DV12/Eric+Cattoir" target="_blank">Eric</a> and myself will demonstrate how IBM <a href="http://www-01.ibm.com/software/rational/products/rtc/" target="_blank">Rational Team Concert</a> can be used to manage the lifecycle of a mobile application development, from capturing requirements to tests execution, changes and bugs management etc &#8230;</p>
<p>The rest of the time, you will find me on IBM&#8217;s booth in the exposition ground floor.</p>
<p>For those not knowing what Devoxx ambiance is, <a href="http://www.devoxx.com/display/DV12/Practical?atl_token=f2HXdkJPN7" target="_blank">check out this nice video</a>. Devoxx is sold out (again) this year : 3400 attendees from 40 different countries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/devoxx-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebSphere Liberty Profile Cluster Sharing an In-Memory Data Grid</title>
		<link>http://www.stormacq.com/websphere-liberty-profile-cluster-sharing-an-in-memory-data-grid/</link>
		<comments>http://www.stormacq.com/websphere-liberty-profile-cluster-sharing-an-in-memory-data-grid/#comments</comments>
		<pubDate>Sun, 14 Oct 2012 13:48:35 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[clustering]]></category>
		<category><![CDATA[extreme scale]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[liberty profile]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=521</guid>
		<description><![CDATA[WebSphere Liberty Profile is a fast, lightweight and simple Java web application container allowing developer to develop, test and deploy applications easily.  In my previous articles, I explained how to install Liberty Profile on Mac and how to develop and deploy your first REST based services. Liberty Profile is a standalone Java container.  It is [...]]]></description>
				<content:encoded><![CDATA[<p><a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/home?lang=en">WebSphere Liberty Profile</a> is a fast, lightweight and simple Java web application container allowing developer to develop, test and deploy applications easily.  In my previous articles, I explained <a href="http://www.stormacq.com/?p=498">how to install Liberty Profile on Mac</a> and <a href="http://www.stormacq.com/?p=510">how to develop and deploy your first REST based services</a>.</p>
<p>Liberty Profile is a standalone Java container.  It is not designed to be included in larger deployments based on <a href="http://www-01.ibm.com/software/webservers/appserv/was/network/">WebSphere Application Server  ND</a> <a href="http://itdevworld.wordpress.com/2009/05/03/websphere-concepts-cell-node-cluster-server/">cells</a>.</p>
<p>However, Liberty Profile <a href="http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.doc%2Ftopics%2Ftwlp_admin_session_persistence.html">can take benefit</a> of a shared persistence engine to store HTTP Session data. This allows two or more independent Liberty Profile instances to share a common user session for web applications.  When one instance fails, the surviving instances can continue to serve user requests as-is nothing happened.</p>
<p>Persistent data store might be a relational database (such as <a href="http://db.apache.org/derby/">Derby</a> used for development purposes) or a in-memory data grid. <a href="http://highscalability.com/blog/2011/12/21/in-memory-data-grid-technologies.html">In-Memory Data Grid</a> are software solutions providing in-memory data storage, replicated across different containers (or machines). Many IMDG solutions are available from different vendors or in open-source.  Most common ones are <a href="http://memcached.org">MemCached</a>, <a href="http://www.softwareag.com/corporate/products/terracotta/default.asp">Terracotta</a> (Software AG), <a href="http://www.oracle.com/technetwork/middleware/coherence/overview/index.html">Coherence</a> (Oracle) and IBM&#8217;s <a href="http://www-01.ibm.com/software/webservers/appserv/extremescale/">WebSphere eXtreme Scale</a>.</p>
<p>If you are totally new to eXtreme Scale, I would recommend <a href="http://pic.dhe.ibm.com/infocenter/wxsinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.extremescale.doc%2Fwelcome%2Fwelcome_xs.html">to read some basic information about its architecture</a> before continuing to read this article.</p>
<p><a href="http://www.ibm.com/developerworks/websphere/library/techarticles/1112_shenoy/1112_shenoy.html">Configuring</a> WebSphere Application Server (WAS &#8211; full profile) to store HTTP Session in a eXtreme Scale container is a matter of three clicks in WAS admin console.  It is slightly more complicate with Liberty Profile, just a few configuration steps described below.</p>
<p>There are four different ways to install eXtreme Scale (XS) with Liberty :</p>
<ul>
<li>Run XS Container in a separate JVM or separate machine than Liberty Profile</li>
<li>Run XS Container inside the same JVM as Liberty Profile</li>
<li>Use Liberty Profile as client for an XS container</li>
<li>Configure Liberty Profile to store HTTP Session data to an XS container</li>
</ul>
<p>In this article, I will show you how to configure Liberty Profile to</p>
<ol>
<li>Start an XS server within the same JVM as Liberty profile</li>
<li>Store HTTP Session data in this in-memory data grid,allowing to create clusters of Liberty Profile Instances</li>
</ol>
<p>My final architecture is depicted in the image below.</p>
<p style="text-align: center;"><a href="http://www.stormacq.com/wp-content/uploads/2012/10/wlp-wxs-arch.035.png"><img class="aligncenter  wp-image-522" title="wlp-wxs-arch.035" src="http://www.stormacq.com/wp-content/uploads/2012/10/wlp-wxs-arch.035.png" alt="" width="614" height="461" /></a></p>
<p>0. <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/downloads_final_releases?lang=en">Download and Install</a> Liberty Profile and eXtreme Scale for Liberty Profile (both solutions are available at no charge from IBM &#8211; with forum based and peer-to-peer support only).</p>
<ul>
<li>Liberty Profile installation is described<a href="http://www.stormacq.com/?p=498"> in my previous blog entry</a>.</li>
<li>eXtreme Scale for Liberty Profile installation is just a matter of unzipping the file in the <strong>directory above</strong> wlp</li>
</ul>
<p>1. Create two servers instances</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> wlpBLOG
sst:wlpBLOG sst$ .<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>server create ServerONE
Server ServerONE created.
sst:wlpBLOG sst$ .<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>server create ServerTWO
Server ServerTWO created.</pre></td></tr></table></div>

<p>2. Change default HTTP Port in both server.xml so that the two instances can run in parallel</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;httpEndpoint</span> <span style="color: #000066;">host</span>=<span style="color: #ff0000;">&quot;localhost&quot;</span> <span style="color: #000066;">httpPort</span>=<span style="color: #ff0000;">&quot;9080&quot;</span> <span style="color: #000066;">httpsPort</span>=<span style="color: #ff0000;">&quot;9443&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;defaultHttpEndpoint&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>3. Add two features in server.xml for each server.  One to tell Liberty to run an XS server embedded.  And one to tell Liberty to use XS as HTTP Session store for web applications.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Enable features --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;featureManager<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jsp-2.2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>localConnector-1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>eXtremeScale.server-1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>eXtremeScale.web-1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/feature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/featureManager<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>4. Configure the the WXS container inside Liberty Profile : add WXS configuration in Liberty Profile</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Configuration for XS Server --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsServer</span> <span style="color: #000066;">isCatalog</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">serverName</span>=<span style="color: #ff0000;">&quot;XS_ServerONE&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- Configuration for Web Application XS HTTP Session data storage --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xsWebApp</span> <span style="color: #000066;">catalogHostPort</span>=<span style="color: #ff0000;">&quot;localhost:2809&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">objectGridType</span>=<span style="color: #ff0000;">&quot;REMOTE&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">replicationInterval</span>=<span style="color: #ff0000;">&quot;0&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">reuseSessionId</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">securityEnabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">sessionTableSize</span>=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>5. Configure the the WXS container inside Liberty Profile : add XML configuration files in WLP runtime directory</p>
<p>In the directory WLP_HOME/usr/servers/ServerONE, create a &#8220;grids&#8221; directory and drop those two files</p>
<pre>deployment.xml</pre>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deploymentPolicy</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://ibm.com/ws/objectgrid/deploymentPolicy ../deploymentPolicy.xsd&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ibm.com/ws/objectgrid/deploymentPolicy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;objectgridDeployment</span> <span style="color: #000066;">objectgridName</span>=<span style="color: #ff0000;">&quot;session&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mapSet</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sessionMapSet&quot;</span> <span style="color: #000066;">numberOfPartitions</span>=<span style="color: #ff0000;">&quot;47&quot;</span> <span style="color: #000066;">minSyncReplicas</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">maxSyncReplicas</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">maxAsyncReplicas</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">developmentMode</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">placementStrategy</span>=<span style="color: #ff0000;">&quot;FIXED_PARTITIONS&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;map</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;objectgridSessionMetadata&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;map</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;objectgridSessionAttribute.*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;map</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;objectgridSessionTTL.*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mapSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/objectgridDeployment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deploymentPolicy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>&nbsp;</p>
<pre>objectgrid.xml</pre>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;objectGridConfig</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://ibm.com/ws/objectgrid/config ../objectGrid.xsd&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://ibm.com/ws/objectgrid/config&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;objectGrids<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;objectGrid</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;session&quot;</span> <span style="color: #000066;">txTimeout</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ObjectGridEventListener&quot;</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;com.ibm.ws.xs.sessionmanager.SessionHandleManager&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;backingMap</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;objectgridSessionMetadata&quot;</span> <span style="color: #000066;">pluginCollectionRef</span>=<span style="color: #ff0000;">&quot;objectgridSessionMetadata&quot;</span> <span style="color: #000066;">readOnly</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">lockStrategy</span>=<span style="color: #ff0000;">&quot;PESSIMISTIC&quot;</span> <span style="color: #000066;">ttlEvictorType</span>=<span style="color: #ff0000;">&quot;LAST_ACCESS_TIME&quot;</span> <span style="color: #000066;">timeToLive</span>=<span style="color: #ff0000;">&quot;3600&quot;</span> <span style="color: #000066;">copyMode</span>=<span style="color: #ff0000;">&quot;COPY_TO_BYTES&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;backingMap</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;objectgridSessionAttribute.*&quot;</span> <span style="color: #000066;">template</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">readOnly</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">lockStrategy</span>=<span style="color: #ff0000;">&quot;PESSIMISTIC&quot;</span> <span style="color: #000066;">ttlEvictorType</span>=<span style="color: #ff0000;">&quot;NONE&quot;</span> <span style="color: #000066;">copyMode</span>=<span style="color: #ff0000;">&quot;COPY_TO_BYTES&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;backingMap</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;objectgridSessionTTL.*&quot;</span> <span style="color: #000066;">template</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">readOnly</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">lockStrategy</span>=<span style="color: #ff0000;">&quot;PESSIMISTIC&quot;</span> <span style="color: #000066;">ttlEvictorType</span>=<span style="color: #ff0000;">&quot;LAST_ACCESS_TIME&quot;</span> <span style="color: #000066;">timeToLive</span>=<span style="color: #ff0000;">&quot;3600&quot;</span> <span style="color: #000066;">copyMode</span>=<span style="color: #ff0000;">&quot;COPY_TO_BYTES&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/objectGrid<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/objectGrids<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;backingMapPluginCollections<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;backingMapPluginCollection</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;objectgridSessionMetadata&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;MapEventListener&quot;</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;com.ibm.ws.xs.sessionmanager.MetadataMapListener&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/backingMapPluginCollection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/backingMapPluginCollections<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/objectGridConfig<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>6. Tell Liberty&#8217;s session manager to reuse the same session ID for all user&#8217;s requests, even if handled by different JVM (See Liberty&#8217;s <a href="http://publib.boulder.ibm.com/infocenter/radhelp/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.multiplatform.doc%2Fautodita%2Frwlp_metatype_4ic.html">documentation</a> for more details)</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;httpSession</span> <span style="color: #000066;">idReuse</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>7. Start Liberty Profile</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">sst:wlpBLOG sst$ .<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>server start ServerONE
Server ServerONE started with process ID <span style="color: #000000;">11769</span>.</pre></td></tr></table></div>

<p>In the logs, wait for the following line</p>
<pre>[AUDIT ] CWWKF0011I: The server ServerONE is ready to run a smarter planet.</pre>
<p>8. Create &amp; Deploy a simple JSP file for testing</p>
<p>Create a Dynamic Web Project in Eclipse, and add the following index.jsp page</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="html" style="font-family:monospace;">&lt;%@page contentType=&quot;text/html&quot; pageEncoding=&quot;UTF-8&quot;%&gt;
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&nbsp;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;title&gt;Liberty Profile Cluster Demo&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Liberty Profile - eXtreme Scale HTTP Session Demo!&lt;/h1&gt;
&lt;%</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">Integer</span> count<span style="color: #339933;">;</span>
<span style="color: #003399;">Object</span> o <span style="color: #339933;">=</span> session.<span style="color: #006633;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;COUNT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
count <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span><span style="color: #009900;">&#41;</span> o<span style="color: #339933;">;</span>
count <span style="color: #339933;">=</span> count <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
count <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
session.<span style="color: #006633;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;COUNT&quot;</span>, count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="html" style="font-family:monospace;">%&gt;
&lt;h3&gt;This counter is increased each time the page is loaded.  Its value is stored in the &lt;code&gt;HttpSession&lt;/code&gt;&lt;/h3&gt;
&lt;h3&gt;&lt;font color=&quot;#FF0000&quot;&gt;Counter = &lt;%=count%&gt;&lt;/font&gt;&lt;/h3&gt;
&lt;h4&gt;Page server by cluster instance : &lt;font color=&quot;#FF0000&quot;&gt;&lt;b&gt;&lt;%= System.getProperty(&quot;wlp.server.name&quot;) %&gt;&lt;/b&gt;&lt;/font&gt;&lt;/h4&gt;
&lt;br/&gt;
Page generated at = &lt;%=new java.util.Date().toString()%&gt;&lt;br/&gt;
&lt;br/&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Then deploy the WAR to the server instance (example of creating a WAR and deploying it to Liberty <a href="http://www.stormacq.com/how-to-deploy-rest-based-web-services-to-liberty-profile/">is given in my previous blog post</a>)</p>
<p>9. Test, open your favorite browser and connect to http://localhost:9080/</p>
<p>You should see the following screen</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-14-at-15.06.55.png"><img class="aligncenter size-medium wp-image-523" title="Screen Shot 2012-10-14 at 15.06.55" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-14-at-15.06.55-300x97.png" alt="" width="300" height="97" /></a></p>
<p>Each time you will refresh the page (CTRL-R), the counter should be increased by one</p>
<p>Congrats, you have your first instance up and running, let&#8217;s now configure a second instance.</p>
<p>Repeat Steps 2-7 on a second Liberty instance to create a second cluster member.  Remember to change the following</p>
<ul>
<li>The name of the instance</li>
<li>The HTTP and HTTPS ports used by Liberty Profile (step 2 above)</li>
<li>The WXS configuration &#8211; only one catalog server is needed (step 3 above, change isCatalog=&#8221;no&#8221;)</li>
<li>You do not need to copy the XML files in the grids directory of the second instance (step 5) &#8211; This is only required on the instance running XS&#8217; Catalog Server</li>
</ul>
<p>Then deploy your test application to instance #2.  To test your application, point your browser to</p>
<pre>http://localhost:9081/&lt;YOUR APPLICATION NAME&gt;</pre>
<p>You should see a page similar to the one shown at step 9 above.  Try to alternatively reload the page from ServerONE and the page from ServerTWO : you should see the session counter to increase in a sequence across the two server instances.</p>
<p>You&#8217;ve just created your first Liberty Profile cluster with two instances and a shared in-memory grid for HTTP session storage.</p>
<p>I leave you as an exercise to install and configure a load balancer in front of these two instances.  Hint : I am using the open-source <a href="http://www.inlab.de/balance.html">balance</a> for demo / test purpose.</p>
<p>If you find errors / typos in this (long) article, let me know &#8211; I will fix them &#8211; Thanks !</p>
<p>Enjoy !</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/websphere-liberty-profile-cluster-sharing-an-in-memory-data-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to deploy REST based web services to Liberty Profile ?</title>
		<link>http://www.stormacq.com/how-to-deploy-rest-based-web-services-to-liberty-profile/</link>
		<comments>http://www.stormacq.com/how-to-deploy-rest-based-web-services-to-liberty-profile/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 19:40:21 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[liberty profile]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wink]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=510</guid>
		<description><![CDATA[In my last blog entry I described how to install Liberty Profile and to configure an Eclipse based development environment.  In this entry, I will show you how to develop &#38; deploy a &#8220;Hello World&#8221; complexity REST based web service. Official JAX-RS / Liberty profile is available on IBM Documentation web site.  When developing or [...]]]></description>
				<content:encoded><![CDATA[<p>In <a href="http://www.stormacq.com/?p=498" target="_blank">my last blog entry</a> I described how to install Liberty Profile and to configure an Eclipse based development environment.  In this entry, I will show you how to develop &amp; deploy a &#8220;Hello World&#8221; complexity REST based web service.</p>
<p>Official JAX-RS / Liberty profile is available on <a href="http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.wlp.nd.doc%2Ftopics%2Ftwlp_dep_ws.html" target="_blank">IBM Documentation web site</a>.  When developing or debugging REST based services, it is always good to know that IBM&#8217;s WebSphere Liberty profile is using <a href="http://incubator.apache.org/wink/" target="_blank">Apache&#8217;s Wink</a> implementation behind the scene.</p>
<p>Unlike some other Java based application servers (<a href="http://glassfish.java.net" target="_blank">this one</a> and <a href="http://www.oracle.com/technetwork/middleware/weblogic/overview/index.html" target="_blank">this one</a> for example), WebSphere Liberty Profile does not perform many under covers magical for you, in particular it does not register an application context, you will need to write (one line of) code to do that.</p>
<p>That being said, the process is quite similar for every application server and IDE :</p>
<p>1. Create a web based project</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.03.12.png"><img class="aligncenter size-medium wp-image-511" title="Screen Shot 2012-10-08 at 21.03.12" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.03.12-300x282.png" alt="" width="300" height="282" /></a></p>
<p>&nbsp;</p>
<p>Choose a Project Name, select the runtime for deployment and uncheck the &#8220;Create EAR&#8221; option</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.04.59.png"><img class="aligncenter size-medium wp-image-512" title="Screen Shot 2012-10-08 at 21.04.59" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.04.59-224x300.png" alt="" width="224" height="300" /></a></p>
<p>2. add a POJO class that will serve as &#8220;resource&#8221;</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.08.22.png"><img class="aligncenter size-medium wp-image-513" title="Screen Shot 2012-10-08 at 21.08.22" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.08.22-300x168.png" alt="" width="300" height="168" /></a></p>
<p>Select a package name and class name.</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.12.31.png"><img class="aligncenter size-medium wp-image-514" title="Screen Shot 2012-10-08 at 21.12.31" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.12.31-250x300.png" alt="" width="250" height="300" /></a></p>
<p>Type the following code :</p>
<pre>import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.PathParam;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;

@javax.ws.rs.ApplicationPath("resources")
@Path("/test")
public class Demo extends javax.ws.rs.core.Application {

    @Context
    private UriInfo context;

    @GET
    @Produces("application/xml")
    public String getXml() {
        return "&lt;xml&gt;Hello Rest World !&lt;/xml&gt;";
    }

    @PUT
    @Consumes("application/xml")
    public void putXml(String content) {
    }
}</pre>
<p>3. add your business code for the PUT and GET methods</p>
<p>4. Before deploying &#8211; Add JAX-RS &#8220;feature&#8221; to your server configuration<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.26.16.png"><img class="aligncenter size-medium wp-image-515" title="Screen Shot 2012-10-08 at 21.26.16" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.26.16-300x98.png" alt="" width="300" height="98" /></a><br />
This will tell the Liberty kernel to load the JAX-RS server side implementation. You do not need to restart your server when adding / removing features.</p>
<p>5. Deploy and Test</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.29.58.png"><img class="aligncenter size-medium wp-image-516" title="Screen Shot 2012-10-08 at 21.29.58" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.29.58-300x194.png" alt="" width="300" height="194" /></a></p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.31.36.png"><img class="aligncenter size-medium wp-image-517" title="Screen Shot 2012-10-08 at 21.31.36" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.31.36-240x300.png" alt="" width="240" height="300" /></a><br />
At this stage, Eclipse&#8217;s browser will open on the application default URL and will display an error message.  This is normal as we did not define a landing page or default servlet in this project (index.jsp or index.html) for example.<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.34.41.png"><img class="aligncenter size-medium wp-image-518" title="Screen Shot 2012-10-08 at 21.34.41" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.34.41-300x72.png" alt="" width="300" height="72" /></a></p>
<p>To access the REST web service, use this URL pattern :</p>
<pre>http://&lt;hostname&gt;:&lt;port number&gt;/&lt;project name&gt;/&lt;application path&gt;/&lt;path&gt;</pre>
<p>which translates for this example to</p>
<pre>http://localhost:9080/TestREST/resources/test</pre>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.36.32.png"><img class="aligncenter size-medium wp-image-519" title="Screen Shot 2012-10-08 at 21.36.32" src="http://www.stormacq.com/wp-content/uploads/2012/10/Screen-Shot-2012-10-08-at-21.36.32-300x71.png" alt="" width="300" height="71" /></a></p>
<p>&nbsp;</p>
<p>Et voilà, you just created, deployed and tested your first REST based web service on WebSphere Liberty Profile.</p>
<p>Enjoy !</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/how-to-deploy-rest-based-web-services-to-liberty-profile/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to install WebSphere 8.5 Liberty profile on Mac</title>
		<link>http://www.stormacq.com/how-to-install-websphere-8-5-liberty-profile-on-mac/</link>
		<comments>http://www.stormacq.com/how-to-install-websphere-8-5-liberty-profile-on-mac/#comments</comments>
		<pubDate>Sun, 09 Sep 2012 11:07:29 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[liberty]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=498</guid>
		<description><![CDATA[WebSphere 8.5 Liberty Profile is a small, fast, agile WebSphere runtime that you &#8211; developers &#8211; can use to develop, test or embed in your applications.  The runtime is provided free of charge from IBM.  Like every Java EE Profile, it implements a subset of the Java EE Specification, while ensuring 100% &#8220;upwards&#8221; fidelity to [...]]]></description>
				<content:encoded><![CDATA[<p>WebSphere 8.5 <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/introducing_the_liberty_profile6?lang=en">Liberty Profile</a> is a small, fast, agile WebSphere runtime that you &#8211; developers &#8211; can use to develop, test or embed in your applications.  The runtime is provided free of charge from IBM.  Like every <a href="http://weblogs.java.net/blog/robc/archive/2008/02/profiles_in_the_1.html">Java EE Profile</a>, it implements a <a href="http://www.stormacq.com/?p=486">subset</a> of the Java EE Specification, while ensuring 100% &#8220;upwards&#8221; fidelity to the full WebSphere Application Server.</p>
<p>On my <a href="http://www.apple.com/macbook-pro/features/">i7 &#8211; quad core &#8211; machine</a>, WAS Liberty starts in less than 1 sec.  With not application deployed.</p>
<p>Installing the runtime is as easy as unzipping a file on your drive, here are the steps</p>
<ol>
<li>download from <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download_wlp?lang=en">wasdev.net</a> (46 Mb only)</li>
<li>unzip
<pre>java -jar wlp-developers-8.5.0.0.jar</pre>
<p>After displaying and approving the distribution license, you will be ready for the next step</li>
<li>Optional : create a server instance (an instance &#8220;defaultServer&#8221; is created for you automatically, this step is optional)
<pre># cd wlp
# chmod u+x bin/server
# ./bin/server create MyInstance
Server MyInstance created.</pre>
</li>
<li>start it
<pre># ./bin/server start MyInstance</pre>
<p>Or just this line to start the default instance</p>
<pre>#./bin/server start</pre>
<pre>Server MyInstance started with process ID 59946.</pre>
</li>
</ol>
<p>Now that you have the runtime, you are ready to install the tooling to manipulate it from <a href="http://eclipse.org">Eclipse</a>.</p>
<ol>
<li> Start Eclipse (Indigo or Juno)</li>
<li>Open Eclipse MarketPlace<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-1.png"><img class="aligncenter size-medium wp-image-499" title="eclipse-1" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-1-300x225.png" width="300" height="225" /></a></li>
<li>Search for &#8220;liberty&#8221; and click on &#8220;Install&#8221;<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-2.png"><img class="aligncenter size-medium wp-image-500" title="eclipse-2" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-2-300x241.png" width="300" height="241" /></a></li>
<li>In the &#8220;Eclipse&#8221; menu, click on &#8220;Preferences&#8221;</li>
<li>In the &#8220;Preferences&#8221; pane, select &#8220;Server&#8221;, then &#8220;Runtime Environment&#8221; and click on &#8220;Add&#8221;<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-3.png"><img class="aligncenter size-medium wp-image-500" title="eclipse-3" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-3-1024x682.png" width="430" height="286" /></a></li>
<li>Select &#8220;WebSphere Application 8.5 Liberty Profile&#8221;<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-4.png"><img class="aligncenter size-medium wp-image-500" title="eclipse-4" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-4-292x300.png" width="292" height="300" /></a></li>
<li>Give the name you want, point to your Installation directory (see bullet 2 in the installation instructions above) and click &#8220;Finish&#8221;<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-5.png"><img class="aligncenter size-medium wp-image-503" title="eclipse-5" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-5-296x300.png" width="296" height="300" /></a></li>
<li>Switch to the &#8220;Server&#8221; window in the &#8220;Java EE&#8221; perspective</li>
<li>Right-click &#8211; New -&gt; Server, choose your newly created runtime instance<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-6.png"><img class="aligncenter size-medium wp-image-504" title="eclipse-6" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-6-274x300.png" width="274" height="300" /></a></li>
<li>Don&#8217;t leave the &#8220;Server&#8221; window, right click on the server name and choose &#8220;Start&#8221;<br />
<a href="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-7.png"><img class="aligncenter size-medium wp-image-505" title="eclipse-7" alt="" src="http://www.stormacq.com/wp-content/uploads/2012/09/eclipse-7-300x268.png" width="300" height="268" /></a></li>
</ol>
<p>The &#8220;Console&#8221; window should automatically open, and within a few seconds, you should see the following line to appear :</p>
<pre>Launching default (wlp-1.0.0.20120428-1251/websphere-kernel_1.0.0) on Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_07-b10 (en_US)
[AUDIT   ] CWWKE0001I: The server default has been launched.
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
[AUDIT   ] CWWKF0011I: The server default is ready to run a smarter planet.</pre>
<p>You have now a fully functional WebSphere Liberty profile installed and the corresponding tooling in Eclipse.  The tooling allows you to stop/start the application server, but also to manage its configuration and, obviously, to deploy applications on it.</p>
<p>In the next blog entry, I will show you how to deploy a REST based web service on Liberty</p>
<p>Enjoy !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/how-to-install-websphere-8-5-liberty-profile-on-mac/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Running Android Jelly Bean on Google Nexus One</title>
		<link>http://www.stormacq.com/running-android-jelly-bean-on-google-nexus-one/</link>
		<comments>http://www.stormacq.com/running-android-jelly-bean-on-google-nexus-one/#comments</comments>
		<pubDate>Sun, 22 Jul 2012 08:07:29 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[jelly bean]]></category>
		<category><![CDATA[nexus one]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=494</guid>
		<description><![CDATA[This week-end, I decided to upgrade my &#8220;old&#8221; Nexus One smartphone to the latest (and greatest) Android version (4.1.1 aka Jelly Bean) although Google stopped shipping upgrades for this phone with Android 2.3, aka GingerBread. So, as you guessed, it requires to &#8220;root&#8221; the phone, i.e. to bypass system protections and to allow to install new [...]]]></description>
				<content:encoded><![CDATA[<table border="0">
<tbody>
<tr>
<td><a href="http://www.stormacq.com/wp-content/uploads/2012/07/android-jelly-bean.jpeg"><img class="aligncenter size-medium wp-image-495" title="android-jelly-bean" src="http://www.stormacq.com/wp-content/uploads/2012/07/android-jelly-bean-300x230.jpeg" alt="" width="300" height="230" /></a></td>
<td>This week-end, I decided to upgrade my &#8220;old&#8221; <a href="http://en.wikipedia.org/wiki/Nexus_One" target="_blank">Nexus One smartphone</a> to the latest (and greatest) Android version (4.1.1 aka Jelly Bean) although Google stopped shipping upgrades for this phone with Android 2.3, aka GingerBread. So, as you guessed, it requires to &#8220;root&#8221; the phone, i.e. to bypass system protections and to allow to install new software on it.The Android developer community is very active, there are a lot of information available on the web to do so, sometime somewhat cryptic, and not really step by step instructions.I am quite used to do this on iPhone, since several years now, but I am totally new to this on Android.  I am using this blog entry to remind me the steps I took and &#8211; hopefully &#8211; to help others to decrypt existing tutorials.  This is by no mean a complete step-by-step tutorial for rookie, rather a complement to the tutorial you will find on the net.Jelly Bean for Nexus One is made available by TexasIce on <a href="http://forum.xda-developers.com/showthread.php?t=1762790" target="_blank">XDA Forums</a>. Many thanks for the great work !Existing tutorials are available (<a href="http://www.redmondpie.com/how-to-install-android-4.1.1-jelly-bean-on-galaxy-nexus-manually-tutorial/" target="_blank">part 1</a> and <a href="http://www.redmondpie.com/how-to-install-flash-android-4.1.1-jelly-bean-on-nexus-s-i9020i9020ti9020a-tutorial/" target="_blank">part 2</a>) but I followed a quite different path.</td>
</tr>
</tbody>
</table>
<p><strong>Step #0</strong> : be sure to have the lastest <a href="http://developer.android.com/sdk/index.html" target="_blank">Android SDK</a> installed.</p>
<p><strong>Step #1</strong> : Install <a href="http://forum.xda-developers.com/showthread.php?t=1270589" target="_blank">Black Rose bootloader</a>.  Although theoretically possible, I couldn&#8217;t manage to do this from Mac OS X.  Black Rose distribution provides a Linux and Windows binary to automate the process to the maximum.  Just launch it <strong>as root</strong>, look at your screen, wait for a couple of reboot &#8230; done !</p>
<p>I lost an hour because I did not start Black Rose as root on linux and it blocked during the process on</p>
<pre>&lt;waiting for the device&gt;.</pre>
<p>Be sure to start Black Rose as root !</p>
<p>I used a Virtual Machine with Ubuntu Natty and attached the Nexus One USB to the Virtual Machine &#8211; worked like a charm.</p>
<p><strong>Step #2</strong> : apply <a href="http://forum.xda-developers.com/showthread.php?t=1762790" target="_blank">a small patch to HBoot</a>, required for Jelly Bean</p>
<pre>adb reboot bootloader
fastboot flash hboot hboot_jellybean_260-8-168.nb0
fastboot reboot-bootloader</pre>
<p>You should see &#8220;Jelly Bean&#8221; on the second line</p>
<p><strong>Step #3</strong> : Flash <a href="http://forum.xda-developers.com/showthread.php?t=1762790" target="_blank">Jelly Bean</a>.  I downloaded the TAR file (not the ZIP)</p>
<p>First wipe out everything from the device</p>
<pre>fastboot erase userdata
fastboot erase cache</pre>
<p>Then flash the system</p>
<pre>tar -xf &lt;release&gt;.tar.xz
fastboot erase system
fastboot flash system system.img
fastboot erase boot
fastboot flash boot boot.img</pre>
<p><strong>Step #4</strong> : Install Google App.</p>
<p>At this stage, Jelly Bean should start on your Nexus.  It took me a while to realize that Google Apps are not installed by default.  Consequence : Contacts are not synced with your Google account and &#8211; most importantly &#8211; no Google Play ! So it is not possible to install additional applications. You&#8217;ll have to install them yourself to get access to Google Now, Google Accounts (and synchro), Maps and Google Play !</p>
<p>Apps are available on XDA Forums as well (<a href="http://forum.xda-developers.com/showthread.php?t=1762790">GApps 7/13</a> at the time of this writing)</p>
<p><strong>Step #4.1</strong> : I installed GApps using a custom recovery application : ClockWork.  <a href="http://forums.miui.us/showthread.php?21396-Tutorial-Blackrose-(Custom-Hboot)-Installation-for-Miui-2-6-8">Download and installation instructions are here</a>.</p>
<p><strong>Step #4.2</strong> : reboot in recovery mode to access ClockWork, then</p>
<p>use the menu system to put the Nexus One in USB Storage mode</p>
<ul>
<li>Copy GApps.zip to the flash card</li>
<li>Use ClockWork&#8217;s menu to install GApps</li>
<li>Reboot</li>
</ul>
<p>and voilà you should have Jelly Beans + Google Apps running on your Nexus One.</p>
<p>A few things are not working so far :</p>
<ul>
<li>the Camera</li>
<li>the trackball button to wake up the device</li>
</ul>
<p>But the package is alpha software, so do expect updates and improvements in the coming weeks</p>
<p>Enjoy !</p>
<p>&nbsp;</p>
<p>[UPDATE]<br />
I upgraded with <a href="http://dl.evervolv.com" target="_blank">20121113 nightly build</a> (resuming my procedure from Step #3).  I used the simplified update with</p>
<pre> fastboot update <a href="http://dl.evervolv.com/static/n/2012.11.13/Evervolv-perdo-3.1.0-passion-nightly-20121113-fastboot-update.zip">Evervolv-perdo-3.1.0-passion-nightly-20121113-fastboot-update.zip</a></pre>
<p>Also, clockwork do not need to be re-installed, it still lives in the recovery partition.</p>
<p>The system is much more responsive.  The camera and trackball button work as expected.</p>
<p>I also used M2SD to move app to SD card.  (be sure to partition the card as required)</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/running-android-jelly-bean-on-google-nexus-one/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Distributed Caching, also on Mac OS X</title>
		<link>http://www.stormacq.com/distributed-caching-also-on-mac-os-x/</link>
		<comments>http://www.stormacq.com/distributed-caching-also-on-mac-os-x/#comments</comments>
		<pubDate>Sat, 14 Jul 2012 06:20:27 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[extreme scale]]></category>
		<category><![CDATA[macosx]]></category>
		<category><![CDATA[objectgrid]]></category>
		<category><![CDATA[wxs]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=490</guid>
		<description><![CDATA[IBM&#8217;s distributed caching system, WebSphere eXtreme Scale (formerly ObjectGrid) is a distributed, transactional object caching system for elastic scalability and extreme performance. It can store any type of data and provides REST API as long with Java (HashMap, JPA, Hibernate, Spring) APIs.  It also natively integrates with WebSphere Application Server and WebSphere Liberty Profile to [...]]]></description>
				<content:encoded><![CDATA[<p>IBM&#8217;s distributed caching system, <a href="http://www-01.ibm.com/software/webservers/appserv/extremescale/" target="_blank">WebSphere eXtreme Scale</a> (formerly ObjectGrid) is a distributed, transactional object caching system for elastic scalability and extreme performance.</p>
<p>It can store any type of data and provides REST API as long with Java (HashMap, JPA, Hibernate, Spring) APIs.  It also natively integrates with WebSphere Application Server and <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/home?lang=en" target="_blank">WebSphere Liberty Profile</a> to cache HTTP session data.</p>
<p>It is supported on most platforms and &#8211; because it is a pure JavaSE application, it also works on Mac OS X, although this platform is not officially supported by IBM.</p>
<p>How to get started ?</p>
<ul>
<li><a href="http://www.ibm.com/developerworks/downloads/ws/wsdg/">Download eXtreme Scale</a> trial and unzip</li>
<li>In a Terminal, go to product directory</li>
<li><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">cd ObjectGrid/gettingstarted</span></li>
<li>Run the Catalog Server</li>
<li><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">./runcat.sh</span></li>
<li>Open another Terminal window and start an ObjectGrid server</li>
<li><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">./runcontainer.sh server0</span></li>
<li>Repeat the last step to create several instances of ObjectGrid server</li>
<li>Then experiment with client script.  It provides basic CRUD operations from command line</li>
<li><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">./runclient.sh i key value</span></li>
</ul>
<p>Congrats, you managed to setup a multi instance grid, in-memory cache system on your Mac.</p>
<p>To further understand how it works and how you can programmatically interact with the cache, refer to <a href="http://pic.dhe.ibm.com/infocenter/wxsinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.extremescale.doc%2Fwelcome%2Fwelcome_xs.html" target="_blank">eXtreme Scale documentation</a>.</p>
<p>Next step will be to demonstrate how eXtreme Scale integrates with Liberty to create a multi instance cluster with shared HTTP Session. Stay Tuned.</p>
<p>Enjoy !</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/distributed-caching-also-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebSphere Application Server &#8211; Liberty Profile</title>
		<link>http://www.stormacq.com/websphere-application-server-liberty-profile/</link>
		<comments>http://www.stormacq.com/websphere-application-server-liberty-profile/#comments</comments>
		<pubDate>Fri, 08 Jun 2012 04:55:06 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[jsr]]></category>
		<category><![CDATA[liberty profile]]></category>
		<category><![CDATA[was]]></category>
		<category><![CDATA[websphere]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=486</guid>
		<description><![CDATA[When talking to developers about WebSphere Application Server Liberty Profile (the new lightweight, ultra fast and developer friendly profile for WAS), I always receive questions about supported JSRs and comparison with Java EE 6&#8242;s Web Profile. Therefore I collected information from documentation, blogs, internal IBM forums etc &#8230; to create the following list. (click to [...]]]></description>
				<content:encoded><![CDATA[<p>When talking to developers about <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/introducing_the_liberty_profile6?lang=en" target="_blank">WebSphere Application Server Liberty Profile</a> (the new lightweight, ultra fast and developer friendly profile for WAS), I always receive questions about supported JSRs and comparison with <a href="http://jcp.org/aboutJava/communityprocess/final/jsr316/index.html" target="_blank">Java EE 6&#8242;s Web Profile</a>.</p>
<p>Therefore I collected information from documentation, blogs, internal IBM forums etc &#8230; to create the following list.</p>
<p><a href="http://www.stormacq.com/wp-content/uploads/2012/06/liberty_profile_features.pdf"><img class="aligncenter size-medium wp-image-488" title="Screen Shot 2012-06-08 at 06.49.50" src="http://www.stormacq.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-08-at-06.49.50-300x144.png" alt="" width="300" height="144" /></a></p>
<p>(click to enlarge <img src='http://www.stormacq.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<p>This is *not* an official IBM document, just a compilation I gathered from various sources.  Please feel free to point me any missing or incorrect entries.</p>
<p>[UPDATE]</p>
<p>The official list of API supported in Liberty profile is now published in <a href="http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/topic/com.ibm.websphere.wlp.nd.multiplatform.doc/topics/rwlp_prog_model_support.html" target="_blank">WAS 8.5 product documentation</a>.</p>
<p>[/UPDATE]</p>
<p>Enjoy !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/websphere-application-server-liberty-profile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lotus Symphony Viewer  &#8211; a free OpenDocument viewer on iPad</title>
		<link>http://www.stormacq.com/lotus-symphony-viewer-a-free-opendocument-viewer-on-ipad/</link>
		<comments>http://www.stormacq.com/lotus-symphony-viewer-a-free-opendocument-viewer-on-ipad/#comments</comments>
		<pubDate>Fri, 01 Jun 2012 05:47:33 +0000</pubDate>
		<dc:creator>Sébastien Stormacq</dc:creator>
				<category><![CDATA[IBM]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[ibreoffice]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[opendocument]]></category>
		<category><![CDATA[openoffice]]></category>
		<category><![CDATA[symphony]]></category>

		<guid isPermaLink="false">http://www.stormacq.com/?p=474</guid>
		<description><![CDATA[I am using OpenOffice from 13+ years, before it was an open source suite and before it was acquired by Sun Microsystems (1999). At that time, StarOffice was the only cross platform productivity suite running on Windows, Linux and Solaris. After Oracle abandoned the suite &#8211; and many other solutions in Sun Microsystems&#8217; portfolio &#8211; [...]]]></description>
				<content:encoded><![CDATA[<p>I am using OpenOffice from 13+ years, before it was an open source suite and before it was acquired by Sun Microsystems (1999). At that time, <a href="http://en.wikipedia.org/wiki/StarOffice" target="_blank">StarOffice</a> was the only cross platform productivity suite running on Windows, Linux and Solaris.</p>
<p>After Oracle abandoned the suite &#8211; and many other solutions in Sun Microsystems&#8217; portfolio &#8211; the situation around Open Office is not easy to follow, let&#8217;s try to recap.</p>
<ul>
<li>A group of original developers from Sun, sponsored by Canonical, Novell, RedHat <a href="http://www.documentfoundation.org/supporters/" target="_blank">amongst others</a>, forked OpenOffice and created <a href="http://www.libreoffice.org/" target="_blank">LibreOffice</a>.</li>
<li>Oracle donated the original Open Office code base to the <a href="http://incubator.apache.org/openofficeorg/" target="_blank">Apache Community</a>, now published under an <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache v2 license</a></li>
<li>Several large software editors have created derivative based on the OpenOffice code base, one of them being IBM&#8217;s <a href="http://www-03.ibm.com/software/lotus/symphony/home.nsf/home" target="_blank">Lotus Symphony</a> (freely available)</li>
</ul>
<p>Now that OpenOffice code base is not controlled by Oracle anymore, IBM <a href="http://www-03.ibm.com/software/lotus/symphony/buzz.nsf/0/0416E35FFB292C60852579F8005452EC/$file/Symphony%20Apache%20Future%20FAQ%2002-2012.pdf" target="_blank">decided to contribute its enhancement to the Apache OpenOffice project</a>.  This is important news for all OpenOffice users.  This means that all improvements and changes made by IBM for Lotus Symphony will be made available for all in OpenOffice.</p>
<p>We are all looking forward the first release combining Apache OpenOffice and Lotus Symphony.</p>
<p>In the mean time, IBM released an iOS viewer application.  It allows you to view Open Document Format (ODF) text documents, presentations, and spreadsheets downloaded to your phone or tablet without the need for any network connection.</p>
<p>IBM <a href="http://itunes.apple.com/be/app/ibm-lotus-symphony-viewer/id482597218?mt=8" target="_blank">OpenDocument Viewer for iOS is freely available</a> on the Apple App Store.</p>
<p>&nbsp;</p>
<p><img class="aligncenter" src="http://a5.mzstatic.com/us/r1000/102/Purple/cc/7a/d0/mzl.ekkimihj.480x480-75.jpg" alt="" width="480" height="360" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stormacq.com/lotus-symphony-viewer-a-free-opendocument-viewer-on-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
