Code Monkey home page Code Monkey logo

simple_voting_app's Introduction

Voting Application

voting diagram

How to Run

To start up the stack on a single machine in the application repo directory run the following: docker-compose up

or from a directory outside of the repo use docker-compose -f <path to compose file> up

The docker compose file is made for running the stack all on one machine for demonstration purposes. However all the components are can be ran on a cluster as a distributed system.

This has been tested against docker server >=1.12 and docker-compose 1.11. The compose file is a version 3 file.

Accessing the application

The voting page can be reached via http://localhost/vote. However the domain name can be whatever you prefer as the front end is configured to listen to any domain. To see the results go to http://localhost/results.

Design

The infrascture for this application includes the following components Implemented as containers.

  • Ingress reverse Proxy

    ​ — nginx

  • service discovery system and key value store independent of applications ran on cluster.

    ​ — consul

  • service discovery registration

    ​ — registrator

  • the application itself including data store

Ingress Reverse Proxy

For the ingress traffic routing Nginx is being used. The container is based off of nginx 1.11 with dynamic re-configuration tools. Nginx conf files will be gernated by confd when changes occur in consul. Confd uses templates for the conf files then populates values based on those it fetches from consul.

Service Discovery

Conusl is being used for service discovery in this scenario. Consul provides dns services as well as healthchecks for any services registered with it. The health checks ensure that a dns entry is not created, and entred in to the load balancing pool until the service is healthy. The services will also be removed from load balancing if they become unhealthy. The consul container should be ran on every node of the cluster. The UI for consul can be viewed at http://localhost:8500

Service Resgistration

Containers are registered witih consul through registrator. Registrator runs on all hosts and listens to the docker.sock file for container start and stops and registers and de-registers accordingly. This also provides health check rules to consul via labels in the docker image or specified at run time.

Links to software used

confd - https://github.com/kelseyhightower/confd

consul - https://www.consul.io

registrator - https://github.com/gliderlabs/registrator

nginx http://nginx.org


Voting Service

This service is a Node JS service written with Hapi JS. This is where the user goes to vote. It takes care of writing the votes to the database.

Result Service

This service is a Python 2 flask service. It takes care of visualizing the results to the user.

Database

This application uses Redis as its backing data store.

simple_voting_app's People

Contributors

jpweber avatar sapanshah avatar

Watchers

 avatar  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.