Skip to content
Closed
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
23 changes: 12 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04
ARG POSTGRES_INSTALL_ARG=
ARG PG_VERSION=16
ARG IVORY_VERSION=4
ARG CITUS_VERSION=12

# declare installed PG version and Citus version
ENV PG_VERSION=${PG_VERSION}
ENV IVORY_VERSION=${IVORY_VERSION}
ENV CITUS_VERSION=${CITUS_VERSION}

# Install build essentials - Compiler, debugger, make, etc.
Expand Down Expand Up @@ -35,6 +35,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
libtool \
libicu-dev \
libssl-dev \
libxml2-dev \
&& rm -rf /var/lib/apt/lists/*

# Add pgdg repo
Expand All @@ -60,27 +61,27 @@ COPY scripts/utils.sh /tmp/install_setup/

# Install postgres
COPY scripts/install_setup_postgres.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_postgres.sh -d \"/usr/lib/postgresql/${PG_VERSION}\" $POSTGRES_INSTALL_ARG -v ${PG_VERSION}" ]
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_postgres.sh -d \"/var/local/ivorysql/ivory-${IVORY_VERSION}\" $POSTGRES_INSTALL_ARG -v ${IVORY_VERSION}" ]

# Install RUM from source
COPY scripts/install_setup_rum_oss.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_rum_oss.sh" ]
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_rum_oss.sh" ]

# Install citus
COPY scripts/install_setup_citus_core_oss.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_citus_core_oss.sh ${CITUS_VERSION}" ]
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_citus_core_oss.sh ${CITUS_VERSION}" ]

# Install citus-indent
COPY scripts/install_citus_indent.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "/tmp/install_setup/install_citus_indent.sh" ]

# Install SYSTEM_ROWS
COPY scripts/install_setup_system_rows.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_system_rows.sh" ]
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_system_rows.sh" ]

# Install PG_CRON
COPY scripts/install_setup_pg_cron.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_pg_cron.sh" ]
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_pg_cron.sh" ]

# Download Decimal128 Intel library
COPY scripts/install_setup_intel_decimal_math_lib.sh /tmp/install_setup/
Expand All @@ -92,7 +93,7 @@ RUN [ "bin/bash", "-c", "/tmp/install_setup/install_setup_pcre2.sh" ]

# Install PG_VECTOR
COPY scripts/install_setup_pgvector.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_pgvector.sh" ]
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_pgvector.sh" ]

# Install PostGIS from source
RUN apt-get update && \
Expand All @@ -105,7 +106,7 @@ RUN apt-get update && \
&& rm -rf /var/lib/apt/lists/*

COPY scripts/install_setup_postgis.sh /tmp/install_setup/
RUN [ "bin/bash", "-c", "PGVERSION=$PG_VERSION /tmp/install_setup/install_setup_postgis.sh" ]
RUN [ "bin/bash", "-c", "IVORYVERSION=$IVORY_VERSION /tmp/install_setup/install_setup_postgis.sh" ]

# locale
RUN rm -rf /var/lib/apt/lists/* \
Expand All @@ -121,10 +122,10 @@ RUN echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/no-pass-ask

# Add postgres to path for sudo commands.
# Add path for sudoers
RUN cat /etc/sudoers | grep secure_path | sed "s/\:\/bin\:/\:\/bin\:\/usr\/lib\/postgresql\/$PG_VERSION\/bin\:/" >> /etc/sudoers.d/postgres_path
RUN cat /etc/sudoers | grep secure_path | sed "s/\:\/bin\:/\:\/bin\:\/var\/local\/ivorysql\/ivory-$IVORY_VERSION\/bin\:/" >> /etc/sudoers.d/postgres_path

# Add PG to the path
ENV PATH=$PATH:/usr/lib/postgresql/$PG_VERSION/bin
ENV PATH=$PATH:/var/local/ivorysql/ivory-$IVORY_VERSION/bin

USER documentdb
WORKDIR /home/documentdb
8 changes: 4 additions & 4 deletions scripts/build_and_start_gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,21 @@ while [[ -L $source ]]; do
done
scriptDir="$(cd -P "$(dirname "$source")" && pwd)"

# Check if PostgreSQL is running with a timeout of 10 minutes
# Check if IvorySQL is running with a timeout of 10 minutes
timeout=600
interval=5
elapsed=0

echo "Waiting for PostgreSQL to be ready on $hostname:$port..."
echo "Waiting for IvorySQL to be ready on $hostname:$port..."
while ! pg_isready -h "$hostname" -p "$port" > /dev/null 2>&1; do
if [ "$elapsed" -ge "$timeout" ]; then
echo "PostgreSQL did not become ready within 10 minutes. Exiting."
echo "IvorySQL did not become ready within 10 minutes. Exiting."
exit 1
fi
sleep "$interval"
elapsed=$((elapsed + interval))
done
echo "PostgreSQL is ready."
echo "IvorySQL is ready."

if [ "$clean" = "true" ]; then
echo "Cleaning the build directory..."
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_extension_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if [ -f $gitIndexDir ]; then
else
# set GIT_VERSION with current branch's name and the short sha of the HEAD
GIT_VERSION=$(git rev-parse --abbrev-ref HEAD)
GIT_SHA=$(git rev-parse --short HEAD)
GIT_SHA=$(git rev-parse --short=10 HEAD)
fi

if [[ "$GIT_VERSION" == "" ]] || [[ "$GIT_SHA" == "" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions scripts/install_setup_citus_core_oss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
CITUS_REF=$(GetCitusVersion $citusVersion)

. $scriptDir/utils.sh
if [ "${PGVERSION:-}" != "" ]; then
pgPath=$(GetPostgresPath $PGVERSION)
if [ "${IVORYVERSION:-}" != "" ]; then
pgPath=$(GetPostgresPath $IVORYVERSION)
PATH=$pgPath:$PATH
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/install_setup_pg_cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
CITUS_PG_CRON_REF=$(GetPgCronVersion)

. $scriptDir/utils.sh
pgBinDir=$(GetPostgresPath $PGVERSION)
pgBinDir=$(GetPostgresPath $IVORYVERSION)
PATH=$pgBinDir:$PATH;

pushd $INSTALL_DEPENDENCIES_ROOT
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_setup_pgvector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
echo "scriptDir: $scriptDir"

. $scriptDir/utils.sh
pgBinDir=$(GetPostgresPath $PGVERSION)
pgBinDir=$(GetPostgresPath $IVORYVERSION)
PATH=$pgBinDir:$PATH;

. $scriptDir/setup_versions.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_setup_postgis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
POSTGIS_REF=$(GetPostgisVersion)

. $scriptDir/utils.sh
pgBinDir=$(GetPostgresPath $PGVERSION)
pgBinDir=$(GetPostgresPath $IVORYVERSION)

POSTGIS_REPO=postgis-repo
rm -rf $POSTGIS_REPO
Expand Down
36 changes: 18 additions & 18 deletions scripts/install_setup_postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ set -e
# fail if trying to reference a variable that is not set.
set -u

postgresqlInstallDir=""
ivorysqlInstallDir=""
debug="false"
cassert="false"
help="false";
pgVersion=""
ivyVersion=""
while getopts "d:hxcv:" opt; do
case $opt in
d) postgresqlInstallDir="$OPTARG"
d) ivorysqlInstallDir="$OPTARG"
;;
x) debug="true"
;;
c) cassert="true"
;;
h) help="true"
;;
v) pgVersion="$OPTARG"
v) ivyVersion="$OPTARG"
;;
esac

Expand All @@ -34,18 +34,18 @@ while getopts "d:hxcv:" opt; do
done

if [ "$help" == "true" ]; then
echo "downloads postgresql-14.2 sources, build and install it."
echo "[-d] the directory to install postgresql to. Default: /usr/lib/postgresql/14"
echo "downloads IvorySQL-14.2 sources, build and install it."
echo "[-d] the directory to install IvorySQL to. Default: /usr/lib/IvorySQL/14"
echo "[-x] build with debug symbols."
exit 1;
fi

if [ -z $postgresqlInstallDir ]; then
if [ -z $ivorysqlInstallDir ]; then
echo "Postgres Install Directory must be specified."
exit 1;
fi

if [ -z $pgVersion ]; then
if [ -z $ivyVersion ]; then
echo "PG Version must be specified";
exit 1;
fi
Expand All @@ -62,29 +62,29 @@ done
scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"

. $scriptDir/setup_versions.sh
POSTGRESQL_REF=$(GetPostgresSourceRef $pgVersion)
IvorySQL_REF=$(GetPostgresSourceRef $ivyVersion)

pushd $INSTALL_DEPENDENCIES_ROOT

rm -rf postgres-repo/$pgVersion
mkdir -p postgres-repo/$pgVersion
cd postgres-repo/$pgVersion
rm -rf postgres-repo/$ivyVersion
mkdir -p postgres-repo/$ivyVersion
cd postgres-repo/$ivyVersion

git init
git remote add origin https://github.com/postgres/postgres
git remote add origin https://github.com/IvorySQL/IvorySQL

# checkout to the commit specified in the cgmanifest.json
git fetch --depth 1 origin "$POSTGRESQL_REF"
git fetch --depth 1 origin "$IvorySQL_REF"
git checkout FETCH_HEAD

echo "building and installing postgresql ref $POSTGRESQL_REF and installing to $postgresqlInstallDir..."
echo "building and installing IvorySQL ref $IvorySQL_REF and installing to $ivorysqlInstallDir..."

if [ "$debug" == "true" ]; then
./configure --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer" --with-openssl --prefix="$postgresqlInstallDir" --with-icu
./configure --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -Og -g3 -fno-omit-frame-pointer" --with-openssl --prefix="$ivorysqlInstallDir" --with-icu
elif [ "$cassert" == "true" ]; then
./configure --enable-debug --enable-cassert --enable-tap-tests --with-openssl --prefix="$postgresqlInstallDir" --with-icu
./configure --enable-debug --enable-cassert --enable-tap-tests --with-openssl --prefix="$ivorysqlInstallDir" --with-icu
else
./configure --enable-debug --enable-tap-tests --with-openssl --prefix="$postgresqlInstallDir" --with-icu
./configure --enable-debug --enable-tap-tests --with-openssl --prefix="$ivorysqlInstallDir" --with-icu
fi

make clean && make -sj$(cat /proc/cpuinfo | grep -c "processor") install
Expand Down
4 changes: 2 additions & 2 deletions scripts/install_setup_rum_oss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ echo "scriptDir: $scriptDir"
RUM_REF=$(GetRumVersion)

. $scriptDir/utils.sh
if [ "${PGVERSION:-}" != "" ]; then
pgPath=$(GetPostgresPath $PGVERSION)
if [ "${IVORYVERSION:-}" != "" ]; then
pgPath=$(GetPostgresPath $IVORYVERSION)
PATH=$pgPath:$PATH
fi

Expand Down
6 changes: 3 additions & 3 deletions scripts/install_setup_system_rows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ done
scriptDir="$( cd -P "$( dirname "$source" )" && pwd )"
. $scriptDir/utils.sh
. $scriptDir/setup_versions.sh
POSTGRESQL_REF=$(GetPostgresSourceRef $PGVERSION)
POSTGRESQL_REF=$(GetPostgresSourceRef $IVORYVERSION)

pushd $INSTALL_DEPENDENCIES_ROOT

Expand All @@ -26,13 +26,13 @@ mkdir postgres-repo-for-system-rows
cd postgres-repo-for-system-rows

git init
git remote add origin https://github.com/postgres/postgres
git remote add origin https://github.com/IvorySQL/IvorySQL

# checkout to the commit specified in the cgmanifest.json
git fetch --depth 1 origin "$POSTGRESQL_REF"
git checkout FETCH_HEAD

pgBinDir=$(GetPostgresPath $PGVERSION)
pgBinDir=$(GetPostgresPath $IVORYVERSION)
PATH=$pgBinDir:$PATH;

echo "building and installing tsm_system_rows extension with pg path $pgBinDir ..."
Expand Down
24 changes: 12 additions & 12 deletions scripts/setup_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ set -e
# declare all the versions of dependencies
LIBBSON_VERSION=1.28.0
# This maps to REL_17_4:f8554dee417ffc4540c94cf357f7bf7d4b6e5d80
POSTGRES_17_REF="REL_17_4"
IvorySQL_4_REF="IvorySQL_4.5"
# This maps to REL_16_8:71eb35c0b18de96537bd3876ec9bf8075bfd484f
POSTGRES_16_REF="REL_16_8"
IvorySQL_3_REF="IvorySQL_3.4"
# This maps to REL15_12:50d3d22baba63613d1f1406b2ed460dc9b03c3fc
POSTGRES_15_REF="REL_15_12"
IvorySQL_2_REF="Ivory_REL_2_3"
# This is commit f3cb3d99eed7dd3db82104ab2a4a13b1233d0023
CITUS_VERSION=v12.1.7
# This is commit d28a5eae6c78935313824d319480632783d48d10
Expand All @@ -31,23 +31,23 @@ UNCRUSTIFY_VERSION=uncrustify-0.68.1

function GetPostgresSourceRef()
{
local pgVersion=$1
if [ "$pgVersion" == "17" ]; then
echo $POSTGRES_17_REF
elif [ "$pgVersion" == "16" ]; then
echo $POSTGRES_16_REF
elif [ "$pgVersion" == "15" ]; then
echo $POSTGRES_15_REF
local ivyVersion=$1
if [ "$ivyVersion" == "4" ]; then
echo $IvorySQL_4_REF
elif [ "$ivyVersion" == "3" ]; then
echo $IvorySQL_3_REF
elif [ "$ivyVersion" == "2" ]; then
echo $IvorySQL_2_REF
else
echo "Invalid PG Version specified $pgVersion";
echo "Invalid PG Version specified $ivyVersion";
exit 1;
fi
}

function GetCitusVersion()
{
local citusVersion=$1
if [ "$PGVERSION" == "17" ]; then
if [ "$IVORYVERSION" == "4" ]; then
echo $CITUS_13_VERSION
elif [ "$citusVersion" == "13" ] || [ "$citusVersion" == "v13.0" ] || [ "$citusVersion" == "$CITUS_13_VERSION" ]; then
echo $CITUS_13_VERSION
Expand Down
Loading
Loading