Git Product home page Git Product logo

developing-microservices's Introduction

nearform

Developing Microservices

This workshop will walk you through creating and composing a set of microservices using docker and docker-compose.

Note: This is an intermediate level workshop. You should be comfortable with creating node.js modules and applications. A basic understanding of docker and it's principles is also recommended.

The app

The app you're building is a sensor fed chart that provides realtime data from a dummy sensor. This 'app' is broken down into a number of individually deployed containers, each with its own well defined concern.

Frontend

A simple web app that uses JQuery, Rickshaw charts, and WebSockets to show a realtime graph of data being emitted by our sensor. This app has an API which is included in the same microservice who's sole job is to talk to and read from other microservices.

Actuator

A small microservice that causes reads on the sensor based on an offset.

Sensor

A dummy temperature sensor that sends out varying values based on what it receives from the actuator.

Serialisation

A service that handles reads and writes in serial fashion to the database. Uses websocket-stream to update the web app and thus the graph, in real time.

Broker

A robust messaging layer build for IoT based devices. We use this to wire up the actuator, serialiser and sensor in a loosely coupled fashion.

Influx

A database in a container that the serialiser uses for robust storage of data.

The libraries

Rickshaw Charts

A charting library for the web.

http://code.shutterstock.com/rickshaw/

Express

A HTTP Web server library.

http://expressjs.com/

websocket-stream

A web socket streams implementation for realtime communication to the browser.

https://www.npmjs.com/package/websocket-stream

browserify

A module to let you require modules client side by bundling up dependencies.

http://browserify.org/

Seneca

A pattern matching Microservices library.

http://senecajs.org/

Mosca / MQTT

An MQTT broker that enables robust message, particularly suited to IoT.

https://github.com/mcollina/mosca

InfluxDB

A time series database particularly suited to time sensitive data.

https://influxdb.com/

Docker

A container engine.

https://www.docker.com

Setting up

To complete this workshop you will need both the offical node image as well as the InfluxDB image. These can be pulled from Docker Hub or via a usb key if applicable.

1 - docker-machine start default

Start your default machine

2 - eval "$(docker-machine env default)"

Add the correct env variables to your shell

3 - docker ps

Confirm that docker is available to use.

4 - docker import node.tar node

Import the offical node image.

5 -docker import influx.tar tutum/influxdb

Import the influx db image.

6 - docker images

Confirm that you have both influx and node.

Docker command cheatsheet

We have included a set of common commands for docker and docker machine, including a short decscription of what they do below.

eval "$(docker-machine env NAME)"

Sets up your current shell with the variables from docker-machine env NAME.

docker import < FILENAME

Imports a tarball (or other file) image into docker.

docker ps

Lists all of your containers.

docker images

Lists all of your images, these are the building blocks for your containers.

docker-machine start NAME

Starts your docker virtual machine (only applicable to non Linux).

docker-machine stop NAME

Stops your docker virtual machine (only applicable to non Linux).

docker-machine env NAME

Lists the needed ENV variables needed to connect to your virtual machine.

eval "$(docker-machine env NAME)"

Sets up your current shell with the variables from docker-machine env NAME.

docker-machine ip

Will return the ip address your docker machine is running on.

docker ps -q | xargs docker stop

Will stop all running containers based on the list from docker ps.

docker-compose build

Will compose your services together based off a root docker-compose.yml file.

docker-compose up

Runs your composed services (asumming you are in the correct directory.

For a full cheatsheet on docker please see the Docker Cheat Sheet repo.

Need Help

developing-microservices's People

Contributors

geek avatar mcdonnelldean avatar mcollina avatar pelger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

developing-microservices's Issues

Rename the lib

@mcollina @pelger

I'd like to rename this repo to reflect the workshop name developing-microservices. What would the fallout of this be? I've updated the banner and that, I'm just trying to tie everything together.

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.