Skip to content

senzing-garage/docker-init-container

Repository files navigation

docker-init-contaner

If you are beginning your journey with Senzing, please start with Senzing Quick Start guides.

You are in the Senzing Garage where projects are "tinkered" on. Although this GitHub repository may help you understand an approach to using Senzing, it's not considered to be "production ready" and is not considered to be part of the Senzing product. Heck, it may not even be appropriate for your application of Senzing!

Preamble

At Senzing, we strive to create GitHub documentation in a "don't make me think" style. For the most part, instructions are copy and paste. Whenever thinking is needed, it's marked with a "thinking" icon πŸ€”. Whenever customization is needed, it's marked with a "pencil" icon ✏️. If the instructions are not clear, please let us know by opening a new Documentation issue describing where we can improve. Now on with the show...

Overview

The senzing/init-container performs Senzing initializations.

Synopsis:

  1. Where needed, copy *.template files into actual files.
  2. Change file permissions and ownership of specific files.
  3. Modify contents of specific ini files.
  4. If needed, populate Senzing database SYS_CFG table with default configuration.
  5. Initializations are performed by init-container.py script.

Contents

  1. Expectations
  2. Demonstrate using Command Line Interface
    1. Prerequisites for CLI
    2. Download
    3. Environment variables for CLI
    4. Run command
  3. Demonstrate using Docker
    1. Prerequisites for Docker
    2. Database support
    3. External database
    4. Run Docker container
  4. Configuration
  5. References

Legend

  1. πŸ€” - A "thinker" icon means that a little extra thinking may be required. Perhaps there are some choices to be made. Perhaps it's an optional step.
  2. ✏️ - A "pencil" icon means that the instructions may need modification before performing.
  3. ⚠️ - A "warning" icon means that something tricky is happening, so pay attention.

Expectations

  • Space: This repository and demonstration require 6 GB free disk space.
  • Time: Budget 40 minutes to get the demonstration up-and-running, depending on CPU and network speeds.
  • Background knowledge: This repository assumes a working knowledge of:

Demonstrate using Command Line Interface

Prerequisites for CLI

πŸ€” The following tasks need to be complete before proceeding. These are "one-time tasks" which may already have been completed.

  1. Install system dependencies:
    1. Use apt based installation for Debian, Ubuntu and others
      1. See apt-packages.txt for list
    2. Use yum based installation for Red Hat, CentOS, openSuse and others.
      1. See yum-packages.txt for list
  2. Install Python dependencies:
    1. See requirements.txt for list
      1. Installation hints
  3. The following software programs need to be installed:
    1. senzingapi
  4. πŸ€” Optional: Some databases need additional support. For other databases, this step may be skipped.
    1. Db2: See Support Db2.
    2. MS SQL: See Support MS SQL.
  5. Configure Senzing database

Download

  1. Get a local copy of init-container.py. Example:

    1. ✏️ Specify where to download file. Example:

      export SENZING_DOWNLOAD_FILE=~/init-container.py
    2. Download file. Example:

      curl -X GET \
        --output ${SENZING_DOWNLOAD_FILE} \
        https://raw.githubusercontent.com/Senzing/docker-init-container/main/init-container.py
    3. Make file executable. Example:

      chmod +x ${SENZING_DOWNLOAD_FILE}
  2. πŸ€” Alternative: The entire git repository can be downloaded by following instructions at Clone repository

Environment variables for CLI

  1. ✏️ Identify the Senzing g2 directory. Example:

    export SENZING_G2_DIR=/opt/senzing/g2
    1. Here's a simple test to see if SENZING_G2_DIR is correct. The following command should return file contents. Example:

      cat ${SENZING_G2_DIR}/g2BuildVersion.json
  2. Set common environment variables Example:

    export PYTHONPATH=${SENZING_G2_DIR}/sdk/python
  3. πŸ€” Set operating system specific environment variables. Choose one of the options.

    1. Option #1: For Debian, Ubuntu, and others. Example:

      export LD_LIBRARY_PATH=${SENZING_G2_DIR}/lib:${SENZING_G2_DIR}/lib/debian:$LD_LIBRARY_PATH
    2. Option #2 For Red Hat, CentOS, openSuse and others. Example:

      export LD_LIBRARY_PATH=${SENZING_G2_DIR}/lib:$LD_LIBRARY_PATH

Run command

  1. Run the command. Example:

    sudo \
      PYTHONPATH=${PYTHONPATH} \
      LD_LIBRARY_PATH=${LD_LIBRARY_PATH} \
      ${SENZING_DOWNLOAD_FILE} --help
  2. For more examples of use, see Examples of CLI.

Demonstrate using Docker

Prerequisites for Docker

πŸ€” The following tasks need to be complete before proceeding. These are "one-time tasks" which may already have been completed.

  1. The following software programs need to be installed:
    1. docker
  2. Install Senzing using Docker
  3. Configure Senzing database using Docker

Database support

πŸ€” Optional: Some databases need additional support. For other databases, these steps may be skipped.

  1. Db2: See Support Db2 instructions to set SENZING_OPT_IBM_DIR_PARAMETER.
  2. MS SQL: See Support MS SQL instructions to set SENZING_OPT_MICROSOFT_DIR_PARAMETER.

External database

πŸ€” Optional: Use if storing data in an external database. If not specified, the internal SQLite database will be used.

  1. ✏️ Specify database. Example:

    export DATABASE_PROTOCOL=postgresql
    export DATABASE_USERNAME=postgres
    export DATABASE_PASSWORD=postgres
    export DATABASE_HOST=senzing-postgresql
    export DATABASE_PORT=5432
    export DATABASE_DATABASE=G2
  2. Construct Database URL. Example:

    export SENZING_DATABASE_URL="${DATABASE_PROTOCOL}://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DATABASE}"
  3. Construct parameter for docker run. Example:

    export SENZING_DATABASE_URL_PARAMETER="--env SENZING_DATABASE_URL=${SENZING_DATABASE_URL}"

Run Docker container

Although the Docker run command looks complex, it accounts for all of the optional variations described above. Unset environment variables have no effect on the docker run command and may be removed or remain.

  1. Run Docker container. Example:

    sudo docker run \
      --rm \
      ${SENZING_DATABASE_URL_PARAMETER} \
      ${SENZING_OPT_IBM_DIR_PARAMETER} \
      ${SENZING_OPT_MICROSOFT_DIR_PARAMETER} \
      senzing/init-container
  2. For more examples of use, see Examples of Docker.

Configuration

Configuration values specified by environment variable or command line parameter.

References

  1. Development
  2. Errors
  3. Examples
  4. Related artifacts:
    1. DockerHub
    2. Helm Chart