Open Liberty: A brief history in maker projects of a cloud-native Java runtime
Five years ago, in 2017, IBM published the source code of Liberty, its cloud-native Java runtime, on GitHub as the Open Liberty project. Liberty was actually born five years earlier, in 2012 (we recently celebrated its 10th birthday), to address the need for a small footprint, extensible, and easily configurable Java runtime that could run on the cloud as well as in a data centre. Liberty was designed to provide a friendly experience to developers as well as to be powerful and flexible at runtime.
At the time, Java runtimes were mostly big and serious, but Liberty was different and Liberty’s development team were inspired to make it fun. The crafters and makers in the team got to work on physical projects that used or represented Liberty in creative ways.
The first Java runtime on a Raspberry Pi
Liberty was the first Java runtime to run on a Raspberry Pi. Even before Liberty’s first release, Simon Maple (Liberty’s first developer advocate) and Ozzy Osbourne (not that one; this one) ran Liberty on a pre-release Raspberry Pi, which had just 700 Mhz of processing power and 256 MB of memory. Simon went on to demonstrate Liberty’s applicability to the early Internet of Things by running Liberty and MQTT on a Raspberry Pi to remotely control a smart house 50 miles away.
Running Liberty on a Raspberry Pi and other hardware with limited resources sparked the imaginations of the makers within the development team.
Early Liberty conference demos of Java EE on Liberty
One much-travelled Liberty conference demo was the remote-controlled Liberty Car, the creation of Simon’s successor, Tom Banks (also responsible for creating a Minecraft user interface to Liberty) and Ozzy. Tom replaced the guts of a remote-controlled car with a Raspberry Pi running Liberty plus a WiFi access point.
Any conference attendee could connect and control the car from their own smartphone, demonstrating, among other things, the responsiveness of 2013’s Java EE 7 WebSocket technology. Java EE, not then known for its small, lightweight footprint, ran easily on the limited hardware resources. Tom’s Liberty Car project matured into a conference game where attendees could race multiple Liberty Cars around a large race-track. Tom talks through how it works:
Wearable and throwable infrastructures
Liberty can run with only a tiny footprint, making it friendly to both developer laptops and the cloud. This was enabled by its original OSGi architecture, which meant that any app running on Liberty could start with just minimal capabilities and then add and remove features on the fly at run time as needed by the app, including features of the recently released Java EE 7.
Queen of Enterprise OSGi and the unconventional conference demo, Holly Cummins briefly made wearing a Java runtime as a hat into a thing. She sewed a Raspberry Pi into a chef’s hat and ran Liberty on it. She then wore it when presenting at conferences to show that you can take servers with you to run outside of big data centres, for example in disaster zones or other environments where there isn’t the usual internet infrastructure.
You can find out more from Holly as she talks about her wearable Java runtime:
After a couple of years of sporting a chef’s hat at Enterprise Java conferences, Holly went further with her Java runtime crafting and made a cuddly throwable Java runtime. This was an actual cuddly ball with LEDs and a Raspberry Pi embedded in it. She would throw the ball into the audience part-way through her talk and encourage them to chuck it around the room during her presentations.
Cloud-native Java microservices games
As the industry moved to microservices, Enterprise Java evolved into the more microservices-friendly Eclipse MicroProfile and Eclipse Jakarta EE, for which the Liberty development team are actively involved in developing and implementing specifications. So Liberty crafters and makers moved to building demos with microservice architectures rather than single-server applications. Open Liberty’s new bright space-related branding also lent itself well to 3D-printed spaceships and space-themed games (and a virtual bike racing game).
Space Sentry was a game built by Prashanth Gunapalasingam and Frank Ji on Java microservices. Players controlled a laser that was mounted on top of a 3D-printed spaceship to fire at 3D-printed targets. The movements were handled by Lego and Arduinos that communicated over Wi-Fi with three microservices running in Open Liberty containers on a Raspberry Pi.
The three microservices communicated with each other using REST APIs (JAX-RS and MicroProfile Rest Client), and used other MicroProfile 2.2 features such as MicroProfile Config, MicroProfile Health, and MicroProfile Metrics to configure and monitor the services and to post results on the leaderboard.
The next generation of space-themed microservices-based games came more recently in the form of Space Rover.
Space Rover is a shiny, open source game that has a Java microservices architecture and uses Jakarta EE 9.1 and MicroProfile 5.0 APIs. It has a physical board, made by Ellen Lau from wood and acrylic sheets with LED lights that mark out the asteroids on the board and give feedback when the Space Rover drives over the asteroid and when it completes the level. The 3D-printed Space Rover, also made by Prashanth, runs on a chassis with wheels and it rolls around the board in response to hand gestures captured by a webcam.
Space Rover’s services make extensive use of web sockets to communicate between the components of the game (Jakarta WebSocket 2.0) and other Jakarta EE 9.1 technologies including REST endpoints and HTTP endpoints for communicating with the leaderboard and handling the game statistics (Jakarta JAX-RS 3.0), and database injections for interacting with the leaderboard database (Jakarta CDI 3.0).
MicroProfile 5.0 technologies are used to check the status of the services and database (MicroProfile Health 4.0); to configure connections to different services and database (MicroProfile Config 3.0); to retry connection attempts to the database when there are problems (MicroProfile Fault Tolerance 4.0); to record JVM metrics on the Game service and track the latency of the Game service for the health check test (MicroProfile Metrics 4.0); to generate an HTTP client to send game end statistics to the leaderboard (MicroProfile Rest Client 3.0); and to provide REST API documentation and a UI for demonstration (MicroProfile OpenAPI 3.0).
Ellen, Prashanth, and team take Space Rover to conferences around the world (including Atlanta, Texas, Chicago, UK, and Ireland) where they invite attendees to use hand gestures to drive the Space Rover around the board without running into asteroids.
Inspired by Open Liberty
And finally, Open Liberty has also inspired projects like this Open Liberty logo made by Christopher Regan from wood and acrylic on a laser cutter:
And an Open Liberty mug rug can brighten up your desk and provide somewhere to host your tea and biscuits (or your Java and cookies, if you prefer). If you want to make your own mug rug, you can find the template and some instructions in GitHub.
Liberty today
Open Liberty, the cloud-native Java runtime, celebrates its 5th birthday as an open source project. It continues to be the upstream source for IBM’s commercial Liberty runtime and the development team continues to contribute to and support Eclipse MicroProfile, Eclipse Jakarta EE, Eclipse OpenJ9, and other related open source projects.
Liberty’s crafters and makers will no doubt continue to develop creative new ideas alongside their day jobs. If you have created something of your own (like Roberto and his son who monitored their lizard enclosure using Liberty), let us know!
If you would like to learn more about Liberty, try our guides.
All photos were taken by Laura Cowen unless otherwise noted.