Code Monkey home page Code Monkey logo

coincap_monitor's Introduction

CoinCap monitor

ETL pipeline for monitoring cripto curency price and build analytical dashboard based on collected data inside Data Warehouse.

example workflow example workflow

Built with

System diagram

The following system diagram represents the project structure. From the picture, it may be seen that the system is composed from 4 docker containers with following purposes:

  • pipeline performs complete ETL cycle (cron job)
  • warehause contains main storage of cleaned data (Clickhouse)
  • stagedb plays the role of a backup storage for raw data (MongoDB)
  • dashboard generates and shows reports out of cleaned data (Metabase)

Additionally, dashboard uses PostgreSQL database container as its internal storage.

system design

Project Structure

โ”œโ”€โ”€ docs
โ”‚
โ”œโ”€โ”€ pipeline
โ”‚   โ”œโ”€โ”€ cron              # Scheduler configs
โ”‚   โ”œโ”€โ”€ docker            # Environment configs
โ”‚   โ”œโ”€โ”€ logs              # Logs for pipeline service
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ src               # ETL source code
โ”‚   โ”‚   โ”œโ”€โ”€ config.py     # Enviroment parsers
โ”‚   โ”‚   โ”œโ”€โ”€ db.py         # Warehouse management
โ”‚   โ”‚   โ”œโ”€โ”€ etl.py        # ETL functions
โ”‚   โ”‚   โ”œโ”€โ”€ run.py        # Pipeline script
โ”‚   โ”‚   โ””โ”€โ”€ stagedb.py    # StageDB management
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ tests             # Unittests for ETL source code
โ”‚
โ”œโ”€โ”€ warehouse
โ”‚   โ”œโ”€โ”€ db                # Warehouse database files (Clickhouse)
โ”‚   โ””โ”€โ”€ logs              # Logs for warehouse service
โ”‚
โ”œโ”€โ”€ stagedb
โ”‚   โ””โ”€โ”€ db                # StageDB database files (MongoDB)
โ”‚
โ””โ”€โ”€ dashboard
    โ”œโ”€โ”€ db                # Dashboard database files (PostgreSQL)
    โ”œโ”€โ”€ docker            # Environment configs
    โ””โ”€โ”€ logs              # Logs for dashboard service


Installation

To run the project, perform the following steps:

  1. Clone repo to your machine
git clone https://github.com/Genvekt/coincap_monitor.git
cd coincap_monitor
  1. Create .env file with the following envairoment parameters:
  • API_KEY: key that you must retrieve from here

  • API_URL: url to the CoinCap API

  • STAGEDB_HOST, STAGEDB_DB, STAGEDB_USER, STAGEDB_PASSWORD, STAGEDB_PORT: MongoDB access data

  • CLICKHOUSE_HOST, CLICKHOUSE_DB, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_PORT: ClickHouse access data

  • POSTGRES_HOST, POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_PORT: PostgreSQL access data

    Example .env file:

    API_KEY={YOUR_API_KEY}
    API_URL=http://api.coincap.io/v2
    
    
    STAGEDB_HOST=stagedb
    STAGEDB_DB=stagedbdb
    STAGEDB_USER=stagedbuser
    STAGEDB_PASSWORD={YOUR_MONGODB_PASSWORD}
    STAGEDB_PORT=27017
    
    CLICKHOUSE_HOST=warehouse
    CLICKHOUSE_DB=clickhousedb
    CLICKHOUSE_USER=clickhouseuser
    CLICKHOUSE_PASSWORD={YOUR_CLICKHOUSE_PASSWORD}
    CLICKHOUSE_PORT=9000
    
    
    POSTGRES_HOST=dashboard_db
    POSTGRES_DB=postgres
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD={YOUR_POSTGRESQL_PASSWORD}
    POSTGRES_PORT=5432
    
    
  1. Run application
docker network create CoinCapNet
docker-compose run --build -d
  1. Stop application:
docker-compose down -v

coincap_monitor's People

Contributors

genvekt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.