https://github.com/msgflo/msgflo-example-imageresize
Example service for image resizing/scaling/thumbnails
https://github.com/msgflo/msgflo-example-imageresize
example image-optimization image-processing rabbitmq
Last synced: 7 months ago
JSON representation
Example service for image resizing/scaling/thumbnails
- Host: GitHub
- URL: https://github.com/msgflo/msgflo-example-imageresize
- Owner: msgflo
- Created: 2017-04-04T20:47:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-20T16:45:41.000Z (almost 9 years ago)
- Last Synced: 2025-01-21T12:46:58.298Z (about 1 year ago)
- Topics: example, image-optimization, image-processing, rabbitmq
- Language: CoffeeScript
- Size: 66.4 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/msgflo/msgflo-example-imageresize)
# MsgFlo example: Image resizing service
Example of how to build a backend service for CPU-intensive tasks using [Msgflo](https://msgflo/org).

## Deploying to Heroku
The absolutely quickest way to get running is to deploy the sevice to Heroku.
[](https://heroku.com/deploy)
## API
`FIXME: document`
* API. HTTP POST. JSON body. Array of images. URL and desired height/width. Returns 202 Accepted, with `Location`.
Ref. https://benramsey.com/blog/2008/04/http-status-201-created-vs-202-accepted/
* Downloads image. Rescales. Uploads downscaled. Updates job status.
## TODO
Minimal
* Add checks for successful job completion test
Bonus
* Fix marking job status with completed
* UI: Accept URLs
## Running locally
### Prerequisites
The following software needs to be preinstalled
* Node.js 6+
* Postgres 9.6+
* RabbitMQ 3.6+
Also needed is an Amazon S3 bucket, and the associated credentials.
### Download git repo
git clone https://github.com/msgflo/msgflo-example-imageresize.git
cd msgflo-example-imageresize
### Install
npm install
### One-time setup
Create the database
psql -c 'create database imageresize_test;' -U postgres
Run database migrations and bind message queues
npm run setup
### Configure
Configure Amazon S3 access
export IMAGERESIZE_S3_KEY=key
export IMAGERESIZE_S3_SECRET=secret
export IMAGERESIZE_S3_BUCKET=bucket
### Run
Run the entire service
npm start
### Run tests
npm test