Skip to content

A psql client that waits for the database to be ready before uploading SQL file.

License

Notifications You must be signed in to change notification settings

senzing-garage/postgresql-client

Repository files navigation

postgresql-client

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!

Overview

Contents

  1. Expectations
  2. Demonstrate using Docker
  3. Demonstrate using docker-compose
  4. 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 Docker

  1. ✏️ Specify database. Note: POSTGRES_HOST cannot be "localhost". It must be an IP address or a hostname that can be resolved. Example:

    export POSTGRES_USERNAME=postgres
    export POSTGRES_PASSWORD=postgres
    export POSTGRES_HOST=senzing-postgresql
    export POSTGRES_PORT=5432
    export POSTGRES_DB=G2
  2. Construct Database URL. Example:

    export SENZING_DATABASE_URL="postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
  3. List SQL files. Note: the example uses files that are "baked-in" the container. Any other SQL file must be on a mounted volume. Example:

    export SENZING_SQL_FILES="/opt/senzing/g2/resources/schema/g2core-schema-postgresql-create.sql /app/insert-senzing-configuration.sql"
  4. Run docker container. Example:

    sudo docker run \
      --env SENZING_DATABASE_URL="${SENZING_DATABASE_URL}" \
      --env SENZING_SQL_FILES="${SENZING_SQL_FILES}" \
      --rm \
      senzing/postgresql-client

Demonstrate using docker-compose

  1. ✏️ Specify database. Note: POSTGRES_HOST cannot be "localhost". It must be an IP address or a hostname that can be resolved. Example:

    export POSTGRES_USERNAME=postgres
    export POSTGRES_PASSWORD=postgres
    export POSTGRES_HOST=senzing-postgresql
    export POSTGRES_PORT=5432
    export POSTGRES_DB=G2
  2. Bring up docker-compose formation. Example:

    cd ${GIT_REPOSITORY_DIR}
    docker-compose up

References

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