Strategy to create (Micro)service using WSO2 and Docker

The last year I was working in a big UK’s project where I had to help in creation and preparation of the WSO2 Infrastructure to expose a bunch of functionalities as (Micro)services.

While we solve everyday problems in infrastructure such as Continuous Delivery, Security, Mediation, Logging, Testing, etc. I had to code many APIs and to explain how to do It to the other team members (Teaching by doing).

Based on this experience I will explain how to create an API layer from scratch using WSO2 but avoiding the common errors and bad practices.

(Micro)service Infrastructure

Well, before stating you should choose your preferred Products/Frameworks/Stacks/PaaS and set up your Development and Production Environment Infrastructure.

Actually there are a few good Products/Frameworks/Stacks/PaaS ready to create and manage the (Micro)service Lifecycle such as:

  1. Dropwizard (http://www.dropwizard.io)
  2. Deis (http://deis.io)
  3. Spring Boot (http://projects.spring.io/spring-boot)
  4. Ratpack (https://ratpack.io)
  5. Spark with Unirest (http://sparkjava.com)
  6. Vertx (http://vertx.io)
  7. Seneca (http://senecajs.org – in Javascript / node.js)
  8. WSO2 MSS (http://wso2.com/products/microservices-server – in Alpha)
  9. Zato (https://zato.io – in Python)

If you want start working with (Micro)services but using WSO2 technology, I have created a set of Docker WSO2 containers where in a few minutes you will have a development platform running.

Docker Containers to develop (micro)services with WSO2

Docker Containers to develop (micro)services with WSO2

Just follow these steps:

$ git clone https://github.com/chilcano/docker-wso2-dev-srv.git
$ cd docker-wso2-dev-srv
$ docker build --rm -t chilcano/wso2-esb:4.8.1 wso2esb/4.8.1
$ docker run --detach -t --name=wso2esb01a -p 19449:9443 chilcano/wso2-esb:4.8.1

Or you can use the existing containers available in DockerHub (https://hub.docker.com/r/chilcano):

//Previous steps:
$ git clone https://github.com/chilcano/docker-wso2-dev-srv.git
$ cd docker-wso2-dev-srv

//Build image:
$ docker build --rm -t chilcano/wso2-esb wso2esb/latest

//Run container:
$ docker run -d -t --name=wso2esb01a -p 19449:9443 chilcano/wso2-esb

//Check the WSO2 server:
$ docker exec -i -t wso2esb01a bash
root@4178f21fcad3:/opt/wso2esb01a/bin# tail -f ../repository/logs/wso2carbon.log
$ curl -v -k https://<IP_ADDRESS>:19449/services/Version

 

(Micro)service Methodology

Obviously, the best methodology is what is created based on experience, there are good books and guides for that:

Also is very important internalize and understand the recommendations and best practices when creating (Micro)services, for example, here you could start with The twelve-factor app is a methodology (http://12factor.net) and implement the Support Infrastructure for (Micro)service such as:

  • Service Discovery
  • Continuous Delivery & Continuous Integration
  • Security & Resilience
  • Monitoring
  • Logging
  • Etc.

At the end, You will be ready to get starting to work with (Micro)services.

@Chilcano

Tagged with: , , ,
Posted in SOA

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
%d bloggers like this: