In this tutorial, I’ll walk you through creating a stateful, microservices based application
that uses Oracle Coherence CE as a scalable
embedded data store, and Micronaut Framework as an
Ultimately, the application we’re building is an online store that sells socks, and is based
on the SockShop Microservices Demo
originally written and
published under Apache 2.0 license by Weaveworks.
You can see a working demo of the original application here.
This demo still uses the original front end implementation provided by Weaveworks, but all
back end services
have been re-implemented from scratch using Micronaut Framework and Oracle Coherence in
order to showcase
the many features of the Coherence
We also provide the implementations of the same application that uses Spring Boot or Helidon
as the application framework, in case one of those is your framework of choice.
Remember that you can always sign up for free with OCI! Your Oracle Cloud account provides a
number of Always
Free services and a Free Trial with US$300 of free credit to use on all eligible OCI
services for up to 30
days. These Always Free services are available for an unlimited period of
time. The Free
Trial services may be used until your US$300 of free credits are consumed or the 30 days has
whichever comes first. You can sign
up here for free.
The application consists of six back end services (rewritten from the ground up on top of
implementing the API that the legacy front-end
Find more details for each service by following these links:
Catalog, which provides REST API that allows you to search
product catalog and
retrieve individual product details;
Cart, which provides REST API that allows you to manage
which provides REST API that allows customers to place orders;
which provides REST API that allows you to process payments;
which provides REST API that allows you to ship orders and track shipments;
which provides REST API that allows you to manage customer information and provides
authentication functionality for the customers.
The main Sock
repository also contains Kubernetes deployment files for the whole application, top-level
POM file which
allows you to easily build the whole project and import it into your favorite IDE.
Kubernetes scripts depend on Kustomize, so make sure that you have a newer version of kubectl that supports it (at least
1.16 or above).
The easiest way to try the demo is to use the Kubernetes deployment scripts from this repo.
If you do, you can simply run the following command from the coherence-micronaut-sockshop-sample
The -k parameter above will use
kubectl with kustomize to merge all the files
under the specified
directory and create all Kubernetes resources defined by them, such as deployments and
services for each
(Optional) Install the Original
WeaveSocks Front End
Warning: The original WeaveSocks Front End has a few bugs, as well as some security
issues, and it hasn’t
been actively maintained for a few years. However, if you want to deploy it nevertheless
to see how it
interacts with our back-end services, please follow the steps below.
Install the front-end service by
$ for name in carts catalog orders payment shipping users
do kubectl --namespace sockshop scale coherence $name--replicas=3
Complete Application Deployment
The Quick Start shows how you can run the application locally, but that may not be enough if
you want to
experiment with scaling individual services. Look at tracing data in Jaeger, monitor
services via Prometheus
and Grafana, or make API calls directly using Swagger UI.
To do all of the above, you need to deploy the services into a managed Kubernetes cluster in
the cloud, by
following the same set of steps described above (except for port forwarding, which is not
performing a few additional steps.