yarnwith env variables
- CALLBACK_HOST — Internal API that called after screenshoting. default: http://localhost:9002
- POOL_SIZE — Count of tabs in browser. default require('os').cpus().length / 2
- QUEUE_NAME — Queue name in Rabbit. default howtocards:render
- RABBIT_HOST — RabbitMQ server. default amqp://localhost:5672
- RENDER_HOST — Howtocards Frontend instance. default https://howtocards.io
- UPLOADER_HOST — Image Uploader internal API. default http://localhost:4000
- yarn startto run worker
- CTRL+C— shutdown worker
docker run -v `pwd`/the-files:/files -it -e "VOLUME=/files" --expose 4000  howtocards/image-uploader/image-uploaderWorker subscribes to tasks from QUEUE_NAME at RABBIT_HOST.
Task types:
- { "user": "@sergeysova", "extra": {}, "callback": "/preview/user/@sergeysova" }— to render- /@sergeysova
- { "card": "2", "extra": {}, "callback": "/preview/card/2" }— to render- /open/2
Steps:
- 
Task received 
- 
Tab consumed from pool 
- 
Task rendered by specified type - userjust makes screenshot of user page
- cardmakes screenshot of card, and get snapshot. Frontend should render with Slate
 
- 
Tab returned to pool 
- 
Screenshot is uploaded to UPLOADER_HOST
- 
If .callbackpresent send POST request to{CALLBACK_HOST}/{callback}with JSON body{ "screenshot": "/abcd/efgh/asdasd.png", "snapshot": "<div></div>" }- snapshot generated only for card
- usersends only- {"screenshot": ""}
- screenshotis a path relative to- https://howtocards.io/images
 
- snapshot generated only for