Dec 5, 2016

Instaling Ansible on Linux and Mac OS X

Ansible today is the new buzzword in world of DevOps because it allows sysadmins to easily and quickly transform their manual tasks into scripts for automated environment. The best thing about Ansible is that it is easy to learn, is agent less and doesn't require a lot of configuration to make the tool run. 

Apart from being a tool for sysadmins Ansible can be easily learn and put into practice by any developer with the same ease because of its clear syntax, structure and very wide support from open source community. As per Ansible website there are around 2200 contributors out there creating plugins for Ansible, so most probably there's already a solution to the problem or task. 

In this article we will look into installation of Ansible on different OS's and Docker.

Lets begin:

Latest release via YUM:

$ yum install ansible

Latest release via APT(ubuntu)

$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible

Latest release via APT (debian)

$ deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
$ apt-get install ansible

Latest release on MAC OS X
$ sudo easy_install pip
$ pip install ansible


Dec 1, 2016

Docker Cheatsheet - Handy Docker commands for everyday use.


Docker is a container management system that helps easily manage Linux Containers. It lets us create images in virtual environments on our laptop or development environments. The actions that we do on containers and its corresponding behaviour remains same when we run them in production environment.


Docker Commands :

$docker --help : It gives full list of all Docker commands.

$docker <COMMAND> --help : To get additional help pertaining for the given command.

$docker version : gives the information about docker installation.

Search Docker Images :

$docker search <search-term> for e.g docker search nginx

Pulling a Docker Image:

$docker pull tutum/ubuntu

List Docker Images :

$docker images

       

Remove Docker Image:

$docker rmi ubuntu:trusty

Run a Docker Image:

$docker run -i -t image_name:tag /bin/bash 
-i gives an interactive shell
-t will assign a pseudo-tty

Run Docker Image as Daemon
<pre>
$docker run -d image_name:tag for e.g. $docker run -d ubuntu:trusty
</pre>
View the running container/s:
$docker ps

Expose the Docker ports in Daemon mode
$docker run -d -p 8080:80 ubuntu:trusty (port 8080 of container is mapped to port 80 of host)

Check the logs of Docker Container
$docker logs container_id or name

Kill a Docker Container:
$docker kill container_id or name

Stop a Docker Container:
$docker stop container_id or name

Get the stats of Docker Container:
$docker stats container_name

$docker top container_name

Remove the container
$docker rm container_name

BUILDING A DOCKER IMAGE
$docker build --help 

$docker build -f path_to_Dockerfile -t REPOSITORY:TAG
REPOSITORY mostly username is used for Docker Hub and <TAG> is the container name.

Building with multiple config files

Create a new directory to hold config files and CD into that directory before executing the build command.

$docker build -t REPOSITORY:TAG


DATA VOLUMES

Mounting a single volume
$docker run -it -v /user/home ubuntu /bin/bash

Mounting multiple volumes 
$docker run -it -v /user/home -v /tmp ubuntu /bin/bash

Mounting local directory inside the Docker Container
$docker run -it -v /user/home:/data ubuntu /bin/bash

Mounting in Read Only mode
$docker run -it -v /user/home:/data:ro ubuntu /bin/bash

We can verify the mounts by issuing :
$docker inspect container_id

DATA VOLUMES CONTAINER










Nov 22, 2016

Beginners Guide to Microservices - Part 1

Today, orgnaization and developers are constantly working towards making applications that scale or are distributed. This constant effort has evolved some very interesting architecture patterns and [Microservices](https://en.wikipedia.org/wiki/Microservices) is one of them. Microservice consists of independent deployable services.

This article focusses on :
    - The Basics.
    - What are micorservices ?
    - Different patterns of microservices. (Part 2)
    - Deployment strategies. (Part 3)
    
    
A bit about terminology used in the article:

    - What is a service ?
    Services in a microservice architecture are processes that communicate with each other over a network in order to fulfill a goal.
    - What is a component ?
    An individual software component is a software package, a web service, a web resource, or a module that encapsulates a set of related functions (or data).
    - What is a container ?
    Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.
   - Monolithic Application : Any application that is build as a single unit and is also deployed as a single unit i.e if at any point of time a feature is added or bug is fixed then the new version of the application is deployed. Even in load balanced environment the server/vm running application has the full copy of latest code or repo. 

What are Microservices :

Microservices is a terminology for a set of guidelines or architectural pattern which says that each service can be an independent process or constitutes a group of processes. These services are fully independent in terms of development and deployment. Microservices pattern also expects the deployment process to be fully automated. Les illustrate this more with the help of an example :

Developer A is working upon a feature that allows authenticated users to write comments on posts. 
Developer B is working upon a feature that allows authenticated to users write posts.

Monolithic Approach is that both developers are working upon same code repository and pushing their code as per the requirements, features are tested with each deployment and at times regression/sanity testing is also done. With every deployment a new version of code is deployed on server/s and application is again tested just to make sure things are working as expected. A bug in any of the developers code causes the entire application to break apart. This is what stakeholders or users want to experience.

Microservices Approach treats both comments and posts feature as separate services. Both services can share the same database or can have separate database (this will involve a bit of complexity at application level). Each feature works an an independent service without any dependency on each others code. This decoupling helps in deploying each service separately on different virtual instances or containers and in case one of the  service is unavailable, the failure can be handled gracefully and user can still explore other features of web application. 

In this post we have just touched the concept of microservices. I will continue to elaborate this post and wait for my next part in the series.




 References :


  •  http://martinfowler.com/articles/microservices.html#MicroservicesAndSoa
  •  http://microservices.io/index.html



Nov 30, 2015

Carnegie Wave raises $7.5m

As per latest news Carnegie Wave has raised $7.5M surpassing its expectations of raising $5M earlier.
The capital raised by company was fuelled by speculation of taking up energy projects in Mauritius.



The company will be using CETO 6 technology, which is based upon generating electricity from waves. More about this technology can be found here. 


Nov 28, 2015

Merck to Acquire Cubist Pharma (CBST) for $102/Share; Deal Valued ~$9.5B


As per this article Merck and Cubist Pharmaceuticals have agreed upon acquisition of Cubist by Merck. The aquisition will take place at $102 per share and total transaction value is around $9.5 billion. 


Israeli company Clarisite has closed a Series A $5.5 million round of funding

Clarisite an Israeli behaviorial analytics company has secured a Series A funding for $5.5 million. Company has raised this funding led by Lazarus Israel Opportunties Fund. Lazarus is US based hedge fund.

Privately held Clarisite is privately held and was founded in 2010 by Yoav Schreiber, Yaron Gueta and Hanan Blumstein. Clariste claims to expedite process of generating user behaviourial analytics by recording user sessions. More can be found here.

Below are contact details of the Company as published on their web site.


GENERAL INQUIRIES

Tel: +1-646-801-7403
info@clarisite.com

UK OFFICE

Address: 26 York Street,
London, W1U 6PZ
Tel: +44-207-873-2415

BRAZIL OFFICE

Contato: Raphael Cohen
Address: Rua São Bento, 279/909,
São Paulo/SP, CEP: 01011-000
Tel: +55-21-3256-7135
Fax: +55-21-9977-7604

ISRAEL OFFICE

Address: 3 Bazel Street, Petach Tikva
Tel:  +972-7-47022321
Fax: +972-7-74701240

Oct 14, 2010

measuring bandwidth in linux

Wondering how to measure bandwidth usage on linux, its not that complex just install vnstat. On most linux systems it shows 'fail to start' due to unavailability of database. You need to create one, again even this is very simple.You will see this error on Ubuntu :

No database found, nothing to do. Use --help for help.

A new database can be created with the following command:
    vnstat -u -i eth0

Replace 'eth0' with the interface that should be monitored.

The following interfaces are currently available:
    lo eth0 wlan0


Simple isnt't you know what to do, just use vnstat -u -i I used wlan0 to monitor bandwidth usage for wi-fi. As soon as vnstat starts to gather data, it will start showing up. Voilaaa.....Enjoy.

Sep 4, 2010

Build you own Highly Available Cluster with 'Wackamole' and 'Spread'

By :


Yair Amir
Ryan Caudy
Ashima Munjal
Theo Schlossnagle









This application works on a bunch of virtaul IPs and sees that all these IP remain available on a bunch of machines hosting these IP's. Constraint is that these bunch of machines should be on same LAN. If one machine goes down 'Wackamole' ensures that rest of the machines take over those IP's and all 20 IP remain visible to outer world at all times.

More to come....

Sep 3, 2010

Developing Applications for Twitter using its API.

Twitter is widely used application and I use it a lot and sometime or other I have felt the need to build something of my own to facilitate my style of usage or to actuate upon my ideas. In this post I'll be sharing my journey from a newbie to twitter app developer by sharing each step as I go through.  Hope this helps all those new to twitter API.

Step 1: Register your application with twitter. Here is the link to do that :http://dev.twitter.com/apps/new

 After registration you will be provided with consumer and secret key to be used for authentication. Though during registration process twitter will ask you to provide domain name. It does not means that you need to commit your files to that domain, you can work locally too.

Step 2: Download OAuth library for the language that you'd be using for developement. I am using PHP and downloaded quite a few libraries to try namely : 
 http://classes.verkoyen.eu/twitter_oauth
http://github.com/themattharris/tmhOAuth/

Step 3: Apart from consumer key and secret key there are user_token and secret token, you can see them in your app>>My Access Token

Step 4 : First Example

As a first timer use this example :

and just copy and paste the code to get the feel of the API.
Step 4 : Replace blanks with appropriate values from your app of the following variables :
        'consumer_key'    => '',
        'consumer_secret' => '',
        'user_token'      => '',
        'user_secret'     => '',


Step 5 : Save the file and run in your web browser. I used xampp for server.
Step 6 : Voila !!!! you just updated the status from PHP API.

More to come...