“Releasing software is too often an art; it should be an engineering discipline.”
David Farley

Soajs

Framework Freedom Do not disrupt engineers by imposing new framework. This will kill agility
API Management & Lifecycle Build homogen API catalog by leveraging what you have. Do not start from scratch
Multitenant API Create economy of scale and accelerate time to market. Reusability is profitability
Agnostic Container Technology Do not limit yourself to proprietary technologies. Take advantage of kubernetes, swarm and other container technologies.  
Agnostic Cloud Leverage any cloud provider as well as you own private cloud. Move any system you have on the cloud in minutes
Continuous Integration & Delivery Release with a click of  button. Speed Speed Speed

Code mask ON

  • Integrate, Activate & Deploy a distributed service oriented architecture SOA cooked up from different technologies ( HAPI - Express - Java )
  • Integrate & Activate ( with Github )
  • Container Technology ( via Docker Swarm )
  • Cloud Orchestration ( via SOAJS Dashboard )

Our Demo will demonstrate how to deploy an environment ( DEV ) then deploy 3 services in it where each service is built using a certain technology/framework.

Once deployed, we will show using the Swagger Simulator tool in the API Catalog Module:

  1. how to test the APIs of these services 
  2. how multi tenancy is applied at the code level
  3. how mutli security is applied on running services

Finally we will demonstrate how to turn on Continuous Integration & Delivery, configure it and see it in action.

service

Service API method Description
Express /tidbit/hello POST retrieve a SOAJS object
Express /tidbit/hello GET returns a message containing your username and last name.
  • Configuring and apply Multi-Security

We will import a ready made configuration that introduces a product with 2 ACL packages where package 1 offers full access to all 3 services and their APIs while package 2 offers limited access to APIs who use the POST method only.

 

Package Name Environment  Description
package 1 DEV provides public access to both APIs
package 2 DEV provides limited access to only POST API

Multitenancy

TIDBIT 1 TID1 package 1 full access to all the APIs of all the services
TIDBIT 3 TID3 package 2 limited access to the API that use the POST method only
TIDBIT 5 TID5 package 2 limited access to the API that uses the GET method only
  • Users and Groups belong to tenants. 
  • Tenants use product packages  and each tenant offers a custom configuration per environment. 
    
  • Products and Packages provide ACL access to services
    
  • Services provide APIs and are deployed in multiple environments.

SOAJS Layers

Install SoaJs

# Create a directory to download the installer in it
> mkdir -p /opt/soajs/node_modules/ && cd /opt/soajs/node_modules/
 
# download the installer from npm
> npm install soajs.installer
 
# start the installer
> cd soajs.installer
> node .
# Create a directory to clone the repo
> mkdir -p /opt/soajs/node_modules
 
# Go to directory
> cd /opt/soajs/node_modules
 
# Clone configuration repo from github
> git clone git@github.com:soajs/soajs.tidbit.demo
 
# Install the dependencies
> cd soajs.tidbit.demo
> npm install
 
# node . -h <mongo service host> -p <mongo port>
> cd soajs.tidbit.demo/import/
> node . -h dashboard-soajsdata -p 32017

Fetch SOAJS demo repo

# Open the import script help manual
> cd soajs.tidbit.demo/import/
> node . --help

 Integrate & Activate Services

Head over to the Develop pillar → Repositories to activate the microservices.

In the Repositories, we find the default SOAJS account activated and it contains a list of repositories we can turn on and off.

Activate  soajs.nodejs.express  repository, you will be asked to select a branch; pick master.

Deploy a new Environment 

Our import script already imported the configuration we need to get things going. Let's deploy the DEV environment.

Go to Deploy pillar and select DEV from the drop down menu in the top left corner.

Click on High Availability → Cloud in the left-hand side menu , click on the Services tab and press Deploy Environment.

 Deploy the service (express)

Point the Dev Domain IP in your hosts file

127.0.0.1   dev-api.mydomain.com

Before proceeding, make sure to go to:

Deploy pillar / High availability - Cloud / Services (tab)

Find the controller entry and click on the 'service Operations' drop down and hit: Reload registry & Load provision

API Catalog

Test your Services with Swagger and Postman

We will test the microservice in two ways :

  1.  Swagger Simulator: rich UI simulator that provides REST API documentation and the ability to interact with them.
     SOAJS Dashboard UI is equipped with Swagger Engine and Simulator by default.

    1. Go to the dashboard → Develop → API Catalog:
    2. Click on Swagger logo that appears if the microservice contains the property "swagger" set to true
    3. Choose your environment where you deployed your microservice
    4. Choose the right tenant TID1 for example
    5. Use the simulator to make API calls to your microservice

 express is a  multitenant microservice; you will need to provide the tenant keys for the requests to work.

To find these keys, go to the Manage pillar → Multitenancy → Client ( you will see the list of tenants there ).

Expand a tenant entry, to reach the external keys section, grab the external key and use it in the postman requests. In the Swagger Simulator, when you pick the tenant, the external key is added automatically to the header

Multitenancy Demonstration 

Continuous Integration & Delivery

Continuous integration & Continuous Delivery CI/CD provides the mechanism to automate everything. Continuous integration (CI) means that whenever a developer checks in code to the source repository, a build is automatically triggered. Continuous delivery (CD) takes this one step further: after a build and automated unit tests are successful, you automatically deploy the application to an environment where you can do more in-depth testing.

Generally we recommend that you do continuous delivery to your development and staging environments. Most teams, require a manual review and approval process for production deployment.

SOAJS provides you with ready made UI so you can turn on and configure CI/CD with just a few clicks.

Configure CI

Head to Develop → Continuous Integration and pick the provider you would like to integrate with.

Fill in your account information and enter the CI Yaml Configuration where applicable.

Head to Develop → Repositories and click the configuration button next to your repository and select the Continuous Integration Tab.

Activate your repository and configure its settings and manage the environment variables that should be available at build time.

Continuous Delivery

Head to Develop → Repositories and click the configuration button next to your repository.

Select the Continuous Deliver Tab and configure the strategy to use for your service in each environment it is deployed in.

At this point, CI/CD is turned on and configured for soajs.express repository.

Head back to Develop → Continuous Integration:

  1. click on Download Continuous Integration
  2. Extract the zip file and add both files ( .travis.yml & soajs.cd.js ) at the root level of your repository
  3. Commit and push

Get you hands Dirty

Thank You 

SIMON TADROS

co-founder of switchdw (kiev)

Simon@switchdw.com 

jskiev

By Simon Tadros

jskiev

  • 1,375