Giter Site home page Giter Site logo

chansongjo / events-breakfast-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eggybytes/events-breakfast-demo

0.0 1.0 0.0 193 KB

Demo to go with https://eggybits.com/posts/events-first ๐Ÿณ๐Ÿฅž

Home Page: https://eggybits.com/posts/events-first

Starlark 15.97% Go 21.31% Shell 0.33% JavaScript 23.07% TypeScript 37.82% CSS 0.21% Dockerfile 1.30%

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.

For more:

Contents

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.

Then install the dependencies for the frontend app:

# from the js/ directory
yarn install

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 the breakfast-webapp app:

# from the js/ directory
yarn build

Serve the webapp

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

# from the js/ directory
yarn start

Clean up and destroy everything

minikube delete

events-breakfast-demo's People

Contributors

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