DIRECT DLM

DLM Metadata Creation Script Usage

93 views 01/07/2020 05/11/2020 Gammy Pichardo 1

Overview

Depending on your use case, your download manager (DLM) may be configured to download files using our storage repository format instead of direct file downloads. The storage repository format allows the DLM to request files in pieces and check them for integrity (among other benefits). This article covers how to use the DLM Metadata creation script to generate metadata (catalog and metafiles) required by the DLM to download using our storage repository format.

Download the DLM Metadata Creation Script using the button below.

Download Latest DIRECT 5

Install Script Prerequisites

The metadata creation script require Python 2.7.13, the Requests module1, and the PyJWT module2. If you have Python 2.7 and those modules installed, you can proceed directly to the next step. Note that these scripts will also run on macOS.

To install the pre-requisite modules, simply run the install.py script that is included in the release package. Open a command line and navigate to your python directory, then use the following arguments:

python.exe c:\path\to\install.py

For more information about these pre-requisites, please see Prepare Deployment Scripts.

 

Edit Configuration File Template

Within the script directory, navigate to the samples\config folder and edit deploy_local.json.


Specify values for the following options. Note that all directories and URLs should end with a trailing forward slash /.

  • source_directory: Full path to the directory containing the files you want the DLM to download
  • output_directory: Full path to a directory where the script will write the metadata to
  • metafile_url: URL where you will be uploading this medata to. If you are not signing the data, then this must be an HTTPS URL (see below).
  • download_url: URL where the DLM will retrieve your files from (we recommend this URL be listed twice in an array for optimal performance)
  • repository_name: Friendly name for the set of files or package you are deploying. Examples: product_name, gamename, awesomepackage, etc... (DO NOT USE PERIODS IN REPOSITORY NAMES)
  • build_version: Version number associated for the iteration of the files. Examples: "0.0.1" or "1.0.1"
  • fileBoolean that denotes the DLM will be retrieving files in their raw form from the CDN. This is required and should NOT be modified or removed.

Optional configuration options:

  • certificate_path: Full path to your code-signing certificate
  • certificate_password: Password for code-signing certificate

See Configure Scripts to Use Your Own Code-Signing Certificate for more information.

Sample Configuration File

{
    "source_directory": "D:/ssn/deployscripts/source/",
    "output_directory": "D:/ssn/deployscripts/catalog-metafile-only/output/",
    "metafile_url": "https://solidstatenetworks.akamaized.net/qa/dlmdemo/meta/",
    "download_url": [
      "http://netstorage.solidstatenetworks.com/qa/dlmdemo/files/",
      "http://netstorage.solidstatenetworks.com/qa/dlmdemo/files/"
    ],
    "certificate_path" : "D:/bits/certs/ssnqa.pfx",
    "certificate_password" : "password",
    "repository_name": "deploy_demo",
    "build_version": "1.0.7",
    "file": true
}

Securing Metadata

The metadata generated by this script MUST be secured in one of the following ways:

Option 1 -  The data can be signed when it is generated. This is done by specifying a certificate path and password as referenced above.
Option 2 - The data can be hosted on a domain protected by an SSL certificate (e.g. https://companyname.cdn.com/)

While both options can be used, only one is required. The JSON files are signed and JWT encoded.

Run DLM Metadata Script

When running the script, use the --config argument to specify the path to deploy_local.json file. Example:

 deploy_local.py --config=D:\ssn\deployscripts\dlm_metadata\samples\config\deploy_local.json

The script will output its progress.

Script Output

The script outputs two files to the specified output_directory:

  1. repository_name.build_version.catalog.json
  2. repository_name.build_version.metafile.json

Upload Metadata to Delivery Server

You can use any method to transfer the metadata files from your output_directory to the directory on your delivery server that corresponds to your metafile_url, be it FTP, SSH, rsync, web upload, etc... The example below shows an FTP upload.


That's it! At this point a DLM can be directed to that catalog URL in order to download your scanned files via a repository sync.

Notes

  1. More information on the Requests module is available here.
  2. More information on the PyJWT module is available here.

Was this helpful?