Skip to content
Open
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
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ Linux OS (including RHEL/Rocky Linux, and Ubuntu) and macOS.
### Try out quickly

Welcome to try out Cloudberry via building [one Docker-based
Sandbox](https://github.com/apache/cloudberry-bootcamp), which is tailored to
help you gain a basic understanding of Cloudberry's capabilities and features
a range of materials, including tutorials, sample code, and crash courses.
Sandbox](./devops/sandbox), which is tailored to help you gain a basic
understanding of Cloudberry's capabilities and features a range of
materials, including tutorials, sample code, and crash courses.

## Repositories

Expand All @@ -79,10 +79,8 @@ this, there are several ecosystem repositories for Cloudberry, including the
website, extensions, connectors, adapters, and other utilities.

* [apache/cloudberry-site](https://github.com/apache/cloudberry-site): website and documentation sources.
* [apache/cloudberry-bootcamp](https://github.com/apache/cloudberry-bootcamp): help you quickly try out Cloudberry via one Docker-based Sandbox.
* [apache/cloudberry-gpbackup](https://github.com/apache/cloudberry-gpbackup): backup utility for Cloudberry.
* [apache/cloudberry-backup](https://github.com/apache/cloudberry-backup): backup utility for Cloudberry.
* [apache/cloudberry-go-libs](https://github.com/apache/cloudberry-go-libs): go-libs for Cloudberry.
* [apache/cloudberry-gpbackup-s3-plugin](https://github.com/apache/cloudberry-gpbackup-s3-plugin): S3 plugin for use with Cloudberry backup utility.
* [apache/cloudberry-pxf](https://github.com/apache/cloudberry-pxf): Platform Extension Framework (PXF) for Cloudberry.

## Community & Support
Expand Down
21 changes: 21 additions & 0 deletions devops/sandbox/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# --------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to You under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# --------------------------------------------------------------------
CODEBASE_VERSION=2.0.0
OS_VERSION=rockylinux9
245 changes: 245 additions & 0 deletions devops/sandbox/Dockerfile.RELEASE.rockylinux9
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
# --------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to You under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# --------------------------------------------------------------------
# Multi-stage Dockerfile for Apache Cloudberry Sandbox Environment (Release)
# --------------------------------------------------------------------
# This Dockerfile compiles and installs a specific release version of
# Cloudberry, then creates a runtime environment for testing and development.
# --------------------------------------------------------------------

# --------------------------------------------------------------------
# Build stage: Rocky Linux 9 builder to compile Cloudberry (release tarball)
# --------------------------------------------------------------------
FROM rockylinux/rockylinux:9.6 AS builder

# Install build toolchains and development headers (avoid coreutils/curl conflicts on arm64)
RUN dnf makecache && \
dnf install -y \
epel-release \
git && \
dnf config-manager --disable epel-cisco-openh264 && \
dnf makecache && \
dnf config-manager --disable epel && \
dnf install -y --enablerepo=epel \
the_silver_searcher \
bat \
htop && \
dnf install -y \
bison \
cmake3 \
ed \
file \
flex \
gcc \
gcc-c++ \
gdb \
glibc-langpack-en \
glibc-locale-source \
initscripts \
iproute \
less \
lsof \
m4 \
net-tools \
openssh-clients \
openssh-server \
perl \
rpm-build \
rpmdevtools \
rsync \
sudo \
tar \
unzip \
util-linux-ng \
wget \
sshpass \
which && \
dnf install -y \
apr-devel \
bzip2-devel \
java-11-openjdk \
java-11-openjdk-devel \
krb5-devel \
libcurl-devel \
libevent-devel \
libxml2-devel \
libuuid-devel \
libzstd-devel \
lz4 \
lz4-devel \
openldap-devel \
openssl-devel \
pam-devel \
perl-ExtUtils-Embed \
perl-Test-Simple \
perl-core \
python3-devel \
python3-pytest \
readline-devel \
zlib-devel && \
dnf install -y --enablerepo=crb \
libuv-devel \
libyaml-devel \
perl-IPC-Run \
protobuf-devel && \
dnf clean all && \
cd && XERCES_LATEST_RELEASE=3.3.0 && \
wget -nv "https://archive.apache.org/dist/xerces/c/3/sources/xerces-c-${XERCES_LATEST_RELEASE}.tar.gz" && \
echo "$(curl -sL https://archive.apache.org/dist/xerces/c/3/sources/xerces-c-${XERCES_LATEST_RELEASE}.tar.gz.sha256)" | sha256sum -c - && \
tar xf "xerces-c-${XERCES_LATEST_RELEASE}.tar.gz"; rm "xerces-c-${XERCES_LATEST_RELEASE}.tar.gz" && \
cd xerces-c-${XERCES_LATEST_RELEASE} && \
./configure --prefix=/usr/local/xerces-c && \
make -j$(nproc) && \
make install -C ~/xerces-c-${XERCES_LATEST_RELEASE} && \
rm -rf ~/xerces-c*

# Create gpadmin user and grant passwordless sudo in builder
RUN groupadd -r gpadmin && \
useradd -m -r -g gpadmin -s /bin/bash gpadmin && \
echo "gpadmin ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/gpadmin && \
chmod 440 /etc/sudoers.d/gpadmin

# Switch to gpadmin user
USER gpadmin
WORKDIR /home/gpadmin

# Release version to build (Apache official tarball)
ARG CB_RELEASE_VERSION=2.0.0-incubating

# Download and extract the specified release version from Apache
RUN wget -nv "https://downloads.apache.org/incubator/cloudberry/${CB_RELEASE_VERSION}/apache-cloudberry-${CB_RELEASE_VERSION}-src.tar.gz" -O /home/gpadmin/apache-cloudberry-${CB_RELEASE_VERSION}-src.tar.gz && \
tar -xzf /home/gpadmin/apache-cloudberry-${CB_RELEASE_VERSION}-src.tar.gz -C /home/gpadmin && \
rm -f /home/gpadmin/apache-cloudberry-${CB_RELEASE_VERSION}-src.tar.gz && \
mv /home/gpadmin/apache-cloudberry-${CB_RELEASE_VERSION} /home/gpadmin/cloudberry

# Build Cloudberry using the official build scripts
RUN cd /home/gpadmin/cloudberry && \
export SRC_DIR=/home/gpadmin/cloudberry && \
mkdir -p "${SRC_DIR}/build-logs" && \
# Ensure Cloudberry lib dir exists and has Xerces libs available
sudo rm -rf /usr/local/cloudberry-db && \
sudo mkdir -p /usr/local/cloudberry-db/lib && \
sudo cp -v /usr/local/xerces-c/lib/libxerces-c.so \
/usr/local/xerces-c/lib/libxerces-c-3.*.so \
/usr/local/cloudberry-db/lib/ && \
sudo chown -R gpadmin:gpadmin /usr/local/cloudberry-db && \
# Configure with required features and paths
export LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:$LD_LIBRARY_PATH && \
./configure --prefix=/usr/local/cloudberry-db \
--disable-external-fts \
--enable-debug \
--enable-cassert \
--enable-debug-extensions \
--enable-gpcloud \
--enable-ic-proxy \
--enable-mapreduce \
--enable-orafce \
--enable-orca \
--enable-pax \
--enable-pxf \
--enable-tap-tests \
--with-gssapi \
--with-ldap \
--with-libxml \
--with-lz4 \
--with-pam \
--with-perl \
--with-pgport=5432 \
--with-python \
--with-pythonsrc-ext \
--with-ssl=openssl \
--with-uuid=e2fs \
--with-includes=/usr/local/xerces-c/include \
--with-libraries=/usr/local/cloudberry-db/lib && \
# Build and install
make -j$(nproc) --directory ${SRC_DIR} && \
make -j$(nproc) --directory ${SRC_DIR}/contrib && \
make install --directory ${SRC_DIR} && \
make install --directory "${SRC_DIR}/contrib"

# --------------------------------------------------------------------
# Runtime stage: Rocky Linux 9 runtime with required dependencies
# --------------------------------------------------------------------
FROM rockylinux/rockylinux:9.6

# Install required runtime dependencies, SSH server, sudo, and tools
# Note: Use dnf on Rocky Linux 9
RUN dnf -y update && \
dnf -y install \
openssh-server openssh-clients \
sudo shadow-utils \
bash procps-ng \
ca-certificates \
python3 \
libevent libxml2 libyaml zlib \
krb5-libs openssl readline \
ncurses glibc-langpack-en libuv libicu \
iproute net-tools which rsync perl protobuf \
keyutils libidn2 libstdc++ libzstd lz4 openldap pam pcre2 && \
dnf clean all && rm -rf /var/cache/dnf

# Create gpadmin user and group, grant passwordless sudo
RUN groupadd -r gpadmin && \
useradd -m -r -g gpadmin -s /bin/bash gpadmin && \
echo "gpadmin ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/gpadmin && \
chmod 440 /etc/sudoers.d/gpadmin

# Prepare SSH daemon: generate host keys and ensure runtime dir
RUN ssh-keygen -A && mkdir -p /run/sshd

# Copy built Cloudberry from builder stage
COPY --from=builder /usr/local/cloudberry-db /usr/local/cloudberry-db

# Bring Xerces libs into Cloudberry lib dir
COPY --from=builder /usr/local/xerces-c/lib/libxerces-c.so /usr/local/cloudberry-db/lib/
COPY --from=builder /usr/local/xerces-c/lib/libxerces-c-3.*.so /usr/local/cloudberry-db/lib/

# Copy configuration files to their final destinations
COPY ./configs/90-cbdb-limits.conf /etc/security/limits.d/90-cbdb-limits.conf
COPY ./configs/90-cbdb-sysctl.conf /etc/sysctl.d/90-cbdb-sysctl.conf
COPY ./configs/gpinitsystem_singlenode /tmp/gpinitsystem_singlenode
COPY ./configs/gpinitsystem_multinode /tmp/gpinitsystem_multinode
COPY ./configs/multinode-gpinit-hosts /tmp/multinode-gpinit-hosts
COPY ./configs/init_system.sh /tmp/init_system.sh

# Runtime configuration
ENV LD_LIBRARY_PATH=/usr/local/cloudberry-db/lib:$LD_LIBRARY_PATH
RUN sudo sysctl -p /etc/sysctl.d/90-cbdb-sysctl.conf || true && \
echo "cdw" > /tmp/gpdb-hosts && \
sudo chmod 755 /tmp/gpinitsystem_singlenode && \
sudo chmod 755 /tmp/gpinitsystem_multinode && \
sudo chmod 755 /tmp/init_system.sh && \
mkdir -p /opt/cbdb/cluster-ssh && \
chown gpadmin:gpadmin /opt/cbdb/cluster-ssh && \
mkdir -p /data0/database/coordinator /data0/database/primary /data0/database/mirror && \
chown -R gpadmin:gpadmin /data0 && \
echo "export COORDINATOR_DATA_DIRECTORY=/data0/database/coordinator/gpseg-1" >> /home/gpadmin/.bashrc && \
echo -e '\n# Add Cloudberry entries\nif [ -f /usr/local/cloudberry-db/cloudberry-env.sh ]; then\n source /usr/local/cloudberry-db/cloudberry-env.sh\nfi\n# Add Greenplum compatibility entries\nif [ -f /usr/local/cloudberry-db/greenplum_path.sh ]; then\n source /usr/local/cloudberry-db/greenplum_path.sh\nfi' >> /home/gpadmin/.bashrc

# Set default user and working directory
USER gpadmin
WORKDIR /home/gpadmin

EXPOSE 5432 22

# cgroup mount (provided by compose/run)
VOLUME [ "/sys/fs/cgroup" ]

# Start the container by running the initialization script
CMD ["bash","-c","/tmp/init_system.sh"]
Loading
Loading