Skip to content

Kalimaha/event-stream-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Stream Playground

I started working on this small spare-time project after attending Fred George's talk: "IoT and MicroServices in the Home". The talk is available on YouTube and it's strongly recommended! Another similar talk is Perryn Fowler's "Microservices and IoT: A Perfect Match", also available on YouTube. More details are available in the blog post I wrote about it, here.

Usage

This repository is composed by a RabbitMQ server (the event stream), and three Rails 5 apps, mimicking a Sales UI, the Warehouse app and a Dashboard. All these components can be managed throught the scripts stored in /bin.

RabbitMQ

This folder contains the Dockerfile and the commands required to build and manage a container with a RabbitMQ server instance.

Build the Container

Docker container is based on Ubuntu 16.04. To build the container run:

./bin/rabbit build

Manage the Container

Once the container has been built, it is possible to run it, stop it, or ask for the status, with:

./bin/rabbit start | stop | status

The start command will try to run the Docker container if this does't exist yet, otherwise it will restart the existing one.

Create a new Admin

RabbitMQ has a management web interface, with no default users enabled. To create a user, simply run:

./bin/rabbit add_user my_username my_password

After that, navigate to http://localhost:15672/ and use the newly created credentials to login.

List of Available Commands

  • build: Build the Docker image
  • start: Run RabbitMQ on http://localhost:15672/
  • stop: Stop RabbitMQ
  • status: Verify the status of RabbitMQ server
  • add_user <USR> <PWD>: Add a new with to the RabbitMQ management console

Rails Apps

Each Rails app is Dockerized through Docker Compose, with a web and a db volume. Apps are managed through the simon_says script, e.g.

./simon_says start sales

will start the main sales app and its DB.

Available Commands

  • start : Starts the
  • initdb : Initialize 's DB
  • resetdb! : Reset 's DB (all existing data will be erased!)
  • sync: Synchronize DB with RabbitMQ history

Available Apps

  • dashboard: Dashboard
  • sales: EdisonCars
  • warehouse: Warehouse