Skip to content

senzing-garage/docker-python-demo

Repository files navigation

docker-python-demo

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!

Synopsis

This senzing/python-demo docker image demonstrates how to write a Flask app based on the senzing/senzingapi-runtime docker image.

Overview

Related artifacts

  1. DockerHub

Contents

  1. Demonstrate using Docker
    1. Set environment variables
    2. Run docker container
  2. Demonstrate using docker-compose
    1. Download artifacts
    2. Prerequisite docker-compose stack
    3. Bring up docker-compose stack
  3. Configuration
  4. References

Legend

  1. 🤔 - A "thinker" icon means that a little extra thinking may be required. Perhaps you'll need to make some choices. 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 Docker

Set environment variables

  1. Construct Senzing SQL Connection. Example:

    export SENZING_SQL_CONNECTION="postgresql://username:password@hostname:5432:G2/"

Run docker container

  1. Run docker container. Example:

    sudo docker run \
      --env SENZING_SQL_CONNECTION \
      --publish 8356:5000 \
      --rm \
      senzing/python-demo
  2. The running app is viewable at localhost:8356.

Demonstrate using docker-compose

Download artifacts

  1. Specify a new directory to place artifacts in. Example:

    export SENZING_VOLUME=~/my-senzing
  2. Create directories. Example:

    export PGADMIN_DIR=${SENZING_VOLUME}/pgadmin
    export POSTGRES_DIR=${SENZING_VOLUME}/postgres
    export RABBITMQ_DIR=${SENZING_VOLUME}/rabbitmq
    export SENZING_UID=$(id -u)
    export SENZING_GID=$(id -g)
    mkdir -p ${PGADMIN_DIR} ${POSTGRES_DIR} ${RABBITMQ_DIR}
    chmod -R 777 ${SENZING_VOLUME}
  3. Download artifacts. Example:

    wget \
      -O ${SENZING_VOLUME}/docker-compose-backing-services-only.yaml \
      "https://raw.githubusercontent.com/Senzing/docker-compose-demo/main/resources/postgresql/docker-compose-rabbitmq-postgresql-backing-services-only.yaml"
    
    wget \
      -O ${SENZING_VOLUME}/docker-compose.yaml \
      "https://raw.githubusercontent.com/Senzing/docker-python-demo/main/docker-compose.yaml"

Prerequisite docker-compose stack

  1. Bring up a Docker Compose stack with backing services. Example:

    docker-compose -f ${SENZING_VOLUME}/docker-compose-backing-services-only.yaml pull
    docker-compose -f ${SENZING_VOLUME}/docker-compose-backing-services-only.yaml up

Bring up docker-compose stack

  1. Download docker-compose.yaml file and deploy stack. Note: SENZING_VOLUME needs to be set. Example:

    docker-compose -f ${SENZING_VOLUME}/docker-compose.yaml pull
    docker-compose -f ${SENZING_VOLUME}/docker-compose.yaml up
  2. The running app is viewable at localhost:8356.

Configuration

Configuration values specified by environment variable or command line parameter.

References