Skip to content

Save Data To Storage

A storage is used to collect the request, response, document images and metadata.

Supported storage types:

To set up the storage, use:

config.yaml
service:
  storage:
    type: s3

    s3:
      accessKey: "AKIAIOSFODNN7REGULAEXAMPLE"
      accessSecret: "WJalrXUtnFEMI/K7MDENG/bPxRfiCYREGULAEXAMPLEKEY"
      region: "eu-central-1"
      secure: true
      endpointUrl: "http://localhost:9000"
Parameter Type Default Description
type string Set the s3 value to use Amazon S3
accessKey string Access key for the S3 storage.
accessSecret string Access secret for the S3 storage.
region string Region for the S3 storage.
secure boolean true Whether to check the CA certificate.
endpointUrl string URL of the local HTTP REST endpoint. For more details see the Amazon documentation about Website endpoints.
config.yaml
service:
  storage:
    type: gcs

    gcs:
      gcsKeyJson: "/etc/credentials/gcs_key.json"
Parameter Type Default Description
type string Set the gcs value to use Google Cloud Storage
gcsKeyJson string "/etc/credentials/gcs_key.json" Path to the credentials file for Google Cloud Storage access.
config.yaml
service:
  storage:
    type: az

    az:
      storageAccount: "faceapidevaccount"
      connectionString: "DefaultEndpointsProtocol=https;AccountName=faceapidevaccount;AccountKey=************;EndpointSuffix=core.windows.net"
Parameter Type Default Description
type string Set the az value to use Microsoft Azure
storageAccount string <AZURE_STORAGE_ACCOUNT> Name of the Azure Storage account.
connectionString string <AZURE_CONNECTION_STRING> Connection string for Azure Storage. Due to security reasons, has different order of precedence.
config.yaml
service:
  storage:
    type: fs

    fs:
Parameter Type Default Env Variable Description
type string Set the fs value to use file system
fs string To set up using the file system as the storage, leave this section empty and define the parameter processingresultslocationfolder

Example

Below, see the contents' example of the config.yaml file or download it.

config.yaml
service:
  webServer:
    port: 8080
    workers: 1
    timeout: 30

    demoApp:
      enabled: true

    cors:
      origins: "*"
      headers: "Content-Type"
      methods: "POST,PUT,GET,DELETE,PATCH,HEAD"

    ssl:
      enabled: false
      cert: certs/tls.crt
      key: certs/tls.key
      tlsVersion: 1.2

    logging:
      level: INFO
      formatter: text

      access:
        console: true
        path: logs/docreader-access.log

      app:
        console: true
        path: logs/docreader-app.log

  processing:
    enabled: true
    results:
      location:
        bucket: docreader-processing
        container: docreader-processing
        folder: docreader-processing
        prefix: ""

  storage:
    type: s3

    s3:
      accessKey: minioadmin
      accessSecret: minioadmin
      endpointUrl: http://s3-storage:9000
      region: eu-central-1
      secure: true

If you use Docker Compose, you can mount the config.yaml in the docker-compose.yml file. See the example below or download it.

docker-compose.yml
version: "3.7"

services:
  docreader:
    container_name: docreader
    image: regulaforensics/docreader:latest
    volumes:
      - ./regula.license:/app/extBin/unix/regula.license
      - ./config.yaml:/app/config.yaml
    networks:
      - docreader-network
    healthcheck:
      test: curl -f http://127.0.0.1:8080/api/ping
      interval: 60s
      start_period: 60s
      timeout: 30s
      retries: 5
    depends_on:
      - s3-storage
    ports:
      - "8080:8080"

  # Storage
  s3-storage:
    image: quay.io/minio/minio:RELEASE.2023-10-25T06-33-25Z
    command: server --console-address ":9001" /data
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      MINIO_ACCESS_KEY: minioadmin
      MINIO_SECRET_KEY: minioadmin
    volumes:
      - minio-data:/data
    networks:
      - docreader-network
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ]
      interval: 30s
      timeout: 20s
      retries: 3

volumes:
  minio-data:

networks:
  docreader-network:
    driver: bridge

To set the license, place the regula.license file into the same folder where the downloaded docker-compose.yml is located.

To start the Docker container, invoke:

sudo docker-compose up -d

To check the status, run:

sudo docker-compose ps