Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Beta 1 distribution #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.tar.gz
*.zip
65 changes: 42 additions & 23 deletions Dockerfile.ubuntu-focal
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@ FROM ubuntu:focal as base
LABEL org.opencontainers.image.authors="[email protected]"

ARG MAX_JOBS
ARG RELEASE

ENV MAX_JOBS=${MAX_JOBS:-2}
ENV RELEASE=${RELEASE:-BABEL_1_0_0__PG_13_4}
ENV CODE_PATH=/opt/babelfishpg/
ENV EXT_CODE_PATH=/opt/babelfishpg_ext
# ENV EXT_CODE_PATH=/opt/babelfishpg_ext

ENV PREFIX=/opt/target/babelfishpg
ENV ANTLR_RUNTIME=/opt/antlr4

ENV PG_SRC=/opt/babelfishpg/
# ENV PG_SRC=/opt/babelfishpg/
ENV PG_CONFIG=${PREFIX}/bin/pg_config
ENV ANTLR4_RUNTIME_INCLUDE_DIR=/usr/local/include/antlr4-runtime/

ENV ANTLR4_JAVA_BIN=/usr/bin/java

ENV PG_SRC=${CODE_PATH}
# ENV cmake=$(which cmake)


RUN set -ex; \
apt update

Expand Down Expand Up @@ -69,9 +75,16 @@ RUN mkdir build && cd build && \
-DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_DEMO=True && \
make && make install

RUN git clone https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git ${CODE_PATH}
RUN git clone https://github.com/babelfish-for-postgresql/babelfish_extensions.git ${EXT_CODE_PATH}
# RUN git clone https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git ${CODE_PATH}
# RUN git clone https://github.com/babelfish-for-postgresql/babelfish_extensions.git ${EXT_CODE_PATH}

## Support for ANTLR 4.8.
## There is an ongoing work to have broader version support for ANTLR.
# RUN cp /usr/lib/x86_64-linux-gnu/libantlr4-runtime.so* ${PREFIX}/lib
ENV add=
ADD ${RELEASE}.zip /opt/${RELEASE}.zip

RUN unzip -d ${CODE_PATH} /opt/${RELEASE}.zip

WORKDIR ${CODE_PATH}

Expand All @@ -87,40 +100,46 @@ RUN ./configure CFLAGS="${CFLAGS:--Wall -Wmissing-prototypes -Wpointer-arith -Wd
--with-icu \
--with-extra-version=" Babelfish for PostgreSQL"


# Compilation
RUN make clean && make DESTDIR=${PREFIX}/tmp_install -j ${MAX_JOBS} world-bin
RUN make clean && make DESTDIR=${PREFIX} -j ${MAX_JOBS}
#world-bin

# Install core
RUN make install

RUN cp /usr/local/lib/libantlr4-runtime.so.4.9.2 ${PREFIX}/lib

RUN cd contrib/ && make && cd ..
RUN ["/usr/bin/bash", "-c", "cmake=$(which cmake) ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime ; cd ${CODE_PATH}/contrib/babelfishpg_tsql/antlr ; cmake . "]

RUN cmake=$(which cmake) ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime make install && cd contrib/ && make install

# tmp_install
# Build all the extensions
RUN cd contrib/ && make && make install && cd ..

# # Regression Tests
# RUN make DESTDIR=${PREFIX}/tmp_install EXTRA_REGRESS_OPTS=--debug -j ${MAX_JOBS} check

# Install core and core contribs
RUN make install && cd contrib/ && make install

WORKDIR ${EXT_CODE_PATH}

## Support for ANTLR 4.8.
## There is an ongoing work to have broader version support for ANTLR.
# RUN cp /usr/lib/x86_64-linux-gnu/libantlr4-runtime.so* ${PREFIX}/lib

RUN cp /usr/local/lib/libantlr4-runtime.so.4.9.2 ${PREFIX}/lib

# WORKDIR ${EXT_CODE_PATH}

# ENV USE_PGXS=1

ENV USE_PGXS=1

## [WIP] Support for ANTLR 4.8
# XXX: current make is not taking in account this environment settings
# ANTLR_EXECUTABLE=${PREFIX}/antlr-4.8-complete.jar ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime
RUN ["/usr/bin/bash", "-c", "cd ${EXT_CODE_PATH}/contrib/babelfishpg_tsql/antlr ; cmake . "]

RUN PG_CONFIG=${PG_CONFIG} PG_SRC=${PG_SRC} cmake=$(which cmake) ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime ; \
for EXT in babelfishpg_common babelfishpg_money babelfishpg_tds babelfishpg_tsql ; \
do \
cd ${EXT_CODE_PATH}/contrib/${EXT} ; \
make clean && make && make install ; \
done


# RUN PG_CONFIG=${PG_CONFIG} PG_SRC=${CODE_PATH} cmake=$(which cmake) ANTLR4_RUNTIME_LIBRARIES=/usr/include/antlr4-runtime ; \
# for EXT in babelfishpg_common babelfishpg_money babelfishpg_tds babelfishpg_tsql ; \
# do \
# cd ${EXT_CODE_PATH}/contrib/${EXT} ; \
# make clean && make && make install ; \
# done


FROM base AS babelfish
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
args:
buildno: 1
MAX_JOBS: 4
RELEASE: BABEL_1_0_0__PG_13_4
image: babelfishpg:ubuntu.focal
ports:
- 1433:1433
Expand All @@ -25,6 +26,19 @@ services:
networks:
- babelfish

jdbctests:
container_name: jdbctests
image: maven
networks:
- babelfish
volumes:
- ./BABEL_1_0_0__PG_13_4.zip:/opt/BABEL_1_0_0__PG_13_4.zip
command: >
bash -c "microdnf install unzip
&& unzip -d /opt/babelfishpg /opt/BABEL_1_0_0__PG_13_4.zip
&& cd /opt/babelfishpg/contrib/test/JDBC/
&& mvn test"

networks:
babelfish:

4 changes: 3 additions & 1 deletion entrypoint-ubuntu-focal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ docker_setup_babelfish_db() {
EOSQL
echo
echo "Adding $BABELFISH_DB to postgresql.conf for babelfishpg_tsql.database_name"
echo "babelfishpg_tsql.database_name = '$BABELFISH_DB'" >> $PGDATA/postgresql.conf
#echo -n "\nbabelfishpg_tsql.database_name = '$BABELFISH_DB'" >> $PGDATA/postgresql.conf
sed -i -e "\$ababelfishpg_tsql.database_name = '$BABELFISH_DB'" $PGDATA/postgresql.conf
sed -i -e "\$ababelfishpg_tds.set_db_session_property = true" $PGDATA/postgresql.conf

docker_process_sql --dbname $POSTGRES_DB -c 'select pg_reload_conf();'
}
Expand Down