Skip to content

Compression and decompression service in a distributed system.

Notifications You must be signed in to change notification settings

ABuarque/simple-compression-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Compression Service (a.k.a Amassa!)

Build Status codecov

This project is a compressor/decompressor system made with two microservices, a frontend and a reverse proxy. The compression/decompression system uses Huffman algorithm and it is written in C programing language. As the main project lanaguage is Go, was used CGO to make possible go code call the C API. For file storage this project uses pCloud and a link of the pushed file is send by email to the client.

Screenshot

alt text alt text alt text alt text

Service Architecture

alt text

Reverse proxy

The reverse proxy was made using NGINX server on Docker. It is placed at src/apps/reverseproxy with the .conf file and Dockerfile.

Frontend

The frontend is a golang server that serves HTML using templates. It is placed at src/apps/frontend with it source file, Dockerfile and tests.

Backend

The backend nowadyas is made by two microservices, one to handle frontend requests called inputhandler, and other service worker to compress and decompress files called compressor.

inputhandler

It is placed at src/apps/reverseproxy. It provides a REST API used by the frontend to make compression or decompression for given files. It get the requests from frontend, process the request payload and sends to compressor service by publishing a message into a queue topic using Redis.

compressor

It is placed at src/apps/compressor. It reads messages from a queue on a Redis in order to process files given commands: compress or decompress.

Running (~10 minutes)

First of all, clone this repo:

$ git clone https://github.com/ABuarque/simple-compression-service.git # using HTTPS

Go to the cloned directory and create a .env file on the root filling these values:

EMAIL=youremail@provider.com
PASSWORD=yourpassword
PCLOUD_LOGIN=yourpcloudemailaccount@provider.com
PCLOUD_PASSWORD=yourpcloudpassword

Put all containers up:

$ docker-compose up -d

If everything is ok, all containers should be up:

alt text

Open up any brower and go to http://localhost:8080/home and enjoy!

If you get email authentication issue, with Gmail for example, it might be happen due to the "allow less security apps" option is disable for your account.

Acknowledgments