Enterprise grade Java.
You'll read about Conferences, Java User Groups, Java, Integration, Reactive, Microservices and other technologies.

Tuesday, June 7, 2016

How Cloud, Containers, Microservices and you can help Charity!

14:01 Tuesday, June 7, 2016 Posted by Markus Eisele
, , ,
No, this isn't a customer success story. And this isn't the typical post about some awesome stuff that you can do with technology. This time it is actually about knowledge in a different kind. Lightbend would love to know how you use the Cloud, Containers and Microservices in your daily work. How Enterprises are adopting these technologies and last but not least, how influential are the decisions that are made in development to the final system architecture choices being made.

Take the quick ten minute survey and don't forget to share the link with friends, colleagues and your contacts.

The results will be published next month (July) on the Lightbend tech blog!
Lightbend is donating to Charity for each completed survey! It's going to be either #yeswecode, SeniorNet or Mouse and you can select the cause at the end of the survey.  Make you voice heard and your answers count! We are aiming to break 3000 respondents, which unlocks a total donation of $1500!

Share the link
https://lightbend.qualtrics.com/SE/?SID=SV_aaXOYeDecDEMoRv

Sunday, May 15, 2016

Modern Architecture with Containers, Microservices, and NoSQL

14:19 Sunday, May 15, 2016 Posted by Markus Eisele
, ,
On Tuesday, May 10, 2016 I had the pleasure to join Arun Gupta (Couchbase), Mano Marks (Docker) and Shane Johnson (Couchbase) for a great webinar with ADTMag. You can watch the complete replay for free after registration. This blog highlights some of the most prominent findings and provides a brief writeup.

After a short introduction of the main business drivers behind the new architectures and the panel by Arun Gupta, it was time for Mano Marks (@manomarks) from Docker to give an overview of the container hype. With applications changing from centralised server installations which very rarely got updated to loosely coupled services with a high update frequency running on my small servers, containers provide a standard format which is easily portable between environments. Docker provides a great ecosystem around their products and is a solid foundation for applications following the new principles.

After Mano, it was my part. I did an overview from where we came from in terms of monolithic applications and why they survived so long including their advantages. With the introduction of microservices or better "right-sized" services we finally start to build systems for flexibility
and resiliency, not just efficiency and robustness. The relevant aspects for a successful microservices architecture are plenty and not easily to be achieved by using a single framework. You also have to respect the architecture, software design, methodology and organisation and also embrace the distributed systems thinking. I introduced the audience to some available decomposition strategies and also gave a very quick rundown about the Lightbend microservice framework Lagom.

Shane finished the presentation part of the webinar with an overview about the capabilities of the Couchbase server and how it supports application modernisation and microservice base architectures. The following FaQ with all the panelists tried to answer some of the most pressuring audience questions.

The whole webinar runs for an hour and it is packed with all the latest information around modern architectures. With the additional minutes spend on an hour, this is pretty much the most recent information you can get on the topic by the top speakers in the field. If you have nothing to do on this rainy weekend I highly recommend to watch it!

Wednesday, May 11, 2016

Developing Reactive Microservices with Java - My new free mini-book!

20:26 Wednesday, May 11, 2016 Posted by Markus Eisele
, ,
I am very happy to announce, that I finished another O'Reilly Mini-Book a couple of weeks ago. After the success of the very first edition which introduced you to the overall problem space of microservices and the amazing book by Jonas Bonér about the architecture of reactive microservice systems, it was about time to share a little more about how to implement them in Java. I am very proud to had Jonas write the foreword for this one and that I was able to write another 50+ pages in such a short time. The book uses Lagom as a framework to walk you through the service API, persistence API and how to work with Lagom-Services. Can't wait to hear your feedback and get you to try out Lagom. Here is the complete abstract and you'll find some further readings and links at the very bottom of the post. Did I mention, it is free to download? It is!

Abstract:
With microservices taking the software industry by storm, traditional enterprises running large, monolithic Java EE applications have been forced to rethink what they’ve been doing for nearly two decades. But how can microservices built upon reactive principles make a difference?

In this O’Reilly report, author Markus Eisele walks Java developers through the creation of a complete reactive microservices-based system. You’ll learn that while microservices are not new, the way in which these independent services can be distributed and connected back together certainly is. The result? A system that’s easier to deploy, manage, and scale than a typical Java EE-based infrastructure.

With this report, you will:

  • Get an overview of the Reactive Programming model and basic requirements for developing reactive microservices
  • Learn how to create base services, expose endpoints, and then connect them with a simple, web-based user interface
  • Understand how to deal with persistence, state, and clients
  • Use integration technologies to start a successful migration away from legacy systems
  • The detailed example in this report is based on Lagom, a new framework that helps you follow the requirements for building distributed, reactive systems. Available on GitHub as an Apache-licensed open source project, this example is freely available for download.


Markus Eisele is a Developer Advocate at Lightbend. He has worked with monolithic Java EE applications for more than 16 years, and now gives presentations at leading international tech conferences on how to evolve these applications into microservices-based architectures. Markus is the author of Modern Java EE Design Patterns (O’Reilly).


Tuesday, April 12, 2016

Integration Architecture with Java EE and Spring

14:27 Tuesday, April 12, 2016 Posted by Markus Eisele
, , ,
The O'Reilly Software Architecture Conference in New York happens this week. And I had the pleasure to give a tutorial together with Josh Long about how to integrate Java EE and Spring. We've been joking about this one since a while. The super stupid biased view onto both technologies which some people have in mind was something that bugged both of us since a while. Another important reason for this talk was, that we both are caring about modernisation of old applications. There is so much legacy software out there that is easy 10+ years old. And you find those legacy applications in both technologies. This is, why we wanted to help people to understand how to modernise them and survive the transition phase.

A little history about Spring and Java EE
The first part of the talk caught up on a little historical background of both technologies. Where they came from and how they evolved and lead into the state they are in today. Both evolved significantly since their inception and asking the question about what to chose today can easily be answered with a single sentence: "Chose the right tool for the right job". But you can even mix and match for many reasons.

Spring on Java EE
There is a broad space of problems where you might think about using Spring on top of Java EE. While EE has been around and evolved a lot, we had to learn that you can't really innovate in a standard body. This lead to more than just a handful of features that are to be desired if you build a reasonable modern application. Some of those gaps include the security space (social logins), NoSQL integration, enterprise integration in general. And while you are free to pick from Java EE open or closed source offerings to close them, Spring most often has an answer in the family which makes it easy to use the same programming model and have an integrated offering. Plus, the Spring framework has a very long tail: Spring framework 4 runs on Servlet 2.5+ (2006!!), Java EE 6 (2009) and Java 6+. Which makes it very easy to use modern features even on the most outdated base platform. Find the demo code in my github repository and enjoy how easy it is to deploy a spring war to a Java EE server and just use the APIs.

Java EE on Spring
But you can also turn this around and use Java EE APIs with Spring. The reasons you might want to do this are plenty: It can be a first migration step towards Spring while simply re-using some of your old code. Plus you want to use standards where standards make sense and where everything else would be to invasive. Examples include JTA, JPA, JSR303, JSR 330, JCA, JDBC, JMS, Servlets, etc.
And there is also an example app which you can run as a Spring Boot based fat-jar while using (mostly) Java EE APIs in it.

Technical Integration and Microservices
The last part of the presentation touched on technical integration between two systems and the technologies supported in both worlds. We also talked about microservices designs and answered a bunch of questions over the turn of the three hours.
I really enjoyed it and have to admit that Josh is an amazing presenter and I learned a hell lot over the last couple of days working with him! It's a pleasure to know you, Josh! Make sure to follow him on Twitter @starbuxman.

Thursday, April 7, 2016

Your first Lagom service - getting started with Java Microservices

09:07 Thursday, April 7, 2016 Posted by Markus Eisele
,
I've been heads-down in writing my next O'Reilly report and didn't had enough time to blog in a while. Time to catch up here and give you a real quick start into the new microservices framework named Lagom. It is different to what you might know from Java EE or other application frameworks. And this is both a challenge and opportunity for you to learn something new. If you can wait for a couple of more days, register to be notified when my new report will be available and learn everything about the story behind Lagom and how to get started. I will walk you through an example application and introduce the main concepts to you in more detail than I could in a blog post. This post is for the unpatient that want to get started today and figure everything out themselves.

Some background
Microservices are everywhere these days and more and more is unveiled about what it takes to build a complex distributed system with the existing middleware stacks. And there are far better alternatives and concepts to implement an application as a microservices based architecture. The core concepts of reactive microservices have been introduced by Jonas Bonér in his report Reactive Microservices Architecture which is available for free after registration. Lagom is the implementation of the described concepts. It uses technologies that you might have heard about but probably rarely used before as a Java EE developer: Mainly Akka and Play. But for now, let's just forget about them because Lagom provides you with a great abstraction on top and gives you everything you need to get started.

Prerequisites
Have activator and Java 8 installed. Activator is something that you probably also haven't heard about. It is build on top of sbt and helps you getting started with your projects and much more. A Lagom system is typically made up of a set of sbt builds, each build providing multiple services. The easiest way to get started with a new Lagom system is to create a new project using the lagom Activator template. No need for anything else right now. You probably want to have an IDE installed. IntelliJ or Eclipse should be good for now.

Setting up your first project
Time to get to see some code. Let's generate a simple example from the lagom-java template:
$ activator new first-lagom lagom-java

Change into the newly generated folder "fist-lagom" and issue the sbt command to create an eclipse project.
$ activator eclipse

A bunch of dependencies are downloaded and after the succesful execution you can open Eclipse and use the Import Wizard to import Existing Projects into your Workspace. Note, that if you are using the Immutables library with Eclipse, you need to set this up, too.

Lagom includes a development environment that let you start all your services by simply typing runAll in the activator console. Open the terminal and cd to your Lagom project:
$ activator runAll
The output looks similar to this:
[info] Loading project definition from /Users/myfear/projects/first-lagom/project
[info] Set current project to first-lagom (in build file:/Users/myfear/projects/first-lagom/)
[info] Starting embedded Cassandra server
........
[info] Cassandra server running at 127.0.0.1:4000
[info] Service locator is running at http://localhost:8000
[info] Service gateway is running at http://localhost:9000
[info] Compiling 2 Java sources to /Users/myfear/projects/first-lagom/helloworld-api/target/scala-2.11/classes...
[info] Compiling 1 Java source to /Users/myfear/projects/first-lagom/hellostream-api/target/scala-2.11/classes...
[info] Compiling 2 Java sources to /Users/myfear/projects/first-lagom/hellostream-impl/target/scala-2.11/classes...
[info] Compiling 6 Java sources to /Users/myfear/projects/first-lagom/helloworld-impl/target/scala-2.11/classes...
[info] application - Signalled start to ConductR
[info] application - Signalled start to ConductR
[info] Service hellostream-impl listening for HTTP on 0:0:0:0:0:0:0:0:26230
[info] Service helloworld-impl listening for HTTP on 0:0:0:0:0:0:0:0:24266
[info] (Services started, use Ctrl+D to stop and go back to the console...)
Now go and try out your first service by visiting http://localhost:9000/api/hello/World. Now you're all set for the next blog posts, where I am going to walk you through the example in more detail. If you can't wait, go ahead and read in the Lagom Getting Started guide.

Thursday, March 24, 2016

Free Mini Book about Reactive Microservices

15:06 Thursday, March 24, 2016 Posted by Markus Eisele
, ,
Working with and talking about microservices has been my focus for a while already. And since I started working at Lightbend I already had the pleasure to work with some amazing people. One of them is Jonas Bonér and it has been a real pleasure helping with the creation of this little mini book about reactive microservices. Many of the concepts described in this book are the foundation for our newly open source microservices framework Lagom. It makes getting started into the world of JVM based microservices and reactive systems and introduces all the important aspects that you should have a brief understanding about.

And the best part is, that it is available for free at lightbend.com.

Written for architects and developers that must quickly gain a fundamental understanding of microservice-based architectures, this free O’Reilly report explores the journey from SOA to microservices, discusses approaches to dismantling your monolith, and reviews the key tenets of a Reactive microservice:

  • Isolate all the Things
  • Act Autonomously
  • Do One Thing, and Do It Well
  • Own Your State, Exclusively
  • Embrace Asynchronous Message-Passing
  • Stay Mobile, but Addressable
  • Collaborate as Systems to Solve Problems

And here is the full abstract:
Still chugging along with a monolithic enterprise system that’s difficult to scale and maintain, and even harder to understand? In this concise report, Lightbend CTO Jonas Bonér explains why microservice-based architecture that consists of small, independent services is far more flexible than the traditional all-in-one systems that continue to dominate today’s enterprise landscape.

Reactive Microservices Architecture Download
You’ll explore a microservice architecture, based on Reactive principles, for building an isolated service that’s scalable, resilient to failure, and combines with other services to form a cohesive whole. Specifically, you’ll learn how a Reactive microservice isolates everything (including failure), acts autonomously, does one thing well, owns state exclusively, embraces asynchronous message passing, and maintains mobility.

Bonér also demonstrates how Reactive microservices communicate and collaborate with other services to solve problems. Get a copy of this exclusive report and find out how to bring your enterprise system into the 21st century.

Jonas Bonér is Founder and CTO of Lightbend, inventor of the Akka project, co-author of the Reactive Manifesto and a Java Champion. Learn more at: http://jonasboner.com.

Friday, March 11, 2016

Review: "Learning Akka" by Jason Goodwin

08:43 Friday, March 11, 2016 Posted by Markus Eisele
, , ,
Haven't done a review in a while. It's time to dive a little deeper into the technical portfolio of Lightbend. Today it is Akka. A book with this title is the ideal start with a new technology in general. And for all my Java readers: Rest assured, that all examples in this book are in Java 8 (and in Scala).
A big "Thank you!" to Packt Publishing who provided the book to me for review.

Abstract
Software today has to work with more data, more users, more cores, and more servers than ever. Akka is a distributed computing toolkit that enables developers to build correct concurrent and distributed applications using Java and Scala with ease, applications that scale across servers and respond to failure by self-healing. As well as simplifying development, Akka enables multiple concurrency development patterns with particular support and architecture derived from Erlang’s concept of actors (lightweight concurrent entities). Akka is written in Scala, which has become the programming language of choice for development on the Akka platform.

Learning Akka aims to be a comprehensive walkthrough of Akka. This book will take you on a journey through all the concepts of Akka that you need in order to get started with concurrent and distributed applications and even build your own.

Beginning with the concept of Actors, the book will take you through concurrency in Akka. Moving on to networked applications, this book will explain the common pitfalls in these difficult problem areas while teaching you how to use Akka to overcome these problems with ease.

The book is an easy to follow example-based guide that will strengthen your basic knowledge of Akka and aid you in applying the same to real-world scenarios.

Book: "Learning Akka"
Language : English
Paperback: 274 pages
Release Date : 30. Dezember 2015
ISBN-10: 1784393002
ISBN-13: 978-1784393007

The Author
Jason Goodwin (GitHub: jasongoodwin) is a developer who is primarily self-taught. His entrepreneurial spirit led him to study business at school, but he started programming when he was 15 and always had a high level of interest in technology. This interest led his career to take a few major changes away from the business side and back into software development. His journey has led him to working on high-scale distributed systems. He likes to create electronic music in his free time.

He was first introduced to an Akka project at a Scala/Akka shop—mDialog—that built video ad insertion software for major publishers. The company was acquired by Google eventually. He has also been an influential technologist in introducing Akka to a major Canadian telco to help them serve their customers with more resilient and responsive software. He has experience of teaching Akka and functional and concurrent programming concepts to small teams there. He is currently working via Adecco at Google.

The Content
Take all the preface, index and praises away you end up with 216 pages of plain content. Divided into nine chapters.
Chapter 1: Starting Life as an Actor gives an introduction to the Akka Toolkit and Actor Model in general. It covers everything you need to know to get started including the setup of the development environment.
Chapter 2: Actors and Concurrency introduces you to the reactive design approach. The anatomy of, creation of, and communication with an actor together with the tools and knowledge necessary to deal with asynchronous responses and how to work with Futures—place-holders of results.
Chapter 3: Getting the Message Across helps you to understand the details of message delivery mechanisms in Akka. That includes different messaging patterns.
Chapter 4: Actor Lifecycle – Handling State and Failure introduces you to the actor's life cycle and explains what happens when an actor encounters an exceptional state and how you can change its state to modify its behaviour.
Chapter 5: Scaling Up guides you through how Akka can help us scale up more easily to make better use of our hardware, with very little effort.
Chapter 6: Successfully Scaling Out – Clustering comes in handy, when you reach the physical limits of a single machine. Learn what happens when you reach the limit of a physical host and need to process the work across multiple machines.
Chapter 7: Handling Mailbox Problems digs deeper into what happens when you start to hit the limits of your actor system and how to describe how your system should behave in those situations.
Chapter 8: Testing and Design examines some general approaches to design and testing in greater detail.
Chapter 9: A Journey's End highlights a few outstanding features and modules that you may want to be aware of, and some next steps.

Writing and Style
The author thoughtfully explored all the content in every chapter and created a great resource for everybody who wants to start with the Akka toolkit. Sentences are a little longer from time to time and it is a technical book but absolutely readable also for non native speakers.
Every chapter includes links to further resources and a little homework for you to do. Testing and test-design is covered in a separate chapter but also present in code samples throughout the complete book.

Conclusion and recommendation
This book attempts to give both the introductory reader and the intermediate or advanced reader an understanding of basic distributed computing concepts as well as demonstrates how to use Akka to build fault-tolerant horizontally-scalable distributed applications that communicate over a network. With all the examples being present in both languages (Java 8 and Scala) it is the ideal entry for a Java developer to dive into Akka and get a first idea about the concepts. It does not simply copy the documentation and covers many of the important topics and approaches you should understand to successfully build applications with Akka. But be aware that this book only gets you up to speed quickly. To fully understand the toolkit you should follow the further reading advices at the end of each chapter. Don't forget to use the above codes to get 50% off the eBook or 25% off the printed edition. Because the recommendation is to buy it!

Thursday, March 10, 2016

Microservices trouble? Lagom is here to help. Try it!

09:55 Thursday, March 10, 2016 Posted by Markus Eisele
, ,
The cake is backed. We're proud to announce that the new Apache licensed microservice framework Lagom is available on GitHub! While other frameworks focus on packaging and instance startup, Lagom redefines the way that Java developers build microservice based applications. Services are asynchronous. Intra-service communication is managed for you. Streaming is out of the box. Your microservices are resilient by nature. And you can program in the language you love the most: Java.

What is Lagom? And what does Lagom mean?
Lagom (pronounced [ˈlɑ̀ːɡɔm]) is a Swedish word meaning just right, sufficient. And as such it will help you build microservice based applications in an easier way. Instead of having to find your own answers to how to effectively develop, debug and run tens of different services on your machine you can finally focus on what really is important: The implemented business logic. Lagom takes care for all of the rest for you and eventually helps you to stage and run your application in production. The design is based on three main principles:
  1. Is asynchronous by default.
  2. Favours distributed persistent patterns, in contrast to the traditional centralised database.
  3. Places a high emphasis on developer productivity.

How do I get started?
Read through the quick setup documentation and watch the 11 minute getting started video by
Mirco Dotta who shows you that development is already familiar: Use your favorite IDE and favorite dependency injection tools. You leverage the old to build something new.

How can you give feedback?
That is easy. We're open source and have a couple of channels you can use to get in touch with the project. Start with subscribing to the mailing-list and reach out to us on the Gitter Lagom chat. We're also monitoring questions on StackOverflow which are tagged with Lagom.
And don't forget to follow @Lagom on twitter for latest information

Further Resources:

Wednesday, February 24, 2016

Taking off the red fedora. Hello Lightbend!

07:00 Wednesday, February 24, 2016 Posted by Markus Eisele
,
Almost two years in Red Hat JBoss Middleware have been a tremendous journey for me. Getting to know so many amazing and gifted people to work with in all kinds of Java EE and integration products and projects really made me realize there is far more talent in open source communities than anywhere else.
You’ve known and seen me at different conferences and Java User Groups meetups or read my blogs or are following me on Twitter. While I've been talking about middleware for many years you’ll continue to hear me talk about enterprise grade Java going forward. Focused on education about the latest trends in building enterprise systems in a reactive way with Java.

And as such I'm very happy to announce, that I am joining Lightbend as of March 1st as their new Developer Advocate. Follow +Lightbend and @Lightbend The importance of Java and the need to build today's enterprise grade systems differently will both be a big part of my future topics. If you have particular wishes and questions already, I'm happy to answer them via my Twitter handle @myfear, comment on my blog or maybe in a complete blogpost.

My journey into containers and microservices architectures will also continue. Going forward I will continue to educate more about how microservices architectures can integrate and complement existing platforms, and will also talk about how to successfully build resilient applications with Java.

I have looked in the mirror every morning and asked myself: "If today were the last day of my life, would I want to do what I am about to do today?" And whenever the answer has been "No" for too many days in a row, I know I need to change something.
Steve Jobs 

Make sure to subscribe to JBoss Weekly and @jbossdeveloper for latest updates about JBoss or to @rhdevelopers to learn all about the Red Hat Developers Program.

Wednesday, January 20, 2016

Running Any Docker Image On OpenShift Origin

16:07 Wednesday, January 20, 2016 Posted by Markus Eisele
, ,
I've been using OpenShift since a while now. For many reasons. First of all, I don't want to build my own Docker and Kubernetes environment on Windows and second of all, because I like the simple installation. After the Christmas holidays I decided to upgrade my machine to Windows 10. While I like the look and feel, it broke quite a bit of networking and container installments including the Docker and OpenShift environments. Now that I have everything up and running again, it is time to follow the microserivces path a little more. The first thing is to actually get OpenShift up and running and get a development environment setup in which we can simply push Docker images to it without having to use any of the Source-2-Image or OpenShift build mechanisms.

Installing the all-in-one-VM
Download the all-in-one-vm image and import it into the vagrant box. This image is based off of OpenShift Origin and is a fully functioning OpenShift instance with an integrated Docker registry. The intent of this project is to allow Web developers and other interested parties to run OpenShift V3 on their own computer. Given the way it is configured, the VM will appear to your local machine as if it was running somewhere off the machine. Which is exactly what I need to show you around in OpenShift and introduce some more features. If you need a little more assistance follow the method 2 in this earlier blog-post.
I also assume, that you have docker-machine running. You can install it via the Docker Toolbox.

First steps in OpenShift
Fire up the magazine via vagrant up and redirect you browser to https://localhost:8443/. Accept the certificate warning and enter admin/admin as login. You're now browsing through the admin console. Let's create a new project to play around with:
oc login https://localhost:8443
# enter admin/admin as the credentials

oc new-project myfear --description="Testing random Docker Images on OpenShift" --display-name="Myfears test project"

# Add admin role to user myfear
oc policy add-role-to-user myfear admin -n myfear
First thing to do is to actually get a MySql database up and running. I want to use that in subsequent blog-posts and it's a good test to see if everything is working. Get the two json files from the my github repository and execute the following commands:
oc create -f mysql-pod.json
oc create -f mysql-service.json
Go back to your browser and select the myfear project and see the mysql service up and running with one pod.

Using the OpenShift Registry
You just witnessed how OpenShift pulled the mysql image and started a pod with a container on it. Obviously this image came from the built in registry. But how can one actually upload a docker image to the internal OpenShift registry? Ssh into the vagrant machine and look around a bit:
vagrant ssh
docker ps
You see a lot of running containers and one of them is running the openshift/openshift-registry-proxy. This little gem actually forwards the port 5000 from the internal docker registry to the vagrant vm. Open Virtualbox and look at the port forwarding rules there. Another rule forwards port 5000 from the guest to the host. This means, the internal OpenShift Docker registry is already exposed by default. But how do we push something there? The docker client requires a docker host to work. The OpenShift Docker Daemon isn't exposed externally and you can't just point your docker client to it.
This means, you need another docker host on your machine which is configured to access the OpenShift docker registry as external registry. I'm using docker-machine here, because it is extremely easy to create new docker hosts with it.
docker-machine create -d virtualbox dev
After a couple of seconds your "dev" vm is created and started. Now we need to find out, what the host system's IP address is from the dev box. Ssh into the machine and get the ip of the default gateway:
docker-machine ssh dev
$ ip route | grep default

> 10.0.0.2
Now we need to stop the machine and add the ip address we found to the insecure registry part of the configuration:
docker-machine stop dev
edit  ~/.docker/machine/machines/default/config.json 
# Add the found ip address plus the registry port to the HostOptions => EngineOptions =>  InsecureRegistry array
Afterwards it should look like this:
 "InsecureRegistry": [
                "10.0.2.2:5000"
   ]
time to re-start the dev vm and get the docker client configured for it:
docker-machine start dev
FOR /f "tokens=*" %i IN ('docker-machine env dev --shell cmd') DO %i
That's it for now. One important thing is, that the internal registry is secured and we need to login to it. Get the login token for the user "myfear" with the following commands:
oc login -u myfear
oc whoami -t
This will return something cryptic like: dV2Dep7vP8pJTxNGk5oNJuqXdPbdznHrxy5_7MZ4KFY. Now login to the registry:
docker login -u myfear -p dV2Dep7vP8pJTxNGk5oNJuqXdPbdznHrxy5_7MZ4KFY -e markus@someemail.org 10.0.2.2:5000
Make sure to use the correct username and token. You get a success message with and your login credentials are being saved in the central config.json.

Build and push the custom image
Time to finally build the custom image and push it. I am using Roland's docker maven plugin again.
If you want to learn more about it, there is an older blog-post about it. Also find the code in this github repository. Compare the pom.xml and make sure to update the docker.host and docker.registry properties
  <docker.host>tcp://192.168.99.101:2376</docker.host>
  <docker.registry>10.0.2.2:5000</docker.registry>
and the <authConfig> section with the correct credentials. Build the image with:
mvn clean install docker:build docker:push
If you ran into an issue with the maven plugin not being able to build the image, you may need to pull the jboss/base-jdk:8 image manually first:
docker pull jboss/base-jdk:8
Let's check, if the image is successfully uploaded by using the console and navigating to the overview => image streams page.
And in fact, the image is listed. Now, we need to start a container with it and expose the service to the world:
oc new-app swarm-sample-discovery:latest --name=swarm
oc expose service swarm --hostname=swarm-sample-discovery.local
Please make sure to add the hostname mapping to your hosts or dns configuration (to 127.0.0.1). As you can see, I am no longer using the docker image tag but the image stream name. OpenShift converted this internally.
Time to access the example via the browser http://swarm-sample-discovery.local:1080/rs/customer.
If you're wondering about the port go back to the Virtualbox configuration and check the nat section. The all on one vm actually assumes, that you have something running on port 80 already and maps the vm ports to the 1080 host port.
The application does very little for now, but I will use this in subsequent blog-posts to dig a little into service discovery options.
The console overview shows the two services with one pod each.


That's it for today. Thanks again to Roland for his help with this. Let me know, if you run into issues and if you want to know something else about OpenShift and custom images.