Github

Build a Greengage DB Docker image

Andrey Aksenov

This topic describes how to build a Docker image with Greengage DB (based on Greenplum Database) and use this image to run a demo cluster in a Docker container. Using the resulting image, you can also run different test suites against a demo cluster. Learn more from How to run tests.

Prerequisites

To follow the steps described in this document, ensure you have git and Docker installed on your operating system.

Clone the Greengage DB repository

  1. Clone the greengage repository with submodules:

    $ git clone --recurse-submodules https://github.com/GreengageDB/greengage.git
  2. Go to the greengage directory:

    $ cd greengage

Build a Greengage DB Docker image

To build a Greengage DB Docker image, execute the following command in the greengage directory:

$ docker build -t greengagedb6:latest -f ci/Dockerfile.ubuntu .

This command builds the Docker image called greengagedb6 based on Ubuntu 22.04. The image includes all the libraries and utilities needed to build and run Greengage DB, as well as the compiled binaries.

Work with a demo cluster

This section describes running a Docker container with Greengage DB and working with a demo cluster inside this container.

Run a Docker container

To create and run a Docker container for the demo Greengage DB cluster, execute the following command:

$ docker run \
  --name greengagedb6_demo \
  --rm \
  -it \
  --sysctl 'kernel.sem=500 1024000 200 4096' \
  greengagedb6:latest \
  bash -c "ssh-keygen -A && /usr/sbin/sshd && bash"

After creating and running the container, an interactive Bash shell session opens. You can now install and configure Greengage DB and then start the demo cluster.

Install and configure Greengage DB

  1. Source the common.bash file:

    $ source gpdb_src/concourse/scripts/common.bash
  2. Call the install_and_configure_gpdb function defined in the common.bash file to unpack Greengage DB binaries to /usr/local/greengage-db-devel/:

    $ install_and_configure_gpdb

Create the Greengage DB administrative user

Execute the following script to create a system user account used to run and administer Greengage DB:

$ gpdb_src/concourse/scripts/setup_gpadmin_user.bash

This command creates the gpadmin user, generates an SSH key pair, and makes gpadmin the owner of /usr/local/greengage-db-devel/.

Start the cluster

Create and start the demo cluster by calling the make_cluster function:

$ make_cluster

Verify the cluster

To verify that the cluster works correctly, you need to connect to a database:

  1. Switch to the gpadmin user:

    $ su - gpadmin
  2. Set the Greengage DB path and environment variables as follows:

    $ source /usr/local/greengage-db-devel/greengage_path.sh
  3. Source the gpdemo-env.sh file to set values of the PGPORT and MASTER_DATA_DIRECTORY environment variables:

    $ source gpdb_src/gpAux/gpdemo/gpdemo-env.sh
  4. Connect to the default postgres database:

    $ psql postgres

    The output should look like this:

    psql (9.4.26)
    Type "help" for help.
    
    postgres=#
  5. Get the version information about the installed Greengage DB:

    SELECT version();

    The output might look like this:

    PostgreSQL 9.4.26 (Greengage Database 6.28.0 build commit:98fe53544904076e89bbaa5c4a38415dc3131db9) on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit compiled on Jan 29 2025 09:11:47