Giter Club home page Giter Club logo

events-breakfast-demo's Introduction

๐Ÿฅž eggybytes/events-breakfast-demo ๐Ÿฅž

An example of two microservice architectures: a synchronous, coupled request/response approach and an asynchronous, less-coupled event-driven approach.

See the corresponding blog post/talk for more detail on why/how this exists.

Tools needed

Set up bazelisk:

brew tap bazelbuild/tap
brew install bazelisk

Verify that bazel points to bazelisk:

$ which bazel
/usr/local/bin/bazel
melinda at mmbp in ~/events on ml-add-bazel*
$ ls -l /usr/local/bin/bazel
lrwxr-xr-x  1 melinda  admin  34 May  11 11:33 /usr/local/bin/bazel -> ../Cellar/bazelisk/1.6.1/bin/bazel

Minikube setup

Install minikube, make Hyperkit the default driver, and give it more than the default amount of RAM:

brew install minikube
minikube config set driver hyperkit
minikube config set memory 2048 # 2 GB

To start minikube:

minikube start

To stop minikube:

minikube stop

Frontend tools

Install Yarn and Node if you don't have them.

How to build and run

Deploy Kafka to minikube

This deploys a clean version (nothing specific to this demo) of Kafka and Zookeeper to Kubernetes.

kubectl apply -f deployments/kafka.yaml

Create our Kafka topic

kubectl exec -it kafka-0 -- bash
# from kafka/local/topics.sh
/opt/kafka/bin/kafka-topics.sh --create --partitions 2 --replication-factor 1 --zookeeper zookeeper:2181 --topic order.order

Run the synchronous version of the microservices

bazel run //go/services/order-sync:api
bazel run //go/services/payment:api
bazel run //go/services/delivery:api

Run the asynchronous version of the microservices

bazel run //go/services/order-async:api
bazel run //go/workers/payment:worker
bazel run //go/workers/delivery:worker

Build the webapp

To build e.g. the breakfast-webapp app (and rebuild on every relevant file change):

yarn build --watch

Serve the webapp

To actually serve the breakfast-webapp app (won't work unless you build first):

yarn start

Clean up and destroy everything

minikube delete

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.