Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Introduce Rocky Linux 9.4 support for main branch and add enhanced support for 1.5.X releases. #28

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
FROM centos:7.9.2009

# Define a build argument with a default value
ARG CODEBASE_VERSION_VAR=${CODEBASE_VERSION_VAR}
ARG TIMEZONE_VAR="Asia/Shanghai"
ARG PIP_INDEX_URL_VAR="https://pypi.org/simple"

RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
Expand All @@ -13,15 +19,15 @@ COPY ./configs/* /tmp/
RUN echo root:cbdb@123 | chpasswd \
&& yum install -y epel-release \
&& yum install -y initscripts unzip which tar less net-tools util-linux-ng passwd openssh-clients openssh-server perl ed m4 sudo rsync git wget \
&& yum install -y apr-devel bison bzip2-devel cmake3 flex gcc gcc-c++ krb5-devel libcurl-devel libevent-devel libkadm5 libxml2-devel libyaml-devel libzstd-devel openssl-devel perl-ExtUtils-Embed readline-devel xerces-c-devel zlib-devel \
&& yum install -y apr-devel bison bzip2-devel cmake3 flex gcc gcc-c++ go krb5-devel libcurl-devel libevent-devel libkadm5 libxml2-devel libyaml-devel libzstd-devel openssl-devel perl-ExtUtils-Embed readline-devel xerces-c-devel zlib-devel \
&& yum install -y postgresql postgresql-devel \
&& yum install -y centos-release-scl scl-utils \
&& yum install -y devtoolset-10

RUN cat /tmp/sysctl.conf.add >> /etc/sysctl.conf \
RUN cat /tmp/90-cbdb-sysctl.conf >> /etc/sysctl.conf \
&& sed -i "s/#UseDNS YES/UseDNS no/g" /etc/ssh/sshd_config \
&& cat /tmp/limits.conf.add >> /etc/security/limits.conf \
&& cat /usr/share/zoneinfo/Asia/Shanghai > /etc/localtime \
&& cat /tmp/90-cbdb-limits.conf >> /etc/security/limits.conf \
&& cat /usr/share/zoneinfo/${TIMEZONE_VAR} > /etc/localtime \
&& echo "mdw" > /tmp/gpdb-hosts \
&& echo "/usr/local/lib" >> /etc/ld.so.conf \
&& echo "/usr/local/lib64" >> /etc/ld.so.conf \
Expand All @@ -47,17 +53,30 @@ RUN cat /tmp/sysctl.conf.add >> /etc/sysctl.conf \
RUN yum install -y python3-devel python3-pip; yum clean all

RUN cd /tmp/ \
&& unzip -d /tmp /tmp/cloudberrydb-1.5.2.zip \
&& cd /tmp/cloudberrydb-1.5.2 \
&& pip3 install -i https://mirrors.aliyun.com/pypi/simple -r python-dependencies.txt
&& unzip -d /tmp /tmp/cloudberrydb-${CODEBASE_VERSION_VAR}.zip \
&& cd /tmp/cloudberrydb-${CODEBASE_VERSION_VAR} \
&& if [ -f python-dependencies.txt ]; then \
pip3 install -i ${PIP_INDEX_URL_VAR} -r python-dependencies.txt; \
elif [ -f readmes/python-dependencies.txt ]; then \
pip3 install -i ${PIP_INDEX_URL_VAR} -r readmes/python-dependencies.txt; \
else \
echo "File does not exist, skipping additional commands"; \
exit 2; \
fi

RUN cd /tmp/cloudberrydb-${CODEBASE_VERSION_VAR} \
&& source scl_source enable devtoolset-10 \
&& ./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/local/cloudberry-db

RUN cd /tmp/cloudberrydb-${CODEBASE_VERSION_VAR} \
&& source scl_source enable devtoolset-10 \
&& make -j$(nproc)

RUN cd /tmp/cloudberrydb-1.5.2 \
RUN cd /tmp/cloudberrydb-${CODEBASE_VERSION_VAR} \
&& source scl_source enable devtoolset-10 \
&& ./configure --with-perl --with-python --with-libxml --with-gssapi --prefix=/usr/local/cloudberry-db \
&& make -j8 \
&& make install

EXPOSE 5432 22

VOLUME [ "/sys/fs/cgroup" ]
CMD ["bash","-c","/tmp/init_system.sh"]
CMD ["bash","-c","/tmp/init_system.sh"]
136 changes: 136 additions & 0 deletions 000-cbdb-sandbox/Dockerfile.main.rockylinux9
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
FROM rockylinux/rockylinux:9

ARG TIMEZONE_VAR="Asia/Shanghai"

ENV container docker

RUN dnf update -y && \
dnf install -y systemd \
systemd-libs && \
dnf clean all

# Clean up unnecessary systemd units
RUN [ -d /lib/systemd/system/sysinit.target.wants ] && find /lib/systemd/system/sysinit.target.wants/ -type l -not -name 'systemd-tmpfiles-setup.service' -delete || echo "Directory /lib/systemd/system/sysinit.target.wants does not exist" && \
[ -d /lib/systemd/system/multi-user.target.wants ] && find /lib/systemd/system/multi-user.target.wants/ -type l -delete || echo "Directory /lib/systemd/system/multi-user.target.wants does not exist" && \
[ -d /etc/systemd/system/*.wants ] && find /etc/systemd/system/*.wants/ -type l -delete || echo "Directory /etc/systemd/system/*.wants does not exist" && \
[ -d /lib/systemd/system/local-fs.target.wants ] && find /lib/systemd/system/local-fs.target.wants/ -type l -delete || echo "Directory /lib/systemd/system/local-fs.target.wants does not exist" && \
[ -d /lib/systemd/system/sockets.target.wants ] && find /lib/systemd/system/sockets.target.wants/ -type l -not -name '*udev*' -delete || echo "Directory /lib/systemd/system/sockets.target.wants does not exist" && \
[ -d /lib/systemd/system/basic.target.wants ] && find /lib/systemd/system/basic.target.wants/ -type l -delete || echo "Directory /lib/systemd/system/basic.target.wants does not exist" && \
[ -d /lib/systemd/system/anaconda.target.wants ] && find /lib/systemd/system/anaconda.target.wants/ -type l -delete || echo "Directory /lib/systemd/system/anaconda.target.wants does not exist"

COPY ./configs/* /tmp/

RUN echo root:cbdb@123 | chpasswd && \
dnf makecache && \
dnf install -y yum-utils \
epel-release \
git && \
yum-config-manager --disable epel-cisco-openh264 && \
dnf makecache && \
yum-config-manager --disable epel && \
dnf install -y --enablerepo=epel \
the_silver_searcher \
bat \
htop && \
dnf install -y bison \
cmake3 \
ed \
flex \
gcc \
gcc-c++ \
glibc-langpack-en \
go \
initscripts \
iproute \
less \
m4 \
net-tools \
openssh-clients \
openssh-server \
passwd \
perl \
rsync \
sudo \
tar \
unzip \
util-linux-ng \
wget \
which && \
dnf install -y apr-devel \
bzip2-devel \
krb5-devel \
libcurl-devel \
libevent-devel \
libxml2-devel \
libzstd-devel \
openldap-devel \
openssl-devel \
pam-devel \
perl-ExtUtils-Embed \
perl-Test-Simple \
perl-core \
python3-devel \
readline-devel \
zlib-devel && \
dnf install -y --enablerepo=crb \
libuv-devel \
libyaml-devel \
perl-IPC-Run && \
dnf install -y --enablerepo=epel \
xerces-c-devel

RUN cp /tmp/90-cbdb-sysctl.conf /etc/sysctl.conf && \
cp /tmp/90-cbdb-limits.conf /etc/security/limits.d/90-cbdb-limits.conf && \
cat /usr/share/zoneinfo/${TIMEZONE_VAR} > /etc/localtime && \
echo "mdw" > /tmp/gpdb-hosts && \
echo "/usr/local/lib" >> /etc/ld.so.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf && \
ldconfig && \
chmod 777 /tmp/gpinitsystem_singlenode && \
chmod 777 /tmp/init_system.sh && \
hostname > ~/orig_hostname && \
/usr/sbin/groupadd gpadmin && \
/usr/sbin/useradd gpadmin -g gpadmin -G wheel && \
echo "cbdb@123"|passwd --stdin gpadmin && \
echo "gpadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "export COORDINATOR_DATA_DIRECTORY=/data0/database/master/gpseg-1" >> /home/gpadmin/.bashrc && \
echo "source /usr/local/cloudberry-db/greenplum_path.sh" >> /home/gpadmin/.bashrc && \
mkdir -p /data0/database/master /data0/database/primary /data0/database/mirror && \
chown -R gpadmin:gpadmin /data0 && \
ssh-keygen -A && \
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config

RUN cd /tmp/ && \
git clone --branch main --single-branch --depth=1 https://github.com/cloudberrydb/cloudberrydb.git

RUN cd /tmp/cloudberrydb && \
./configure --prefix=/usr/local/cloudberry-db \
--enable-cassert \
--enable-debug-extensions \
--enable-ic-proxy \
--enable-mapreduce \
--enable-orafce \
--enable-orca \
--enable-pxf \
--enable-tap-tests \
--with-gssapi \
--with-ldap \
--with-libxml \
--with-openssl \
--with-pam \
--with-perl \
--with-pgport=5432 \
--with-python \
--with-pythonsrc-ext

RUN cd /tmp/cloudberrydb && \
make -j$(nproc)

RUN cd /tmp/cloudberrydb && \
make install

EXPOSE 5432 22

VOLUME [ "/sys/fs/cgroup" ]
CMD ["bash","-c","/tmp/init_system.sh"]
31 changes: 22 additions & 9 deletions 000-cbdb-sandbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Make sure that your environment meets the following requirements:

## Build the Sandbox

This section introduces how to set up the Docker container in which the source code of the latest Cloudberry Database (released in [Cloudberry Database Release Page](https://github.com/cloudberrydb/cloudberrydb/releases)) will be compiled. In this CentOS 7.9 Docker container, a single-node cluster will be initialized with one coordinator and two segments. Both x86 and ARM CPUs (including Apple chips) are supported.
This section introduces two methods to set up the Docker container. The container will host a CBDB single-node cluster intialized with one coordinator and three primary and mirror segments. Both x86 and ARM CPUs (including Apple chips) are supported.

- Method 1 - Compile with the source code of the latest Cloudberry Database (released in [Cloudberry Database Release Page](https://github.com/cloudberrydb/cloudberrydb/releases)). The base OS will use CentOS 7.9 Docker container.
- Method 2 - Compile with the latest Cloudberry Database [main](https://github.com/cloudberrydb/cloudberrydb/tree/main) branch. The base OS will use Rocky Linux 9 Docker container.

Build steps:

Expand All @@ -31,15 +34,25 @@ Build steps:
git clone https://github.com/cloudberrydb/bootcamp.git
```

3. Enter the repository and run the `run.sh` script to start the Docker container. This will start the automatic installation process.
3. Enter the repository and run the `run.sh` script to start the Docker container. This will start the automatic installation process. Depending on your environment, you may need to run this with 'sudo' command.

- For latest Cloudberry DB release

```shell
cd bootcamp/000-cbdb-sandbox
./run.sh
```

- For latest main branch

```shell
cd bootcamp/000-cbdb-sandbox
chmod +x ./run.sh
sudo ./run.sh
./run.sh -c main -o rockylinux9
```

Once the script finishes without error, the sandbox is built successfully.
Once the script finishes without error, the sandbox is built and running successfully. The `docker run` command uses --detach option allowing you to ssh or access the running CBDB instance remotely.

Please review run.sh script for additional options (e.g. setting Timezone in running container, only building container)

## Connect to the database

Expand All @@ -61,19 +74,19 @@ You can now connect to the database and try some basic operations.

```shell
[root@mdw /] su - gpadmin # Switches to the gpadmin user.

# Last login: Tue Oct 24 10:26:14 CST 2023 on pts/1

[gpadmin@mdw ~]$ psql # Connects to the database with the default database name "gpadmin".

# psql (14.4, server 14.4)
# Type "help" for help.
```

```sql
gpadmin=# SELECT VERSION(); -- Checks the database version.
version

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----
PostgreSQL 14.4 (Cloudberry Database 1.0.0 build dev) on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11), 64-bit compiled on Oct 24 2023 10:24:28
Expand Down
10 changes: 10 additions & 0 deletions 000-cbdb-sandbox/configs/90-cbdb-limits.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
######################
# CBDB CONFIG PARAMS #
######################

* soft core unlimited
* hard core unlimited
* soft nofile 524288
* hard nofile 524288
* soft nproc 131072
* hard nproc 131072
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
######################
# HAWQ CONFIG PARAMS #
# CBDB CONFIG PARAMS #
######################

kernel.shmmax = 1000000000
Expand Down
28 changes: 12 additions & 16 deletions 000-cbdb-sandbox/configs/gpinitsystem_singlenode
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# A name for the array you are configuring. You can use any name you
# like. Enclose the name in quotes if the name contains spaces.

ARRAY_NAME="GPDB SANDBOX"

ARRAY_NAME="Sandbox: Cloudberry Database Cluster"

# This specifies the file that contains the list of segment host names
# that comprise the Greenplum system. For a single-node system, this
Expand All @@ -24,7 +23,6 @@ ARRAY_NAME="GPDB SANDBOX"

MACHINE_LIST_FILE=/tmp/gpdb-hosts


# This specifies a prefix that will be used to name the data directories
# of the master and segment instances. The naming convention for data
# directories in a Greenplum Database system is SEG_PREFIX<number>
Expand All @@ -35,14 +33,12 @@ MACHINE_LIST_FILE=/tmp/gpdb-hosts

SEG_PREFIX=gpseg


# Base port number on which primary segment instances will be
# started on a segment host. The base port number will be
# incremented by one for each segment instance started on a host.

PORT_BASE=40000


# This specifies the data storage location(s) where the script will
# create the primary segment data directories. The script creates a
# unique data directory for each segment instance. If you want multiple
Expand All @@ -57,15 +53,14 @@ PORT_BASE=40000
# may want to create these directories on the segment hosts before running
# gpinitsystem and chown them to the appropriate user.

declare -a DATA_DIRECTORY=(/data0/database/primary /data0/database/primary)

declare -a DATA_DIRECTORY=(/data0/database/primary \
/data0/database/primary \
/data0/database/primary)

# The OS-configured hostname of the Greenplum Database master instance.

MASTER_HOSTNAME=mdw



# The location where the data directory will be created on the
# Greenplum master host.
# You must make sure that the user who runs gpinitsystem
Expand All @@ -75,22 +70,19 @@ MASTER_HOSTNAME=mdw

MASTER_DIRECTORY=/data0/database/master


# The port number for the master instance. This is the port number
# that users and client connections will use when accessing the
# Greenplum Database system.

MASTER_PORT=5432


# The shell the gpinitsystem script uses to execute
# commands on remote hosts. Allowed value is ssh. You must set up
# your trusted host environment before running the gpinitsystem
# script. You can use gpssh-exkeys to do this.

TRUSTED_SHELL=ssh


# Maximum distance between automatic write ahead log (WAL)
# checkpoints, in log file segments (each segment is normally 16
# megabytes). This will set the checkpoint_segments parameter
Expand All @@ -99,7 +91,6 @@ TRUSTED_SHELL=ssh

CHECK_POINT_SEGMENTS=8


# The character set encoding to use. Greenplum supports the
# same character sets as PostgreSQL. See 'Character Set Support'
# in the PostgreSQL documentation for allowed character sets.
Expand All @@ -108,7 +99,6 @@ CHECK_POINT_SEGMENTS=8

ENCODING=UNICODE


################################################
# OPTIONAL PARAMETERS
################################################
Expand All @@ -119,7 +109,13 @@ ENCODING=UNICODE

DATABASE_NAME=gpadmin

# MIRROR_PORT_BASE=50000
# Mirror configuration

MIRROR_PORT_BASE=50000

declare -a MIRROR_DATA_DIRECTORY=(/data0/database/mirror \
/data0/database/mirror \
/data0/database/mirror)

# REPLICATION_PORT_BASE=41000
# MIRROR_REPLICATION_PORT_BASE=51000
# declare -a MIRROR_DATA_DIRECTORY=(/data0/database/mirror /data0/database/mirror)
Loading