Giter VIP home page Giter VIP logo

imagestore's Introduction

Basic Image Hosting Service

Microservices

This includes two microservices in 2 separate Git repositories

ImageStore Implementation

The ImageStore microservice:

  • Receives an uploaded image and returns a unique identifier which can then be used to retrieve the image
  • Different image formats can be returned by using different extensions against the image ID
  • Different image tarnsformations can be download using the image ID

The ImageCompress microservice:

  • Calls the ImageStore service to retrieve the image using Image ID
  • Compresses the image
  • Calls the ImageStore service to

To run both services on a local machine

  • For ImageStore

pip install -r requirements.txt
export STORAGE_FOLDER=<path to your temp folder>
mkdir <path to your temp folder>
mkdir log
python app.py

  • For ImageCompress

pip install -r requirements.txt
export STORE_URL=<url path to ImageStore service>
mkdir log
python app.py

To Test

curl -H "Content-Type: application/json" -X POST -d '{"filename":"table.jpg","type":"jpg"}' http://localhost:8000/upload
curl http://0.0.0.0:8000/download/<image ID for table.jpg>\?type\=jpg
curl http://0.0.0.0:8000/compress/<image ID for table.jpg>\?type\=jpg
curl http://0.0.0.0:8000/download/<image ID for table.jpg>\?type\=jpg\&transform=compress

Docker

To run in Docker Containers use the following docker-compose.yml

version: '3'

services:
  store:
    build: './ImageStore'
    container_name: store
    ports:
      - 8000:8000
    environment:
      STORAGE_FOLDER: "/app/tmp"

  compress:
    build: './ImageCompress'
    ports:
      - 9000:9000
    links:
      - "store:imagestore"
    environment:
      STORE_URL: "http://store:8000"

A more practical architecture

ImageStore Implementation

Asynchronous web service

The task management and HTTP request-response sequence between the client and the server as shown in the above diagram are implemenented in the Asynchronous Web Service project.

One could use Gevent or Celery for the task management and Redis or Rabbit as the message broker.

Async Web App

imagestore's People

Contributors

anilnairxyz avatar

Stargazers

lmy avatar

Watchers

James Cloos avatar  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.