Skip to content

MEDCOMP/peas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Peas

Setup

We are using an Ubuntu 14.04 machine with 3.19.0-47-generic kernel on an HP Z820 workstation

Requirements

  • Docker
  • Minikube

Installation

Installing Docker

$ sudo apt-get install -y --no-install-recommends \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
$ curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
$ sudo add-apt-repository \
       "deb https://apt.dockerproject.org/repo/ \
       ubuntu-$(lsb_release -cs) \
       main"
$ sudo apt-get update
$ sudo apt-get -y install docker-engine

Installing Minikube

Minikube installation requires VirtualBox which can be downloaded and installed from http://download.virtualbox.org/virtualbox/5.1.14/virtualbox-5.1_5.1.14-112924~Ubuntu~trusty_amd64.deb

Install Kubectl

curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.2/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

Next, we can go ahead and install Minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.16.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

To make it available directly from your shell

sudo mv minikube /usr/local/bin

Starting docker and minikube

Starting the docker service

sudo service docker start

Starting Minikube

minikube start

Associating docker with minikube

eval $(minikube docker-env --shell=sh)

To test minikube you can try:

kubectl get pods

You show see an empty response

Pea deployment

File structure

  • dockerfile: The dockerfile specifies the container definition for the pea.
NOTE: Don't forget to expose the server port in the dockerfile, else minikube won't be able to identify the port to watch.
  • deployment.yaml: The deployment file contains the kubernetes deployment definition. Here you can specify the docker image to use (created using the aforementioned dockerfile) for the kubernetes pods, the replica set properties and other tags describing the deployment

  • action.py: The action file contains the Mistral action definition file, in order to deploy the pea service as a Mistral action to be used in Mistral workflows (Peapods)

  • /app: This is the container app folder which contains the server logic for the pea

Deployment of pea

Build docker image

cd peas/normalization/
docker build -t normalization-pea:v1 .

The pea deployment stage has 2 steps: Creating a deployment and Exposing the deployment as a service, they are done as follows:

kubectl create -f deployment.yaml
kubectl expose deployment pea-deployment --type=NodePort

The type NodePort makes the service available locally within the cluster and doesn't expose it to a public IP, for that, use the type LoadBalancer

Testing the pea

You can test the normalization pea using the following command:

 curl -H "Content-Type: application/json" -X POST -d "{\"array\":[1,2,5]}" <PEA ADDRESS>

The response should look like:

{
  "result": [
    0.0, 
    0.25, 
    1.0
  ], 
  "status": "ok"
}

You can obtain the PEA ADDRESS as follows:

minikube service pea-deployment --url

About

All the peas available for peapod

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages