Giter VIP home page Giter VIP logo

compress-'s Introduction

Compress-

Small service that compress users files. Just a task for interview, don't take it too seriosly. Compress can handle speed seeding of 2m records with copy (~3 min) and can return same amount records in one bulk with somehow meaningfull amount of time (cold for 2m records total ~191s in 191083ms (Views: 145430.2ms | ActiveRecord: 45651.2ms | Allocations: 136069401)). Can be speedup by pagination and caching warm up but this is not in requirements. Images stored on S3 and compressed with sidekiq async jobs.

  • How to run service
  1. rename .env.example to .env and input aws keys or copy given .env to root project folder
  2. docker-compose up --build
  3. In separate terminal you can run docker-compose run --rm web bundle exec rails db:create db:migrate db:seed to prepare and seed db
  • How to run the test suite and linters

    Better to setup db on local in database.yml for test enviroment because it's a lot faster but other way with docker also works, you need to run docker-compose run --rm web bundle exec rspec to run in docker or following commands for local:

    bundle install

    bundle exec rspec

    bundle exec rubocop

  • To get all sended emails you can use preconfigured http://localhost:5001/ or you need to configure your own smtp server

  • GET /images Get all images with users

curl -X GET http://localhost:3000/images -H 'Content-Type: application/json'

  • GET /users Get all users with images

curl -X GET http://localhost:3000/users -H 'Content-Type: application/json'

  • POST /users Create new user

curl -X POST http://localhost:3000/users -H 'Content-Type: application/json' -d '{"user": { "email": "[email protected]" }}'

  • POST /images/compress

curl -X POST http://localhost:3000/images/compress -H 'Content-Type: multipart/form-data' -F image\[user_id\]=2746c349-c0cc-4df4-ac25-dc019059782c -F image\[file\][email protected]

  • GET /images/:id/download Get link to compressed file

open in browser http://localhost:3000/images/b39ac101-a4ea-4544-a07e-c41320cfe96e/download and you will be redirected to image url

compress-'s People

Contributors

mordorreal 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.