3 min read

Deploying a Java application on Azure Container Service and Cosmos DB

Introduction

Bitnami was recently invited to speak at a few Azure Meetups and we took that as an opportunity to demonstrate something cool. We love our partnership with Microsoft and are doing tons of great things together on Azure, Azure Container Service (AKS), Helm and in the Azure Marketplace.
Inspired by that work we wanted to showcase a fun use case, taking a common application type (Java) and running it in a container on a cool, new, managed Kubernetes platform (AKS), while leveraging a massively scalable distributed database (Cosmos DB). This blog features a recorded live walkthrough of building, deploying and testing that application.

Prerequisites

If you would like to follow along, a couple of accounts need to be set up beforehand. Most notably:

Setup

As mentioned earlier, the video was captured live. However, there are a few simple steps that were completed before the camera was rolling:

  • Install and run Azure CLI (command line interface).
  • Run the following commands:
    • Create Kubernetes (K8S) cluster (az aks create…)
    • Create Cosmos DB (az cosmosdb create…)
    • Install Helm (helm init; helm install…)
  • A sample Java app was pushed to a public GitHub repo (https://github.com/nomisbeme/customerapp)

Overview

After basic setup and cloning the git repo, the video will walk you through the following progression:

  • Build and package the application in a container image
  • Deploy the application to Kubernetes
  • Test the app in your browser
  • Modify the app (to accept customer records with email addresses too)
  • Push the rebuilt version of the app and confirm the new deployment works!

Once completed, the environment will look like:

Check out the Video


Cast: On the right: Simon Bennett (Bitnami Product Manager, lead vocals, keyboards); On the left: Brad Bock (Bitnami Program Manager, backing vocals)

Pieces/Parts

Why does the demo use these technologies?

  • Java: Java is a technology known to millions of developers around the world. Using projects like Spring Boot, Java developers can create cloud-aware applications very quickly.
  • Docker: Container images are a great way to package your applications, but packaging by itself is not enough – you’ve got to get the app running in the cloud.
  • Kubernetes: This demo uses the Azure Container Service (AKS) to achieve this goal. Kubernetes can run on any cloud (or your laptop, co-lo, or datacenter), but using a managed service like AKS lets you focus on building your app, not on the details of Kubernetes setup and configuration. Recall how quickly the rolling update was performed in the video? Containers can spin up in seconds, compared to VMs which typically take a few minutes.
  • Database: Using Cosmos DB with the demo app gets us started quickly by providing a single-region, low-throughput, low-cost database, with the option to add advanced capabilities later such as automated backups and geographic replication.

Wrap-Up

A lot of ground was covered in a short amount of time in the video. Hopefully you can see that by using these new platforms and technologies you can greatly simplify the process of deploying scalable applications. With tools like AKS and Cosmos DB, we’ve come a long way from the early days of Infrastructure-as-a-Service (IaaS), and even further from physical data centers. Not long ago deploying an application was a painful process for the average software developer, with the rough equivalent of these tasks taking hours, days, or even weeks if considering legacy provisioning of hardware and software!

Learn More

Want to learn more? Try it yourself!

Questions? Let us know in the comments.