Giter Site home page Giter Site logo

nodevoto's Introduction

Node.js' emojivoto with gifs instead emoji (nodevoto)

Build Status

A microservice application that allows users to vote for their favorite gif, and tracks votes received on a leaderboard. May the best gif win.

The application is composed of the following 3 services:

Nodevoto Topology

Running

In Minikube

Deploy the application to Minikube using the Linkerd2 service mesh.

  1. Install the linkerd CLI
curl https://run.linkerd.io/install | sh
  1. Install Linkerd2
linkerd install | kubectl apply -f -
  1. View the dashboard!
linkerd dashboard
  1. Inject, Deploy, and Enjoy
linkerd inject nodevoto.yml | kubectl apply -f -
  1. Use the app!
minikube -n nodevoto service web-svc

Generating some traffic

The VoteBot service can generate some traffic for you. It votes on gif "randomly" as follows:

  • It votes for :disney-puppy-puppies-national-day-UTuy9luZStALS: 15% of the time.
  • It votes for :cartoon-halloween-ghost-aTf4PONtSYB1e: 20% of the time.
  • When not voting for either of the above, it picks an gif at random

If you're running the app using the instructions above, the VoteBot will have been deployed and will start sending traffic to the vote endpoint.

If you'd like to run the bot manually:

export WEB_HOST=localhost:8080 # replace with your web location
npm run voteBot

Local Development

Nodevoto webapp

This app is written with React and bundled with webpack. Use the following to run the nodevoto go services and develop on the frontend.

Install npm dependencies

npm install .

Start the voting service

GRPC_PORT=8081 npm run voting

[In a separate teminal window] Start the gif service

GRPC_PORT=8082 npm run gif

[In a separate teminal window] Bundle the frontend assets

cd nodevoto-web/webapp
yarn install
yarn webpack # one time asset-bundling OR
yarn webpack-dev-server --port 8083 # bundle/serve reloading assets

[In a separate teminal window] Start the web service

export WEB_PORT=8080
export VOTINGSVC_HOST=localhost:8081
export GIFSVC_HOST=localhost:8082

# if you ran yarn webpack
export INDEX_BUNDLE=services/nodevoto-web/webapp/dist/index_bundle.js

# if you ran yarn webpack-dev-server
export WEBPACK_DEV_SERVER=http://localhost:8083

# start the webserver
npm run web

[Optional] Start the vote bot for automatic traffic generation.

export WEB_HOST=localhost:8080
npm run voteBot

nodevoto's People

Contributors

sourishkrout avatar leonjalfon1 avatar

Watchers

James Cloos 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.