You can build Cloudberry Database from source code in two ways: manually or automatically.
For the manual build, you need to manually set up many system configurations and download third-party dependencies, which is quite cumbersome and error-prone.
To make the job easier, you are recommended to use the automated deployment method blessed by virtualization technology. The automation method simplifies the deployment process, reduces time costs, and allows developers to focus more on business code development.
To go automated, you can choose either of the following ways based on your needs and project requirements:
This document introduces how to use Vagrant and Docker to auto-build Cloudberry Database from source code, respectively. In addition, it also introduces the file sharing mechanism that ensures that the Cloudberry Database is mapped to a specific path in the virtualized environment.
Before you begin your automation build, make sure the following preparation works are done:
Download the Cloudberry Database source code into your local machine:
git clone git@github.com:cloudberrydb/cloudberrydb.git
Install the required Vagrant or Docker in your local environment, depending on your deployment preference.
Start your Vagrant virtual machine.
Start the automatic compilation and deployment process.
$ cd /cloudberrydb/deploy/vagrant $ vagrant up
Log into your Vagrant virtual machine via ssh:
$ vagrant ssh
Connect to Cloudberry Database, and check whether the psql client can be started and connect to the database.
$ su - gpadmin $ psql postgres postgres=# select * from gp_segment_configuration;
Start the regression test. Note that this test is expected to be performed with the gpadmin user.
$ cd ~/workspace/cbdb_dev $ make installcheck-world
Configure the Docker image repository.
Configure the Docker image repository URL by adding the following JSON format configuration in the Preferences -> Docker Engine tab in your Docker Desktop setting.
"insecure-registries": [ "docker.artifactory.hashdata.xyz" ]
Start the Docker container.
The docker_start.sh scripts will automatically launch the Docker container, and compile and deploy Cloudberry Database within the container.
$ cd ~/workspace/cbdb/deploy/docker $ bash docker_start.sh
Log into the Docker container.
$ docker exec -it (cotainer ID) /bin/bash
Connect to Cloudberry Database.
$ su gpadmin $ psql postgres postgres=# select * from gp_segment_configuration;
Start the regression test.
$ cd ~/workspace/cbdb_dev $ make installcheck-world
The whole script is subdivided into three main parts:
|-- cbdb_deploy.sh
|-- cbdb_env.sh
|-- docker
| |-- Dockerfile
| |-- docker_deploy.sh
| `-- docker_start.sh
|-- script
| `-- install_etcd.sh
`-- vagrant
|-- Vagrantfile
`-- vagrant_release.sh
The automation deployment script running in the virtualization environment.
Through the mechanism provided by Vagrant vagrantfile provision or Docker dockerfile ENTRYPOINTS:
Passing the following compilation options through /code/depoly/cbdb_ deploy.sh script:
Passing the environment variable parameters required for automation build & test through /code/depoly/cbdb_env.sh script.
Vagrant scripts
2.1 Vagrantfile
/home/gpadmin/workspace/cbdb directory/home/gpadmin/workspace/cbdb_dev, which is the actual working directory for automation build & test.gpadmin.Docker scripts
3.1 Dockerfile
3.2 docker_deploy.sh
3.3 docker_start.sh
/home/gpadmin/workspace/cbdb directory/home/gpadmin/workspace/cbdb_dev, which is the actual working directory for automation build & test.gpadmin