OCR advanced configuration
This guide describes an advanced configuration of OCR. In most cases, the default configuration is enough.
OCR profiles
If you need to change the OCR authentication, consider the following set of profiles as a basis for your changes:
spring.profiles.active: basic-and-jwt-auth,mongoDbQueue,gridfs-storage,mongo-task,abbyy
You should specify the same type of profiles in ocr-rest.yml and ocr-worker.yml configuration files.
There are five groups of profiles for the OCR service. There should be specified exactly one profile per group.
The profile groups are as follows:
- Authentication
- Task queue
- File storage
- Task storage and processing strategy (not configurable)
- OCR engine (not configurable)
note
ocr-worker and ocr-rest should be set up consistently. They should have the same queue, file storage, and task storage profiles. ocr-worker does not require authentication type, task storage, and processing strategy profiles to be configured.
Authentication
There are four profiles that define an authentication type to apply:
disabled-auth: authorization is not used for the OCR service, all resources are accessible anonymously (without authentication).basic-auth: basic authentication is used, some resources are accessible anonymously, others require authentication.basic-and-jwt-auth: both basic and JWT authentication are available, some resources are accessible anonymously, others require authentication.jwt-auth: JWT authentication is used, all resources require authentication (except for the root path: /).
Basic authentication additionally requires user name and password to be configured in application.properties of ocr-rest:
spring.security.username: your_username
spring.security.password: your_password
JWT authentication additionally requires a JWT secret, issuer, and token expiration time to be configured in application.properties of ocr-rest:
jwt.secret: your_jwt_secret
jwt.expiration.minutes: 60
jwt.issuer: workfusion
Task queue
There are two profiles that define the queue type:
mongoDbQueue: MongoDB is used to store message queues. MongoDB connection configuration properties should be specified.rabbitmqQueue: RabbitMQ is used to store message queues. RabbitMQ connection configuration properties should be specified.
The profile and the properties should be specified for ocr-rest and ocr-worker consistently.
File storage
There are two profiles that specify a file storage back end to use, a technology to store the OCR input and output payload:
gridfs-storage: files will be stored in MongoDB. MongoDB connection configuration properties should be specified.s3-storage: files will be stored in Amazon S3. Theocr.bucketproperty should be specified additionally.
Example for S3 for ocr-rest:
spring.profiles.active: basic-and-jwt-auth,mongoDbQueue,s3-storage,mongo-task,abbyy
# Root folder to keep task input and output files (either in GridFS or in S3, depending on the active file storage profile).
ocr.tasks.abbyy.storage.folder=abbyy_tasks
---
spring.profiles: s3-storage
aws.endpoint: # Endpoint to S3 or emulator. E.g. http://127.0.0.1:9000
ocr.bucket: doc-upload # name of bucket to use for tasks
aws.accessKeyId: # Access KeyID for specified endpoint
aws.secretKey: # Secret Keyfor specified endpoint
The profile and the properties should be specified for ocr-rest and ocr-worker consistently.
OCR parameters
Collect all changed parameters of the OCR service in YML files (/etc directory) comparing with the standard listed in the blocks below.
Standard OCR rest properties:
db.cleanup.abbyy:
input: 2000
output: 2000
record: 600
spring.profiles.active: disabled-auth,mongoDbQueue,gridfs-storage,mongo-task
ocr.rest.timeout: 5
ocr.rest.retries: 2
Standard OCR worker properties:
worker.executor.abbyy.pool.size:
spring.profiles.active: abbyy,mongoDbQueue,gridfs-storage
Update the configuration YML files with the parameter values collected on the previous step.
Files to review in case any customization exists:
ocr-rest.ymlocr-worker.yml