RESEARCH ON EMERGING DEVELOPMENTS IN DATA PRIVACY AND SECURITY IN THE TECHNOLOGICALLY ADVANCED CORPORATE SECTOR

The war between information safeguards and information criminals has been depicted as a wait-and-see game. When the white caps counter one type of dark cap vindictive conduct, another malignant frame…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Golang on Azure containers

Building an API for any capability comes along with a lot of responsibilities. First, we break the requirement into multiple (micro)services that can come together as a holistic solution. We use separation of concerns as a strategy to ensure low coupling & high cohesion.

These multiple services would be built possibly as microservices. The moment we say services the scope for development increases multiple fold. Even a single service need a lot of work — First off, the service it self followed by automated tests, CI/CD process, monitor, log processing, observability and so forth.

Although it’s a lot of work, good news is, its a process and mostly one time setup. Once you have the pipeline setup, you can reuse it across services and across technologies too.

This is where cloud & cloud services come to party. Azure has rich set of capabilities to support most, if not all workload on cloud. As for building API and microservices there are multiple ways to accomplish it. Azure functions, webapp, AKS , container instance, VM’s and so much more. One of the most important parameters to make a choice happens to be wether we wish to be cloud native or cloud agnostic, in addition to parameters like scalability, speed to market, integration etc, to mention a few.

AKS a great service with lots of capabilities, the down side though is, you may need to know Kubernetes. It may be too much to ask from an application/API developer to know K8 for few APIs he has to serve. Other side of spectrum we have, services like Azure webapp and functions to keep development process simple and easy. Albeit, they bind you to Azure native services tightly.

Here’s the code for sample service.

As you can see, the code is simple and straight forward. We have a simple Product and multiple REST endpoint on top of it to enable CRUD operations. All products are stored in a local dictionary. Plan is to move it into a DB, have a cache and consume it over web/mobile.

Create docker image

Run docker image locally to see if it works

To push docker image over to Azure container registry, we need to create registry, login to it. Then we tag our docker image for instance creation. In this process we give a distinct name and version to our image.

Push image over to Azure registry

You can check if your registry is available

We now have all the bootstrap process in place. All that is left to be done is create an instance of our docker image and be done with all mechanics

Now that the instance is running, you can check application logs and container logs too

That’s it. You now have your API available on public API

Hold on, this API is on HTTP. We need to build a API Gateway and add necessary credentials on top of it to secure your API. We started with a tall objective to build 10,000 feet wall. We can’t make it happen over night. We now built our first 100 feet. We will take this one step at a time to build all of the needed solutions and automate them too

Our next step will be to build out cloud infrastructure with Terraform as opposed to command line. Why? It is easy to setup and teardown. This will not only keep the cost down, but also help build a consistent environment every time we need it.

Have a nice day!

Add a comment

Related posts:

Observability in Kubernetes.

Before we talk about what is fluentd and elastic search lets discuss briefly about logs and why we need logs.Since fluentd is more about logs which is second important concept in observability. Logs…

Know All About Blowing Cinnamon front door ritual for abundance

Cinnamon is the bark of a tree from the laurel family. It can be found in many different forms, including sticks and powder, which can be used in many different ways. Cinnamon has been used…

5 Investing Apps That Pay You to Invest

Opening an online brokerage account gives you the chance to build long-term wealth. However, sometimes investing apps give their clients a little extra bonus just for creating an account. For…