Build a Greengage DB Docker image
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
Clone the Greengage DB repository
-
Clone the greengage repository with submodules:
$ git clone --recurse-submodules https://github.com/GreengageDB/greengage.git
-
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
-
Source the common.bash file:
$ source gpdb_src/concourse/scripts/common.bash
-
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:
-
Switch to the
gpadmin
user:$ su - gpadmin
-
Set the Greengage DB path and environment variables as follows:
$ source /usr/local/greengage-db-devel/greengage_path.sh
-
Source the gpdemo-env.sh file to set values of the
PGPORT
andMASTER_DATA_DIRECTORY
environment variables:$ source gpdb_src/gpAux/gpdemo/gpdemo-env.sh
-
Connect to the default
postgres
database:$ psql postgres
The output should look like this:
psql (9.4.26) Type "help" for help. postgres=#
-
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