Kubernetes with KubeAdm, Ansible and Vagrant

Kubernetes is a pretty complex system and it is notoriously hard to install, also because there are many ways to install it.

As a result, there are tons of “out-of-the-box” solutions. Many cloud providers offer it preinstalled. There are also distributions like CoreOS offering ready-to-go solution at the operating system level, and all-in-one installers like kops for AWS.

However, I believe is it important to learn how to install it from scratch, step by step. Of course you do not have to install it when it is provided pre-installed (typically in clouds). But if you have to manage it, not understanding its installation is a big limitation. How are you supposed to troubleshoot it if you are not able to get it off of the ground without an “automated pilot” ?

So here there is my tutorial describing how to install Kubernetes from scratch in a development enviroment, using CentOS 7 and Vagrant. Deployment is further automated with Ansible. Procedures has been tested in OSX and Windows 10 with Windows Bash.

Read More

Devops4Scala - a JDK Docker image with SBT and Ammonite

In this post I will examine how to build a Docker image for Java Development Kit under Alpine Linux using the SBT Scala build tool, and Ammonite the Scala scripting shell.

In a previous post I started a series “Devops4Scala” describing how to use Scala for Devops tasks. The first post was about building Docker images using SBT and the plugin sbt-docker. The plugin is pretty powerful but it does not allow to do everything I needed for complex image builds.

To perform the required tasks I introduce another plugin I wrote, sbt-mosaico, extending sbt-docker and featuring configuration files, automated download, Ammonite scripting and more. I advise to read the past blog post about sbt-docker in order to fully understand this post, because it takes for granted you know how to build Docker images with SBT.

Since I am building a set of Docker images for Scala applications, a base image with the Java Development Kit is an absolute must. Scala is nowadays primarily a JVM language, although it can be successfully compiled to Javascript, and a nascent native compiler also exists.

Furthermore, I want to use Alpine Linux as a basis for my images, because it is very lightweight and is the de-facto standard for Docker images.

There are some “official” JDK images on Docker Hub built by Oracle, but they are not based on Alpine Linux, and they are also pretty big. There are also some images based on Alpine Linux with Sun JDK but they are not official. Last but not least, there are Open JDK based Alpine Linux images. What I want to build is an image based on Alpine Linux and Oracle JDK that are as small as possible.

Such an image cannot be legally distributed on the Docker HUB because it would violate the distribution agreement of Oracle JDK. However it is certainly legal to build an in-house image. So this blog post is about how to build such an optimized image for internal use. I believe the scripts can be handy in many cases.

All the scripts described in this post can be found on GitHub.

Read More

Devops4Scala - Using SBT to for advanced Docker builds

Are you a Scala Developer/Devops, interested in automating your workflow and build your Docker images?

Do you want to solve the limitations of Dockerfiles using the ubitiquous Scala’s SBT ?

Do you want to be able to build multiple your Docker images, with dependencies, compilation, documentation processing and all the artifacts generation with just one SBT command: sbt buildAll?

If you are interested then in super powering your Docker builds with SBT, read on. Of course, all of this could be of interest for everyone but it is really aimed to people into Scala development.

Read More

Devops4Scala - Scale Your Scala Application with Kubernetes

Kubernetes is the new kid on the block, promising to help deploy applications into the cloud and scale them more quickly. Today, when developing for a microservices architecture, it’s pretty standard to choose Scala for creating API servers.

If there is a Scala application in your plans and you want to scale it into a cloud, then you are at the right place. In this article I am going to show step-by-step how to take a generic Scala application and implement Kubernetes with Docker to launch multiple instances of the application. The final result will be a single application deployed in Kubernetes as multiple instances, and load balanced by Kubernetes.

Read More

ScalaGoodies - Atom, Ensime, Jupyter and Hydrogen

In this post I am introducing a source kit ( ScalaGoodies), for installing my current favorite selection of Scala development tools, incidentally also available for free. Here is a bird’s-eye view of what you can get:

Using my kit you should be able to add easily to your Scala project:

  • the Atom editor configured for Scala including powerful completions (courtesy of Ensime)
  • the ability to evaluate Scala code directly from Atom (thanks to Hydrogen)
  • a better sbt launcher and also a terminal in Atom for launching it
  • Jupyter, an advanced web based REPL (a.k.a. Noteebook), including the excellent jupyter-scala kernel for evaluating you Scala code.

If you are interested in this tools, read on for a description of how to install and use them quickly and easily.

Read More

Announcing Sparkoin 0.1

Did you ever dream of being able to analyze the Bitcoin Blockchain using Big Data tools?

Something like this:

If this is your dream too, now it is a bit more close to reality than before. I am pleased to announce to the world the 0.1 release of the open souce Sparkoin project.

Sparkoin is BigData for BitCoin. In practice, it is a system allowing to analyze the Blockchain using BigData technologies, most notably Hadoop and Spark.

Read More

Scala-js: using NPM and Browserify

Using Scala.js with NPM and Browserify

If you use Scala.js, the compiler of the Scala language to Javascript, you may find the standard dependency management of Scala.js too limiting in the modern Javascript world. Scala.js manages dependencies with WebJars, while JavaScript developers manage dependencies using NPM. Since dependencies produced by NPM are server-side, usually an additional step using Browserify or Webpack to generate browser code is needed.

In this post, I will describe how to integrate Scala.js with the plethora of JavaScript modules available on NPM. You can check this GitHub repository for a working example of the techniques described here. Using this example and by reading this post, you will be able to collect your JavaScript libraries using NPM, create a bundle using Browserify, and use the result in your own Scala.js project. All this without even installing Node.js, as everything is managed by SBT.

Read More