DEV Community

HansTognon
HansTognon

Posted on

Building a service for Redis Hackaton

Overview of My Submission

This project is a small service whose purpose is to provide stats about GitHub repositories. It pulls info about the commits and draw some conclusions. It's intended to be integrated in a micro-service architecture.
I didn't provide any UI since I knew about this hackaton lately.

Submission Category:

Wacky Wildcards

Language Used

Python

Link to Code

Gitlytics

A service powered by Redis Streams to provide stats about Github repositories.

tasks Runner Result 1 Result 2 Result 3

How it works

How the data is stored:

  • repositories is a stream where information is added about repositories to analyze.
  • For each analyzed repository
    • repos:{owner}:{repo} provides result of analysis

How the data is accessed:

  • List of Github repositories in process
XRANGE repositories - +
Enter fullscreen mode Exit fullscreen mode
  • Result of repository analysis
GET repos:{owner}:{repo}
Enter fullscreen mode Exit fullscreen mode

How to run it locally?

Prerequisites

Local installation

# use this to start redis or do it manually
export GLC_REDIS_PORT=6379 # modify this to customize your redis port
docker-compose up -d

cd etl
cp etl/.env.example etl/.env # customize to your environment

# install dependencies
poetry install

# activate your virtual environment
poetry shell
python etl/main.py
Enter fullscreen mode Exit fullscreen mode

In another tab:

# In another tab, use a redis client to create new tasks
poetry shell
owner=a_github_username
repo=a_repo_of_owner
XADD repositories * owner "$owner"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)