Using docker-compose
, bring up a Senzing stack
using AWS SQS and a PostgreSQL database.
These instructions support multiple docker-compose.yaml files.
This repository illustrates a reference implementation of Senzing using AWS SQS as the queue and PostgreSQL as the underlying database.
The instructions show how to set up a system that:
- Reads JSON lines from a file on the internet and sends each JSON line to a message queue via the Senzing
stream-producer.
- In this implementation, the queue is AWS SQS.
- Reads messages from the queue and inserts into Senzing via the Senzing
stream-loader.
- In this implementation, Senzing keeps its data in a PostgreSQL database.
- Reads information from Senzing via Senzing API Server server.
- Views resolved entities in a web app.
The following diagram shows the relationship of the Docker containers in this Docker composition. Arrows represent data flow.
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. Icons are used to signify additional actions by the user. 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...
- Space: This repository and demonstration require 7 GB free disk space.
- Time: Budget 2 hours to get the demonstration up-and-running, depending on CPU and network speeds.
- Background knowledge: This repository assumes a working knowledge of:
- docker - Minimum version: 20.10.16
- docker-compose - Minimum version: 1.29.0
-
✏️ Specify AWS credentials. Example:
export AWS_ACCESS_KEY_ID=$(aws configure get default.aws_access_key_id) export AWS_SECRET_ACCESS_KEY=$(aws configure get default.aws_secret_access_key) export AWS_DEFAULT_REGION=$(aws configure get default.region)
-
Create AWS SQS queues at console.aws.amazon.com/sqs/home.
-
✏️ Specify AWS SQS queues: Example:
export SENZING_SQS_FAILURE_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/000000000000/senzing-failure-queue" export SENZING_SQS_INFO_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/000000000000/senzing-info-queue" export SENZING_SQS_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/000000000000/senzing-queue" export SENZING_SQS_REDO_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/000000000000/senzing-redo-queue"
🤔 Choose a docker-compose.yaml file from
list.
Choose one value for SENZING_DOCKER_COMPOSE_FILE
from the examples given below.
-
Standard demonstration.
export SENZING_DOCKER_COMPOSE_FILE=resources/postgresql/docker-compose-sqs-postgresql.yaml
Uses senzing/senzing-api-server
instead of senzing/senzing-poc-server
.
-
Standard demonstration.
export SENZING_DOCKER_COMPOSE_FILE=resources/postgresql/docker-compose-sqs-postgresql-api-server.yaml
-
Return information with each record added to Senzing.
export SENZING_DOCKER_COMPOSE_FILE=resources/postgresql/docker-compose-sqs-postgresql-withinfo.yaml
-
Add multiple
redoer
s to standard demonstration. This will process the Senzing "redo records". Oneredoer
will populate sqs with redo records. One or moreredoer
s will read redo records from sqs topic and send to the Senzing Engine.export SENZING_DOCKER_COMPOSE_FILE=resources/postgresql/docker-compose-sqs-postgresql-redoer-sqs.yaml
-
Add
redoer
to standard demonstration. Also, return information with each record added to Senzing.export SENZING_DOCKER_COMPOSE_FILE=resources/postgresql/docker-compose-sqs-postgresql-redoer-withinfo.yaml
-
Add multiple
redoer
s to standard demonstration. This will process the Senzing "redo records". Oneredoer
will populate sqs with redo records. One or moreredoer
s will read redo records from sqs topic and send to the Senzing Engine. Also, return information with each record added to Senzing.export SENZING_DOCKER_COMPOSE_FILE=resources/postgresql/docker-compose-sqs-postgresql-redoer-sqs-withinfo.yaml
-
✏️ Specify a new directory to hold demonstration artifacts on the local host. Example:
export SENZING_DEMO_DIR=~/my-senzing
⚠️ macOS - File sharing must be enabled forSENZING_DEMO_DIR
.⚠️ Windows - File sharing must be enabled forSENZING_DEMO_DIR
.
-
Set environment variables. Example:
export PGADMIN_DIR=${SENZING_DEMO_DIR}/pgadmin export POSTGRES_DIR=${SENZING_DEMO_DIR}/postgres export SENZING_GID=$(id -g) export SENZING_UID=$(id -u) export SENZING_VAR_DIR=${SENZING_DEMO_DIR}/var
-
Create directories. Example:
mkdir -p ${PGADMIN_DIR} ${POSTGRES_DIR} ${SENZING_VAR_DIR} chmod -R 777 ${SENZING_DEMO_DIR}
-
Get versions of Docker images. Example:
curl -X GET \ --output ${SENZING_DEMO_DIR}/docker-versions-stable.sh \ https://raw.githubusercontent.com/Senzing/knowledge-base/main/lists/docker-versions-stable.sh source ${SENZING_DEMO_DIR}/docker-versions-stable.sh
-
Download
docker-compose.yaml
and Docker images. Example:curl -X GET \ --output ${SENZING_DEMO_DIR}/docker-compose.yaml \ "https://raw.githubusercontent.com/senzing-garage/docker-compose-demo/main/${SENZING_DOCKER_COMPOSE_FILE}" cd ${SENZING_DEMO_DIR} sudo --preserve-env docker-compose pull
-
Bring up Senzing docker-compose stack. Example:
cd ${SENZING_DEMO_DIR} sudo --preserve-env docker-compose up
-
Allow time for the components to be downloaded, start, and initialize.
- There will be errors in some Docker logs as they wait for dependent services to become available.
docker-compose
isn't the best at orchestrating Docker container dependencies.
- There will be errors in some Docker logs as they wait for dependent services to become available.
Once the docker-compose formation is running, different aspects of the formation can be viewed.
Username and password for the following sites were either passed in as environment variables
or are the default values seen in
${SENZING_DOCKER_COMPOSE_FILE}
.
- A good tool to monitor individual Docker logs is Portainer. When running, Portainer is viewable at localhost:9170.
- Senzing Entity Search WebApp is viewable at localhost:8251.
- See additional tips for working with Senzing Entity Search WebApp.
The web-based Senzing X-term can be used to run Senzing command-line programs.
- Senzing X-term is viewable at localhost:8254.
- See additional tips for working with Senzing X-Term.
Instructions to use the senzing/sshd container are viewable in the senzing/docker-sshd repository
-
Change file permissions on database files. Example:
sudo chmod 777 -R ${POSTGRES_DIR}
-
Jupyter Notebooks are viewable at localhost:9178.
-
See additional tips for working with Jupyter Notebooks.
View results from Senzing REST API server. The server supports the Senzing REST API.
- The OpenApi Editor with Servers value of http://localhost:8250 can be used to try the Senzing REST API.
- Example Senzing REST API request: localhost:8250/heartbeat
- See additional tips for working with Senzing API server.
- AWS SQS is viewable at console.aws.amazon.com/sqs/home.
- PostgreSQL is viewable at
localhost:9171.
- Database defaults: username:
postgres
password:postgres
- Database defaults: username:
- See additional tips for working with PostgreSQL.
When the docker-compose formation is no longer needed, it can be brought down and directories can be deleted.
-
Bring down Docker formation. Example:
cd ${SENZING_DEMO_DIR} sudo docker-compose down
-
Remove directories from host system. Example:
rm -rf ${SENZING_DEMO_DIR:-/tmp/nowhere/for/safety}
The following topics discuss variations to the basic docker-compose demonstration.
This docker formation brings up the following docker containers:
- bitnami/postgres
- dpage/pgadmin4
- senzing/console
- senzing/entity-web-search-app
- senzing/jupyter
- senzing/redoer
- senzing/senzing-poc-server
- senzing/senzing-tools
- senzing/sshd
- senzing/stream-loader
- senzing/stream-producer
- senzing/xterm
Configuration values specified by environment variable or command line parameter.
-
The matrix for using sqs with
stream-loader.py
andredoer.py
subcommands.+-------------------------- stream-loader.py sqs | +----------------------- stream-loader.py sqs-withinfo | | +-------------------- redoer.py redo | | | +----------------- redoer.py redo-withinfo-sqs | | | | +-------------- redoer.py write-to-sqs | | | | | +----------- redoer.py read-from-sqs | | | | | | +-------- redoer.py read-from-sqs-withinfo | | | | | | | v v v v v v v X . . . . . . X . X . . . . docker-compose-sqs-postgresql.yaml X . . X . . . X . . . X X . docker-compose-sqs-postgresql-redoer-sqs.yaml X . . . X . X . X . . . . . docker-compose-sqs-postgresql-withinfo.yaml . X X . . . . . X . X . . . docker-compose-sqs-postgresql-redoer-withinfo.yaml . X . . X X . . X . . X . X docker-compose-sqs-postgresql-redoer-sqs-withinfo.yaml