This is repo contains simple Rails API which receives image url and pushes it to RabbitMQ queue to later process it with tesseract
$ docker compose up -d
If needed environmental variables stored in .env
file
There are 3 services that should be running:
- Rails API
- Rails Worker
- RabbitMQ
All is needed is successfull connection to RabbitMQ and tesseract command line installed.
The default connection url will be tried by app is:
amqp://guest:guest@localhost:5672
If that's not your option, you can change it there:
config/initializers/sneakers.rb:1
Once you have everything required, go ahead and fire up RabbitMQ and then Rails API and Worker:
$ bin/rails s # for API
$ bin/rake sneakers:run # for worker
There are 2 containers:
-
Rails application
- Rails API
- Rails Worker
multiple services in the same container, supervised by s6-overlay:
-
RabbitMQ service
$ rspec
Make request to:
POST localhost:3000/api/v1/media
with body like:
{
"fileUrl": "https://i.stack.imgur.com/WiDpa.jpg"
}
the result will be logged by worker:
2022-09-09T19:34:04Z p-880 t-94c INFO: [OcrProcessJob(d5ce53fb)] result => some text extracted from image