Code Monkey home page Code Monkey logo

decisionapp's Introduction

This repository contains a simple Python app exposing a REST API /decisions returning random strings from a predefined selection, as well as the minimum necessary further configuration in order to achieve the following requirements:

  • Means to automatically build (and test) Application containers
  • CI/CD pipeline, courtesy of Github Actions, that builds, tests, and deploys new images to DockerHub
  • High availability deployment to a Kubernetes cluster
  • Automatically update the Kubernetes deployment whenever a new image is published to DockerHub by CI/CD

Furthermore, to showcase using the App, there is a simple decision-pipeline that:

  • Periodically queries the deployment,
  • Logs the data retrieved from the decision API.

The remainder of this document discusses the recommended way of setting up this repository and running it locally for testing. For details regarding app-decision, visit the corresponding directory..

Getting started

A Kubernetes cluster is required for running the platform. For testing purposes, set up a Kubernetes cluster on your local machine, for example using kind.

For the functionality of updating the Deployment of app-decision whenever a new image appears on DockerHub, install the keel Kubernetes operator that automates this. The easiest way is using helm:

helm repo add keel https://charts.keel.sh 
helm repo update
helm upgrade --install keel --namespace=kube-system keel/keel

Once the Kubernetes cluster and the keel Operator are installed, apply the following yaml file to create the Deployment of our decision-app, including a Service to expose it internally:

kubectl apply -f deployment-app-decision.yaml

You may verify using kubectl get pods that the deployment, with initially three replicas, is coming online as expected.

CI/CD

CI/CD is here on Github actions, defined through this file. This is a very simplified version of a pipeline that we might have triggered by pushes to the main branch or executed when pull requests are opened. The CI/CD builds and tests the Docker Image, and when that is successful, pushes a new :latest tag to Dockerhub, as well as a 0.0.x tag that is continually incremented. The latter tag is then used by keel to detect a new image has appeared and to subsequently rollout a new deployment revision to the cluster.

Executing the decision pipeline

To execute the decision pipeline, submit the script to the cluster by running

kubectl apply -f decision-pipeline.yaml

You can now watch the random decisions returned from the endpoint by executing:

kubectl logs decision-pipeline -f

decisionapp's People

Contributors

georggrab avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.