Learning How to Write Cloud Native Apps

Throughout my development experience, I feel that I have had several major bursts-of-learning, due to problems which have made me re-evaluate how I approach architecting and developing a solution. I feel these ultimately make me better as a programmer, or at the very least, more versatile. I am sure some of these bouts of learning and understanding are near universal, experienced by most developers, such as understanding parallelisation, but others are somewhat more specialised, such as when I first started writing games, where having to take 60+ snapshots of a continuously evolving environment every second completely changed how I thought about performance and accuracy. Developing Cloud-Native applications (and indeed micro-service based applications, which share very similar principles) feels as though it is one of these moments in my development experience, and I feel it might be interesting to reflect upon that learning process.

I see the problem statement for Cloud-Native applications as something akin to: ‘you have no idea how many instances of your application will be running, you have no idea where they will be in relation to one another and you have no idea which one will be hit for any particular call’. That is a lot of unknowns to account for in your code, and forces you to think very carefully about how you architect and develop your applications.

Continue reading “Learning How to Write Cloud Native Apps”

Teaching How to Use Alexa to Take Off your Drone using NodeJS

Recently I was in Auckland, New Zealand running an Integration in Action workshop and I used Alexa to trigger some of my APIs, including some NodeJS APIs that I built to take off a drone. Some people found this interesting and asked me to write this blog to explain in detail how it works… So, here it is, I hope you find it useful.

There are multiple ways in which you can make Alexa to call your own APIs. Perhaps the most versatile way is by adding a new skill (see: blog 1, 2). However I found an even easier way to do so, and in order to achieve the MVP approach I have been attempting to practice in my day-to-day life, I took this simpler option, which is simulating a Phillips Hue HA bridge. By doing  so, Alexa detects a new Home Automation (HA) device in “her” network range and accepts voice commands to easily “turn it on” or “turn it off” which you can then leverage to call your own APIs.

Continue reading “Teaching How to Use Alexa to Take Off your Drone using NodeJS”

First Experience Using SOACS – Integration Analytics

The Integration Analytics Service Type (Insight) includes Real-Time Integration Business Insight and Business Activity Monitoring. Insight allows a user to easily define business milestones, map data from existing Oracle SOA and Service Bus projects. Insight also provides an OOTB Dashboard to surface milestone status as well as providing a capability for a user to build a custom dashboard. It also exposes an Event REST API which allows a developer to POST a JSON payload to the API in order to update the Milestone Dashboard.

In my previous blog on Integration Analytics I walked through the steps required to provision the Integration Analytics Cloud Service. In this blog I want to show how easy it is to invoke the service using the exposed REST API, and create milestones that are visible in the Out of the Box Dashboard. My manager is always telling me to take an MVP ( Minimum Viable Product) approach to things I am learning so I am deliberately attempting to be as (smart) lazy as possible. If there is an existing capability that helps me to rapidly reach my end goa, then I plan to use it. Bottom line, with Integration Analytics there is a lot more I could mention but I am focussed on just getting a REST call to work against the service that I just provisioned.
Continue reading “First Experience Using SOACS – Integration Analytics”

Getting Your VMs into the Oracle Cloud with Ravello

We were looking into some of the VM images that we have. Some of them were very useful but we were wanting to host them in the cloud for the upcoming workshops.

Ravello is a cloud service that allow you to import and manage your VMs or stacks of VMs on public cloud. The interesting part of this is that the service can use our cloud infrastructure or a third party cloud. Ravello manages the costs but also adds simple capability to manage your VMs better.

Here’s a quick guide to putting VMs (I did a VirtualBox image but it can be any type) in the Oracle Cloud with Ravello.

Continue reading “Getting Your VMs into the Oracle Cloud with Ravello”

Teaching how to integrate Salesforce and Sales Cloud with Oracle Integration Cloud Service

In this blog, I am going to show you how to integrate Salesforce and Sales Cloud with Oracle Integration Cloud Service (ICS). I am going to cover in detail how to configure ICS to subscribe for events to Salesforce and synchronise both SaaS applications without having to poll any of the endpoints. Salesforce is going to notify ICS when a specific event occurs, such as when Contacts who belong to a specific Account are added or edited.

This blog is a sequel of a previous blog, where I explain how to integrate Sales Cloud using ICS. If you haven’t reviewed it yet, I invite you to do so. Here is the link

Since this guide extends the Sales Cloud integration blog, I assume that you have created a simple CRUD set of REST APIs that interact with Sales Cloud Contacts. We will simply reuse these REST APIs to integrate into Sales Cloud. However, instead of the REST enabled API to CRUD Contacts into Sales Cloud, we could have decided to use an ICS “Invoke-based” Sales Cloud connector and achieve the same.

Continue reading “Teaching how to integrate Salesforce and Sales Cloud with Oracle Integration Cloud Service”

Teaching how to DevOps automate the provisioning of external APIs using Oracle API Platform and Developer Cloud Service

Modern Integrations require touching lots of different APIs coming from multiple “systems”. These “systems” can be big enterprise backend applications, such as: E-Business Suite, SAP, JDE, Siebel, etc. As well as modern SaaS Applications, such as: Service Cloud, ERP Cloud, Salesforce, Netsuite, Workday, etc. These “systems” can also be other smaller or custom applications running either on premise or in the cloud exposing either SOAP or REST services.

Rarely any of these “systems” can provide solid abilities to remotely expose APIs in a way that are tailored for a specific business case. Commonly, to achieve this, we need a separate integration layer that orchestrates APIs from multiple “systems” and easily obtain the desired business outcome, in a way that they are also reusable APIs to be utilise in other business scenarios. Furthermore, in order to properly apply security measures and effectively protect these APIs and safely expose them to external consumers (potentially in the public Internet), normally we need to use an API Gateway (see this blog to learn how).

Also, in previous blogs, John Graves showed us how to automate the creation and deployment of existing “internal Integration APIs” and expose them as secured external APIs using Oracle API Platform. (See ICS to API Platform and Oracle Service Bus to API Platform).

If we take the same automation concept, we can then apply it in a DevOps scenario, where we want to achieve the following:

Continue reading “Teaching how to DevOps automate the provisioning of external APIs using Oracle API Platform and Developer Cloud Service”

Using MFT Cloud Service to Automate HCM Batch Uploads – Part 2

In Part 1 of MFT to HCM integration, we configured MFT to perform a batch upload of employees from an SFTP folder to HCM and informed HCM to import the data.

Once the file is placed in the source folder, its picked automatically by Oracle MFT and then transferred to the Target. After the target has successfully received the file, MFT again takes care of invoking any dependent actions. These post-processing actions include items such as decompressing, decrypting, renaming, calling a downstream action, and notifications.

MFT provides default activities, as well as a flexible callout extension framework built in Java that can utilised to call any action you wish.

Here in Part 2, we will talk about design and deployment of the Post-Processing Java Callout that is utilised to trigger the HCM Cloud ImportAndLoadData service.

Continue reading “Using MFT Cloud Service to Automate HCM Batch Uploads – Part 2”

The “hidden” IaaS Capability

Oracle is moving fast in the IaaS world.

I’ve been using the Oracle Cloud IaaS service for quite some time now.  I spin up various forms of OEL or Ubuntu and deploy applications on top.

Selection_581.jpg

But did you know there are many ways to spin up common platforms on top of IaaS with no installation required?  Bitnami is one option, but there is a “hidden” menu item that few people know about and I want to share that with you now.

Continue reading “The “hidden” IaaS Capability”

OSB to API Platform

Selection_574.jpg

As a follow-on to my previous blog entry “ICS to API Platform,” I wanted to also show how a similar thing could be done for Oracle Service Bus (OSB).

The 12c release of OSB added many new capabilities to support REST services and execute REST services.  It also has automatic conversions between JSON and XML payloads making it very easy to expose existing webservices to REST/JSON based services.  It is also easy to consume REST/JSON services and use them just as if they were webservices.

Continue reading “OSB to API Platform”

Building a Smart Contract with Oracle Blockchain Cloud Service @ #WinterHack2018

Last weekend, I was at the Code Network Winter Hackathon event in Brisbane – https://codenetwork.co/winter-hackathon-2018/. I was there as a sponsor, workshop presenter, mentor and just a general supporter. As such there was some down-time between different activities. So, what a great time to sit down and work on something that I have no idea about (technically) – #Blockchain and Hyperledger. So, as a normal person does – I went searching for relevant content to help. Here’s a couple of the searches that I did.

Unfortunately, through many different searches and reading lots of things it became apparent that I didn’t know much and there was lots to learn. There seemed to a massive amount information that looked great. There was content that talked about what a Blockchain is. There was content that talked about the business use cases and examples of why you use a Blockchain technology. There was code that built a Blockchain. I found plenty smart contract examples on github. I learnt more about what I needed to know but it didn’t get me to the place that I wanted to be.

So – how do I develop and play with a Smart Contract?

The main learning for me through this process was the fact that my literacy around Blockchain was not very good. And as hard as I tried, “my search as only as good as my question”. Here’s my attempt of simplifying the landscape so as a developer, you can get started with the valuable bit of blockchain – ie building apps.

For the purposes of the Winter Hackathon, I was inspired by 3 relevant occurences – the Coles promotion called My Little Shopper – https://shop.coles.com.au/a/a-national/promo/little-shop-online (it’s amazing what people and parents would do); Tixel which is a safe and legit way to buy and sell tickets – https://tixel.com.au/Queensland (recently finished their tour of the CEA’s Collider accelerator program for creative tech); and CargoSmart which simplifies the global shipping industry to improve planning and on-time deliveries https://www.cargosmart.com/en/default.htm (and recently working with us on their Blockchain implementation).

WRITING YOUR SMART CONTRACT

When first looking into the implementation and specifically for HyperLedger, it felt like a Smart Contract was this mythical being that protected all intruders and evil spirits from tampering with the legendary Ledger. Oh was I mistaken.

Hey. I see what you truly are. You’re just a Data Access Object with some validation, integrity and
transformation logic with three types of bitbucket calls – GetState, PutState and wait for it …
DeleteState (which doesn’t delete it but only removes the lookup but keeps the transaction history).

With the mystical aura removed and a few different patterns emerging, it has become pretty simple. Here’s a few snapshots of what makes up the Smart Contract. Oh … most implementations are based upon Go. Some other implementations are now in NodeJS.

This is the start of the source file. The main imports are the Fabric Shim and Peer that relate to the Fabric Go SDK. The other imports are more about data manipulation.

This is the main structure of the state being managed. The json reference is a mapping to the attribute as described in JSON.

The index string is used as a key into data that is stored in the ledger.

This is the main function that is called by the exposed REST API. The payload itself has references to the chaincode (the Smart Contract implementation) as well as the function to execute and the arguments to pass to the function.

The references to t.read(), t.delete() or t.write()function calls are to delegate functions that implement the underlying GetState, PutState and DelState calls.

This is an example of a GetState call. Notice that data comes back as a byte array.

There are shim.Error() and shim.Success() functions to return failure and success states.

This is an example of a PutState call. Notice that data comes back as a byte array.

This is an example of a DelState call.
(Not much to it)

Once I wrote the basic CRUD Chaincode, then it needed to be packaged for Oracle Autonomous Blockchain Cloud Service which was my target platform for the purposes of what I was doing at the hackathon. It is quite easy. Zip up the one .go file. And now it was ready for me to install and instantiate on the Blockchain Cloud Service.

GETTING IT TO RUN

With the fun bit over, I needed to create the network that the chaincode would be installed and instantiated. There can 3 main steps:

  1. Create the network (ie. the environment in which the code is run) and organisations (ie. the participants of the interaction)
  2. Configure the network (ie. exchange keys and configuration)
  3. Deploy the chaincode and Run the chaincode via a REST API

Before I started provisioning this service, I went through a fair number blogs, articles, youtube clips and stack overflow questions about how to configure up the Blockchain infrastructure. There were a million and one ways to do it. All of them were detailed and more than what I wanted to do. So, I got an instance of Oracle Autonomous Blockchain Cloud Service and started working on it. The following sections will guide through this process.

1. Creating the Network and Organisations

For this example, I created one network and two organisations. That’s the first thing that I did. What happens is that the different blockchain services are provisioned for the network and organisations. In the default configuration, there’s a Blockchain Management console started to manage the network and organisations. This in default scenarios is deployed on port 3000 so go to http://<host&gt;:3000.

I create one network and two participant organisations each with their own REST Proxy and Console.
Specifically for the network configuration, there is an additional port for the Orderer.

The result of this was the network and organisations are created and are started.

2. Configuring the Network

With the network and organisations operational, the next step is to configure the network and associate the different participating organisations. What this means is that there is configuration and keys that are shared between these entities.

a) Export Orderer Settings

We’ll click on the link for the network (and in this case it’s Coles) and this opens a new console for managing the Blockchain network. Under the Network tab, the different organisations exist. The Orderer settings are extracted to be shared with the participant organisations. This process downloads a JSON file with some configuration.

b) Participants Joining the Network

Going back to the http://<host&gt;:3000 console, we’ll click on the link for managing a Blockchain organisation (and this is repeated for each organisation). Each participant organisation requires to export a set of certificates and import the network Orderer settings. Once completing the import process, we are operational.

Here’s a screenshot of the workflow to export the certificates which exports a JSON file and import the Orderer settings.

Once everything is complete, we can either go back to the network configuration (ie Blockchain Network console)
or repeat the process for another participant organisation.

Here’s a screenshot of the existing Orderer network configuration as shown in the Blockchain Network console.

By adding organisations to the network, we upload the JSON files exported from the participating organisations
(using the Blockchain Organisation consoles). In this scenario, we have two different organisations Jones and Smith.

Here’s a screenshot of the existing Orderer network configuration with the newly imported participant organisations.


This is another view of the relationship between the organisations and the network. We are now ready to deploy the chaincode.

3. Deploy the Chaincode

We are now just moments away from the true task we wanted to get it – running the chaincode. With the zip file of our Go code, we can install and instantiate it to be exposed through the REST API of the network.

We navigate to the Chaincode tab in the Blockchain Network console. This is where we see the different chaincodes deployed including different versions.

There are a couple of different ways to deploy – Quick and Advanced. I’ve just chosen Quick Deploy to keep the process simple.

The configuration that is required to deploy a chaincode includes: version, which peers to install and instantiate,
uploading the zip file and adding endorsement policies which leads to signing of different transactions.

With a few seconds (less than minutes), the chaincode is deployed to the network.
The next part to this is to run it. To save time, I’ve used postman to execute the REST APIs.

Here we go. The chaincode is deployed and operational. The REST API resources and formats are available here –
https://docs.oracle.com/en/cloud/paas/blockchain-cloud/rest-api/rest-endpoints.html

Having a look at the Blockchain Network console and under the Channels tab, I can look at the state of the ledger and other statistics.

We are now done. We’ve built the chaincode (ala the Smart Contract), we’ve spent a little time
configuring the network and organisations that participated in the network
and then we deployed the chaincode (as a zip file) and ran it.

If you want to try this out yourself, you can get trial from https://cloud.oracle.com/tryit and provision an Autonomous Blockchain Cloud Service for yourself.

At the end, as I was looking for search results for this article, I found exactly what I was wanting to find (within seconds) “Blockchain chaincode examples”. Here’s a couple of references that I have found to be useful and simple to get your head around without delving into the depths of the Blockchain infrastructure: