GitHub - orbit/orbit-sample
Orbit Sample App (The Carnival)
This is a sample app to help illustrate the concepts of an Orbit Client application. It simulates a carnival games, players, and prizes!
Getting Started
This sample app will install Orbit Server, its depenedencies, and a client application called Carnival.
Prerequisites
- Minikube or Docker for Desktop
- kubectl Kubernetes Command Line Tools
- Skaffold to easily bring up the environment
- Insomnia or Postman for testing
Set up Kubernetes environment
Minikube
After installing Minikube, start up a new Minikube instance.
To verify your Minikube VM is working, you can use the minikube status command.
> minikube status
m01
host: Running
kubelet: Running
apiserver: Running
kubeconfig: ConfiguredDocker for Desktop
With Docker for Desktop running, open settings and enable Kubernetes.
Kubectl Context and Namespace
We want to assure all the further commands are happening in the right Kubernetes cluster and isolate the project using a namespace. Tp use Docker For Desktop, replace minikube with docker-desktop.
> kubectl config use-context minikube Switched to context "minikube". > kubectl create namespace orbit-carnival namespace/orbit-carnival created > kubectl config set-context --current --namespace=orbit-carnival Context "minikube" modified.
Verify the orbit-carnival namespace is selected in the right context.
> kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE docker-desktop docker-desktop docker-desktop docker-for-desktop docker-desktop docker-desktop * minikube minikube minikube orbit-carnival
Clone the repository
> git clone git@github.com:orbit/orbit-sample.gitRun Skaffold
> skaffold dev --port-forwardTo assure the proper pods are running, you can run kubectl get pod. You should see the pods for the Carnival, Orbit Server, and the Node and Addressable directories.
> kubectl get pod
NAME READY STATUS RESTARTS AGE
orbit-addressable-directory-8666f4fbc6-j6lmz 1/1 Running 0 59s
orbit-carnival-5c6f59bb-kw2zr 1/1 Running 0 59s
orbit-node-directory-bdb45ff8d-g9fjt 1/1 Running 0 59s
orbit-server-78fb97dd58-lx466 1/1 Running 0 59sFun tip: Use the watch command to keep a live view of running containers.
Test
The Carnival test app exposes a REST endpoint for playing the game. By default, the carnival is exposed at http://localhost:8001
| Method | Url | Payload |
|---|---|---|
| GET | /games | |
| GET | /game/{gameId} | |
| GET | /player/{playerId} | |
| POST | /player/{playerId}/play | ex. { "game": "BalloonDarts" } |
One more endpoint exists for load testing by continuously playing games:
| Method | Url | Payload |
|---|---|---|
| POST | /load/play | ex. { "games": 5, "players": 4, "count": 800 } |
To help more easily test the endpoints, you can drive it through a REST request application like Insomnia or Postman. These are some collections to get you started.
- Insomnia collection
- Postman collection