Deploying a Docker container on Azure ‘Web App for Containers’ can be done fairly easy. In this blog post, I will provide a step by step guide to get you started. Some basic knowledge of Azure and Docker definitely helps. But why should you care in the first place? You will get:
- a managed runtime (for a single image)
- scaling to multiple instances
- a simple deployment model
- easy integration with App Insights (Azure’s Monitoring system for Web Apps)
- use any Azure SaaS like CosmosDB, MSSQL, …
In No more Ifs I wrote a little bit about the new Optional class in Java 8. It enables the developer to work with optional values without a complex nested structure of if-then-else expressions. A colleague of mine, being a big fan of Kotlin, dropped a hint that using Kotlin, it would be much easier. He could even prove it. 🙂
Java 8 introduced with
Optional a functional datatype that enables the developer to work with optional values without nested if-statements. This can simplify your code a lot.
Inspired by my article The lightweightness of microservices – Comparing Spring Boot, WildFly Swarm, and Haskell Snap, a colleague of mine implemented the same Web service using the Go programming language. You can find his code here: Bitbucket-repo. To compare his implementations with the other ones, I integrated it into the main project (GitHub-repo) and measured it. Here are the results. 🙂
A microservice is an autonomous sub application for a strictly defined and preferably small domain. An application built from microservices is scalable, resilient, and flexible. At least, if the services and their infrastructure are well designed. One requirement on the used frameworks to achieve scalability and resilience is that they are lightweight. Lightweightness comes in different flavors. Microservices should be stopped and started fastly, and should consume few resources. The development and maintenance of microservices should be easy.
For this reason, in the Java world, Spring Boot is currently recommended as best choice regarding these requirements. Traditional Java EE application servers are too heavyweight, because they are not developed as basis for single services but as platform for running different applications simultaneously. Thus, they must be bloated.
Being a curious person I used some of my spare time in the last Christmas holidays to actually measure the lightweightness. First I chose Spring Boot and WildFly as “competitors”. I added WildFly Swarm which provides similar features as Spring Boot but is based on WildFly. Then looking at the requirements I decided to include a framework with a real small startup time in comparison to Java-based frameworks and chose Snap based an Haskell. For every framework I built a minimal micro service, wrapped it into a Docker container, and measured its weight.
For simple web sites a static web site generator is often sufficient. Jekyll is such a well know generator. In our company we use JBake, because of its good integration in the Java infrastructure. More information on that is found here: Integration of JBake in Maven – Static Websites.
In my nonbusiness life, I like to play with Haskell. This is why I used Hakyll for a small personal web site. I wanted it to be responsive and choose to use Foundation. To do some styling of the Foundation classes I needed to use SASS and embed it into Hakyll. It took me about two hours to put everything together. To save this time in the future, I extracted a small template with everything in it.