Code Monkey home page Code Monkey logo

exports-assignment's Introduction

Exports Assignment

Check the assignment and local setup.

Architecture

aws-serverless-image

Design

Reliability

Unfortunately the reliability of this system can only be as reliable as the data of its indirect dependents (system which produces vehicle databases). A simple solution as defining schemas for the collections would help.

In case of corrupted data there could be a new/existing component (in the producer system) which tries to correct data but this comes with the cost of bigger complexity and bigger maintainability.

Also, in case of failure (upload to S3 for example) the system uses the queue nack mechanism as failover.

Availability

MongoDB: Replica Set topology is expected.

RabbitMQ: Cluster with queue mirroring.

In terms of recovery, depending on the framework used, some components may be brought to life automatically. Locally this is emulated with restart: always on docker-compose.

Maintainability

Not assured in this solution but it would pass by setting an alert system (and try to avoid human interaction), error handling, proper logging system, and try to use enterprise features to minimise the overall effort.

Improvements

Something that would help this design is implementing the Chaos Monkey in production as it'd put some pressure on the system.

High testing coverage would give bigger reliability and maintainability (in long-term).

Due to the nature of the source data, the solution has to put all the data in memory - which is not optimal for various reasons. A solution to circumvent that could be either create a huge migration to put vehicles' data all together or create a tool to insert all that data into a different database.

REST API Access Permissions

  • Database: User with "ReadWrite" role to exports.jobs collection;
  • S3: User with AmazonS3ReadOnlyAccess policy (GetObject action);
  • RabbitMQ* User with permission for basic.publish to a specified queue.

Workers Access Permissions

  • Database: User with "Read" role to vehicle databases and "ReadWrite" role to exports.jobs collection;
  • S3: User with PutObject action in an attached S3 policy;
  • RabbitMQ User with permission for basic.consume to a specified queue.

Rest API

Get an Export Job Result;

GET /export/:ID

{
  "_id": "ID",
  "startDate": "DATE",
  "endDate": "DATE",
  "state": "NOT_STARTED | STARTED | FINISHED",
  "exportUri": "STRING"
}

Create an Export Job

POST /export
{ 
    "startDate": "STRING (2018-11-30)",
    "endDate": "STRING (2018-12-01)"
}
status: 202
Location: JOB_URI

exports-assignment's People

Contributors

ricardoharver avatar ricardomiguel avatar sprijk 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.