Link

Storing converted content remotely

Table of contents

  1. What is its function
  2. How to set this value
  3. Default Value
  4. How to use with Docker

What is its function

This option allows you to specify a remote storage option to upload the final zip file to a cloud based storage.
This function is controlled by a varying number of property files depending on the cloud used. The cloud platform to upload to is controlled by 1 option.

  1. storageprovider - The fully-qualified class name for the remote storage class to be used

How to set this value

First you need to build a module from idr-microservice-storage. Once built place the jar in the jpedal-microservice/lib directory and build the jpedal-microservice war file.

Create the following Java properties file on the server running your app server (if you don’t already have one) {user.home}/.idr/jpedal-microservice/jpedal-microservice.properties

In this file add (or update if the key already exists) the following key and value pair.

  1. storageprovider - This must be a fully-qualified class name from the idr-microservice-storage.
    e.g storageprovider=com.idrsolutions.microservice.storage.AWSStorage

Once you have chosen the platform you will need to provide additional values to allow the microservice to send files to the platform.
Below you will find the variables for each platform.

AWS
  1. storageprovider - must be set to com.idrsolutions.microservice.storage.AWSStorage
  2. storageprovider.aws.accesskey - Can be found at AWS -> IAM -> Access management -> Users
    You may need to create an access key on the security credentials tab
  3. storageprovider.aws.secretkey - Can be found at AWS -> IAM -> Access management -> Users
    You may need to create an access key on the security credentials tab
  4. storageprovider.aws.bucketname - Can be found at AWS, AWS -> S3
    You will need the value from the Name column.
  5. storageprovider.aws.region - Can be found at AWS, AWS -> S3
    You will need the value from the AWS Region column for the bucket name.
  6. storageprovider.aws.basepath - [Optional] The path inside the bucket where files will be stored.
Digital Ocean
  1. storageprovider - must be set to com.idrsolutions.microservice.storage.DOStorage
  2. storageprovider.do.accesskey - Can be found at Digital Ocean -> API At the bottom of the page is “Space access keys”, you can generate/get a new key here.
  3. storageprovider.do.secretkey - Can be found at Digital Ocean -> API At the bottom of the page is “Space access keys”, you can generate/get a new secret here.
  4. storageprovider.do.bucketname - Can be found at Digital Ocean -> Spaces You will need the value in the Name column.
  5. storageprovider.do.region - Can be found at Digital Ocean -> Spaces The value can be found in the Spaces url between the second and third ‘.’
  6. storageprovider.do.basepath - [Optional] The path inside the bucket where files will be stored.
Azure
  1. storageprovider - must be set to com.idrsolutions.microservice.storage.AzureStorage
  2. storageprovider.azure.accountname - can be found at Azure -> Storage Accounts, the value under the Name column.
  3. storageprovider.azure.accountkey - can be found at Azure -> Storage Account -> Security + networking -> Access keys.
  4. storageprovider.azure.containername - The name of the blob container inside the storage account.
  5. storageprovider.azure.basepath - [Optional] The path inside the bucket where files will be stored.
GCP
  1. storageprovider - must be set to com.idrsolutions.microservice.storage.GCPStorage
  2. storageprovider.gcp.credentialspath - You must generate a credentials file at GCP -> IAM -> Service Accounts
    You will need a service account with write permissions to the bucket you will use. Enter the service account and go to the keys tab.
    Create a new key with a type of JSON and save the file to disk. Then you need to add the file to the device running the microsystem. Use the files path as the value for this option.
    If using Docker you will need to mount the file and set this value to the path on Docker. The mount can be done as below.
    --mount "source=/path/to/gcp/credentials.json,target=/root/.gcp/credentials.json,type=bind"
  3. storageprovider.gcp.projectid - The name of the project containing the bucket. This can be found at GCP -> Project info.
  4. storageprovider.gcp.bucketname - The name of the bucket to store files in. This can be found at GCP -> Cloud Storage
  5. storageprovider.gcp.basepath - [Optional] The path inside the bucket where files will be stored.
Oracle
  1. storageprovider - must be set to com.idrsolutions.microservice.storage.OracleStorage
  2. storageprovider.oracle.ociconfigfilepath - Path to a config file generated at Oracle CLoud Platform -> Identity * Security -> Users If you don’t already have one, create a user with write permissions, open this user and got to the API Keys section. Click the option “Add API Key” and download both private and public keys that pop-up and save the private key in a directory called oci, then click add. In the Configuration File Preview, copy the preview content, update the private key path and save it into a file called config within the oci directory. If using Docker you will need to mount the oci directory and set this value to the path to the config file on Docker. The mount can be done as below.
    --mount "source=/path/to/oci/,target=/root/.oci/,type=bind" Note, if using docker, the private key path in the config file should match the docker image path for the private key.
  3. storageprovider.oracle.region - This can be found in the config file, or by getting the region name found in the Top Right corner of the Oracle Portal, then find the id on this look up table.
  4. storageprovider.oracle.profile - The profile within the config file to use. These can be found within the config file.
  5. storageprovider.oracle.bucketname - Can be found at Oracle Cloud Platform -> Storage -> Buckets The value in the name column is the bucket name.
  6. storageprovider.oracle.namespace - Can be found at Oracle Cloud Platform -> Storage -> Buckets Click on the bucket to use and see the namespace entry under the Bucket Information tab.
  7. storageprovider.oracle.basepath - [Optional] The path inside the bucket where files will be stored.

Default Value

When no values are provided or invalid values are provided the feature will not be used, keeping the zip files on the servers local storage.

How to use with Docker

In order to provide your own properties file to the Docker image you need to mount the properties file to the image. This is done by adding the following to your docker run command.

--mount "source=/path/to/properties/directory/jpedal-microservice.properties,target=/root/.idr/jpedal-microservice/jpedal-microservice.properties,type=bind"