OCR advanced configuration
The guide describes advanced configuration of OCR. In most cases, the default configuration is enough.
OCR profiles
In case there's 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,rabbitmqQueue,gridfs-storage,mongo-task,abbyy
You should specify the same type of profiles in the ocr-rest.yml and ocr-worker.yml configuration files.
There are five groups of profiles for OCR Service. Specify one profile per group.
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 and 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 done for OCR Service, all resources are accessible anonymously (without authentication).basic-auth: basic authentication is done, some resources are accessible anonymously, the others require authentication.basic-and-jwt-auth: both basic and JWT authentication are available, some resources are accessible anonymously, the others require authentication.jwt-auth: JWT authentication is done, 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 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
RabbitMQ is used to store message queue. Thus, 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 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 OCR service in YML files (/etc directory) comparing with standard listed in blocks below.
ocr-rest.yml
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
ocr-worker.yml
Standard OCR worker properties
worker.executor.abbyy.pool.size:
spring.profiles.active: abbyy,mongoDbQueue,gridfs-storage
Update configuration YML files with collected parameter values on the previous step.
Files to review in case any customization exists are as follows:
ocr-rest.ymlocr-worker.yml