From 48fb29ab605a40e81a5d42cfdb9d93a08a8381a6 Mon Sep 17 00:00:00 2001 From: Lav Jain Date: Fri, 26 Jan 2018 13:47:12 -0800 Subject: [PATCH] Update readme instructions for using docker for building GPDB (#4424) * Update readme instructions for using docker for building GPDB --- README.md | 59 ++------------------- src/tools/docker/README.md | 55 +++++++++++++++++-- src/tools/docker/centos6-gpadmin/Dockerfile | 4 +- src/tools/docker/centos7-gpadmin/Dockerfile | 4 +- 4 files changed, 60 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 06faf56c18..7564d31e6f 100644 --- a/README.md +++ b/README.md @@ -185,69 +185,16 @@ See [more information about gpperfmon here](gpAux/gpperfmon/README.md) gpperfmon is dependent on several libraries like apr, apu, and libsigar -## Development with Native Docker Client +## Development with Docker See [README.docker.md](README.docker.md). -## Development with Docker Machine - We provide a docker image with all dependencies required to compile and test -GPDB. You can view the dependency dockerfile at `./src/tools/docker/base/Dockerfile`. -The image is hosted on docker hub at `pivotaldata/gpdb-devel`. This docker -image is currently under heavy development. +GPDB [(See Usage)](src/tools/docker/README.md). You can view the dependency dockerfile at `./src/tools/docker/centos6-admin/Dockerfile`. +The image is hosted on docker hub at `pivotaldata/gpdb-dev:centos6-gpadmin`. A quickstart guide to Docker can be found on the [Pivotal Engineering Journal](http://engineering.pivotal.io/post/docker-gpdb/). -Known issues: -* The `installcheck-world` make target has at least 4 failures, some of which - are non-deterministic - -### Running regression tests with Docker - -1. Create a docker host with 8GB RAM and 4 cores - ```bash - docker-machine create -d virtualbox --virtualbox-cpu-count 4 --virtualbox-disk-size 50000 --virtualbox-memory 8192 gpdb - eval $(docker-machine env gpdb) - ``` - -1. Build your code on gpdb-devel rootfs - ```bash - cd [path/to/gpdb] - docker build . - # image beefc4f3 built - ``` - The top level Dockerfile will automatically sync your current working - directory into the docker image. This means that any code you are working - on will automatically be built and ready for testing in the docker context - -1. Log into docker image - ```bash - docker run -it beefc4f3 - ``` - -1. As `gpadmin` user run `installcheck-world` - ```bash - su gpadmin - cd /workspace/gpdb - make installcheck-world - ``` - -### Caveats - -* No Space Left On Device: - On macOS the docker-machine vm can periodically become full with unused images. - You can clear these images with a combination of docker commands. - ```bash - # assuming no currently running containers - # remove all stopped containers from cache - docker ps -aq | xargs -n 1 docker rm - # remove all untagged images - docker images -aq --filter dangling=true | xargs -n 1 docker rmi - ``` - -* The Native macOS docker client available with docker 1.12+ (beta) or - Community Edition 17+ may also work - ## Development with Vagrant There is a Vagrant-based [quickstart guide for developers](src/tools/vagrant/README.md). diff --git a/src/tools/docker/README.md b/src/tools/docker/README.md index b276e6acf9..aff54b3c2c 100644 --- a/src/tools/docker/README.md +++ b/src/tools/docker/README.md @@ -1,8 +1,55 @@ # Docker container with GPDB for development/testing + +## Build locally +``` +# Centos 6 (include dependencies for building GPDB) +docker build -t local/gpdb-dev:centos6 centos6 +# Add gpadmin user to Centos 6 (gpdb cannot run as root) +docker build --build-arg REPO_OWNER=local -t local/gpdb-dev:centos6-gpadmin centos6-gpadmin + +# Centos 7 (include dependencies for building GPDB) +docker build -t local/gpdb-dev:centos7 centos7 +# Add gpadmin user to Centos 7 (gpdb cannot run as root) +docker build --build-arg REPO_OWNER=local -t local/gpdb-dev:centos7-gpadmin centos7-gpadmin +``` + +OR +## Download from docker hub +``` +docker pull pivotaldata/gpdb-dev:centos6-admin +docker pull pivotaldata/gpdb-dev:centos7-admin +``` + +# Build GPDB code with Docker + +### Clone GPDB repo +``` +git clone https://github.com/greenplum-db/gpdb.git +cd gpdb +``` +### Use docker image based on gpdb/src/tools/docker/centos7-gpadmin +``` +docker run -w /home/build/gpdb -v ${PWD}:/home/build/gpdb:cached -it pivotaldata/gpdb-dev:centos7-gpadmin /bin/bash ``` -docker build -t pivotaldata/gpdb-dev:centos6 centos6 -docker build -t pivotaldata/gpdb-dev:centos6-gpadmin centos6-gpadmin -docker build -t pivotaldata/gpdb-dev:centos7 centos7 -docker build -t pivotaldata/gpdb-dev:centos7-gpadmin centos7-gpadmin + +### Inside docker +(Total time to build and run ~ 15-20 min) ``` +# ORCA is disabled here to keep the instructions simple +./configure --enable-debug --with-perl --with-python --with-libxml --disable-orca --prefix=/usr/local/gpdb +make -j4 + +# Install Greenplum binaries (to /usr/local/gpdb) +make install + +# Create a single node demo cluster with three segments +# PGPORT is set to 15432 +source /usr/local/gpdb/greenplum_path.sh +make create-demo-cluster +source ./gpAux/gpdemo/gpdemo-env.sh + +# Create and use a test database +createdb greenplum +psql -d greenplum +``` \ No newline at end of file diff --git a/src/tools/docker/centos6-gpadmin/Dockerfile b/src/tools/docker/centos6-gpadmin/Dockerfile index eb364163be..503ab91196 100644 --- a/src/tools/docker/centos6-gpadmin/Dockerfile +++ b/src/tools/docker/centos6-gpadmin/Dockerfile @@ -1,4 +1,6 @@ -FROM pivotaldata/gpdb-dev:centos6 +ARG REPO_OWNER=pivotaldata + +FROM ${REPO_OWNER}/gpdb-dev:centos6 # create user gpadmin since GPDB cannot run under root RUN groupadd -g 1000 gpadmin && useradd -u 1000 -g 1000 gpadmin && \ diff --git a/src/tools/docker/centos7-gpadmin/Dockerfile b/src/tools/docker/centos7-gpadmin/Dockerfile index 1ce6a9845c..3e1a8558e0 100644 --- a/src/tools/docker/centos7-gpadmin/Dockerfile +++ b/src/tools/docker/centos7-gpadmin/Dockerfile @@ -1,4 +1,6 @@ -FROM pivotaldata/gpdb-dev:centos7 +ARG REPO_OWNER=pivotaldata + +FROM ${REPO_OWNER}/gpdb-dev:centos7 # create user gpadmin since GPDB cannot run under root RUN groupadd -g 1000 gpadmin && useradd -u 1000 -g 1000 gpadmin && \ -- GitLab