Skip to content

lightbend/akka-grpc-ddata-shopping-cart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akka gRPC ddata shopping cart

This is a shopping cart implemented using Akka distributed data (CRDTs). It takes the Akka Distributed Data Highly Available Shopping Cart, and places a gRPC interface in front of it.

It configures the cluster formation using instructions found at the Lightbend OpenShift deployment guide.

What does this demonstrate?

This project demonstrates how Akka Distributed Data can maintain state without a database. It uses Akka Distributed Data to store data across the Akka cluster using CRDTs. As long as at least one node continues to run, the shopping carts will be available, no database is needed. Nodes can be killed, upgraded, whatever.

Running

If you wish to run the service in the default namespace, then simply run the following on your Kubernetes cluster:

kubectl apply -f https://raw.githubusercontent.com/lightbend/akka-grpc-ddata-shopping-cart/master/shopping-cart.yaml -n default

Otherwise, you will need to modify the RBAC role binding in the spec to be the service account to match the namespace you're using, for example, if your namespace is myproject (the default OpenShift namespace), modify the User subject to be:

subjects:
- kind: "User"
  name: "system:serviceaccount:myproject:default"

Then you can apply the resulting spec.

This will start an Akka cluster of 3 nodes, and expose it as a service running on port 80. To find out the IP address of the service:

kubectl get svc shopping-cart

Using

The gRPC protobuf spec can be found here. You can build a client to access it in your favourite language.

A node based client is provided as a helper script that can be loaded into the node REPL for ad-hoc testing. To use it:

cd client
npm install
node

Then in node, run:

.load main.js

to load the client helper. That will output a usage information instructions for how to use the client.

Running in development

To start a two node cluster in development, run:

sbt -Dseed.node.ports=2552,2553 -Dremoting.port=2552 -Dhttp.port=8000 run

And this in another, to start a second node for the cluster:

sbt -Dseed.node.ports=2552,2553 -Dremoting.port=2553 -Dhttp.port=8001 run

License

This software is licensed under the Apache 2 license.

Maintenance notes

This project is NOT supported under the Lightbend subscription.

The project is maintained by the Lightbend Office of the CTO.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published