Git Product home page Git Product logo

groeney / streaming-serverless Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 0.0 271 KB

A framework for business automation using change data capture (CDC) and event driven serverless architecture

License: MIT License

Dockerfile 0.39% JavaScript 38.18% HTML 2.67% Vue 21.19% HCL 16.41% Shell 2.41% Python 18.75%
lambda todomvc dynamodb dynamodb-stream localstack terraform terraform-localstack serverless change-data-capture event-driven

streaming-serverless's Introduction


Inspiration

Inspired by this blog and TodoMVC, this tool will leave the reader with an intuitive sense for event-driven systems, how they work and what their benefits are.

As opposed to Apache Kafka where all of the streaming components are packaged up into a platform this tool aims to give you more control of your event-driven system. Using Terraform and your preferred cloud provider, you can add and remove components to suit your needs. The architecture laid out here is production ready and works nicely in most cases.

This tool uses Change Data Capture as the event source and Serverless Architecture as the fundamental design pattern for data processing.


Installation

Prerequisites:

Run ./scripts/setup.sh from the root to install project dependencies


Distillation

Quick start

  • Create dotenv file: dotenv=./.env && cp "$dotenv.example" "$dotenv" && vi $dotenv -- update keys where appropriate (Sendgrid & Twilio)
  • Checkout a version + runtime branch: git checkout v2-py
  • Start stack: grunt start

Tutorial

This tutorial takes inspiration from TodoMVC and extends it by using serverless microservice architecture to send notifications to users when there is a change in there task list.

  • Two versions of the stack.
    • v1: send email notifications on new task
    • v2: send email and sms notifications on new, edit and delete task.
  • For each version there is a python3.6 lambda runtime and node8.10 lambda runtime.
  • Checkout the following branches to see the respective version and runtime:
    • v1-js
    • v2-js
    • v1-py
    • v2-py
  • Note that we set LAMBDA_EXECUTOR=docker-reuse on docker-compose.yaml:32 for these branches. This is for performance gains as LAMBDA_EXECUTOR=docker starts from "cold start" for every invocation.
  • Copy .env.example into .env and replace keys where appropriate
  • Running grunt start will build three services from docker-compose.yml:
    • localstack: mock AWS Cloud services on local. See here
    • client: this is a basic vuejs application inspired by TodoMVC
    • server: simple node + express application for Todo list

For development

  • Running grunt watch:lambda will deploy changes to infrastructure when it detects changes to any lambda file
  • This is nice when for watching the lambda containers: watch -n 1 'docker ps -a | grep lambda'

Git Message Convention

Messages must be matched by the following regex:

/^(revert: )?(feat|fix|style|refactor|chore)(\(.+\))?: .{1,50}/;

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.