Prerequisites
The plugin is available as a docker image.
It has the following dependencies:
  • a postgres database
  • a mongodb database in case the html templates feature is needed
  • needs to be able to connect to the Kafka instance used by the engine
  • a redis instance for caching
  • an S3 compatible file storage solution (we have successfully used Min.io)
The plugin comes with most of the needed configuration properties filled in, but there are a few that need to be set up using some custom environment variables.

Dependencies

Postgres database

Basic Postgres configuration - helm values.yaml
1
documentdb:
2
existingSecret: {{secretName}}
3
metrics:
4
enabled: true
5
service:
6
annotations:
7
prometheus.io/port: {{phrometeus port}}
8
prometheus.io/scrape: "true"
9
type: ClusterIP
10
serviceMonitor:
11
additionalLabels:
12
release: prometheus-operator
13
enabled: true
14
interval: 30s
15
scrapeTimeout: 10s
16
persistence:
17
enabled: true
18
size: 4Gi
19
postgresqlDatabase: document
20
postgresqlUsername: postgres
21
resources:
22
limits:
23
cpu: 500m
24
memory: 512Mi
25
requests:
26
cpu: 200m
27
memory: 256Mi
28
service:
29
annotations:
30
fabric8.io/expose: "false"
Copied!

Redis server

The plugin can use the Redis component already deployed for the engine.

Document storage

You need to have an S3 compatible file storage solution deployed in your setup.

Configuration

Enable html template types

In case you want to use html templates for documents, you need to override the following config by using an environment variable:
1
html:
2
templates:
3
enabled: ${HTML_TEMPLATES_ENABLED:false}
Copied!

Postgres configuration

To store various metadata related to the stored documents, such as document types, document access details, etc, this plugin uses a postgres database.
The following configuration details need to be added in the environment variables:
1
datasource:
2
url: jdbc:postgresql://DB_HOST:5432/DB_NAME
3
username: ${DB_USERNAME}
4
password: ${DB_PASSWORD}
5
hikari:
6
maximum-pool-size: ${HIKKARI_MAX_POOL_SIZE}
Copied!
You will need to make sure that the user, password, connection link and db name are configured correctly, otherwise you will receive errors at start time.
Database schema is managed by a liquibase script that will create, manage and migrate future versions.

MongoDB configuration

The MongoDB database is used when storing document templates in HTML format. A few configurations are needed:
1
data:
2
mongodb:
3
uri: mongodb://MONGODB_USERNAME:[email protected]_HOST:27017/MONGODB_NAME
Copied!

Redis Configuration

The following values should be set with the corresponding Redis related values. As you can see below, some of them have some default values set.
1
redis:
2
master:
3
host: REDIS_MASTER_HOST
4
port: REDIS_MASTER_PORT
5
password: REDIS_PASSWORD
6
ttl: ${REDIS_TTL:5000}
7
cache-expirations:
8
notifTemplate: ${REDIS_CACHE_EXPIRATION_NOTIF_TEMPLATE:5000}
9
allNotifTemplates: ${REDIS_CACHE_EXPIRATION_ALLNOTIF_TEMPLATES:5000}
Copied!

Kafka Configuration

The following Kafka related configurations can be set by using environment variables:
1
spring:
2
kafka:
3
bootstrap-servers: KAFKA_BOOTSTRAP_SERVER
4
consumer:
5
group-id: KAFKA_CONSUMER_GROUP_ID
6
kafka:
7
consumerThreads: ${KAFKA_CONSUMER_THREADS:3}
8
authorizationExceptionRetryInterval: ${KAFKA_AUTH_EXCEPTION_RETRY_INTERVAL:10}
Copied!
KAFKA_BOOTSTRAP_SERVER - address of the Kafka server
KAFKA_CONSUMER_GROUP_ID - group of consumers
KAFKA_MESSAGE_MAX_BYTES - this is the largest size of the message that can be received by the broker from a producer.
KAFKA_CONSUMER_THREADS - the number of Kafka consumer threads
KAFKA_AUTH_EXCEPTION_RETRY_INTERVAL - the interval between retries after AuthorizationException is thrown by KafkaConsumer
Each action available in the plugin corresponds to a Kafka event. A separate Kafka topic must be configured for each use-case.
The Engine is listening for messages on topics with names of a certain pattern, make sure to use correct outgoing topic names when configuring the documents plugin.

File storage configuration

Based on use case you can use directly a file system or an S3 compatible cloud storage solution (for example min.io).
A basic configurations for min.io, looks like this:
1
application:
2
file-storage:
3
type: minio # minio / fileSystem
4
minio:
5
server-url: MINIO_SERVER_URL
6
access-key: MINIO_ACCESS_KEY
7
secret-key: MINIO_SECRET_KEY
8
bucket-prefix: MINIO_BUCKET_PREFIX
Copied!
Make sure to follow the recommended bucket naming rules when choosing the bucket prefix name.
MULTIPART_MAX_FILE_SIZE - the multipart file size on the request

Custom font path for docx templates

The following config needs to be set in order to choose the font to be used when generating documents based on docx templates.
1
pdfGenerationFontPath: PDF_GENERATION_FONT_PATH/FONT_FILE_NAME
Copied!

Custom font paths for html templates

In case you want to use some specific fonts in your html templates, you need to override the following config:
1
html:
2
templates:
3
pdfFontPaths: ${HTML_TEMPLATES_FONT_PATHS: /statics/fonts/Calibri.ttf, /statics/fonts/DejaVuSans.ttf}
Copied!
If you don't override HTML_TEMPLATES_FONT_PATHS, you have Calibri and DejaVuSans as default fonts that you can use.
After making this configuration, these fonts will become available to be used inside the html template.

Logging

The following environment variables could be set in order to control log levels:
LOGGING_ROOT_LOGLEVEL - root spring boot microservice logs
LOGGING_APP_LOGLEVEL - app level logs
Last modified 6mo ago