Skip to content

Commit

Permalink
Rest API 2. Added Drogon and simdjson libs (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
smkniazi authored Nov 22, 2023
1 parent fa49d31 commit 1b1d87f
Show file tree
Hide file tree
Showing 1,181 changed files with 348,815 additions and 4 deletions.
24 changes: 24 additions & 0 deletions Dockerfile.oraclelinux7
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARG BOOST_VERSION_MAJOR=1
ARG BOOST_VERSION_MINOR=77
ARG BOOST_VERSION_PATCH=0
ARG GO_VERSION=1.20.3
ARG JSONCPP_VERSION=1.9.5

# Default build threads to 1; max is defined in Docker config (run `nproc` in Docker container)
ARG BUILD_THREADS
Expand Down Expand Up @@ -96,6 +97,7 @@ RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
ENV OPENSSL_ROOT_DIR=$OPENSSL_ROOT
RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
source scl_source enable devtoolset-11 \
&& rm -f $DOWNLOADS_CACHE_DIR/cmake-$CMAKE_VERSION.tar.gz \
&& wget -N --progress=bar:force -P $DOWNLOADS_CACHE_DIR \
https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION.tar.gz \
&& tar xzf $DOWNLOADS_CACHE_DIR/cmake-$CMAKE_VERSION.tar.gz -C . \
Expand Down Expand Up @@ -135,6 +137,28 @@ COPY <<-"EOF" /root/.m2/settings.xml
</settings>
EOF

# install updated jsoncpp
RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
wget -N --progress=bar:force -P $DOWNLOADS_CACHE_DIR \
https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/$JSONCPP_VERSION.tar.gz \
&& tar xf $DOWNLOADS_CACHE_DIR/$JSONCPP_VERSION.tar.gz -C . \
&& source scl_source enable devtoolset-11 \
&& ls -al \
&& cd jsoncpp-$JSONCPP_VERSION \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=ON -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp .. \
&& make -j$THREADS_ARG \
&& make install \
&& cd ../.. \
&& rm -rf jsoncpp-$JSONCPP_VERSION $JSONCPP_VERSION.tar.gz

RUN --mount=type=cache,target=/var/cache/yum,id=oracle7-yum \
ulimit -n 1024000 && \
yum -y update \
&& yum -y install \
uuid-devel libudev-devel

# See https://stackoverflow.com/a/51264575/9068781 for conditional envs
FROM rondb-build-dependencies as build-all

Expand Down
19 changes: 18 additions & 1 deletion Dockerfile.oraclelinux8
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ARG BOOST_VERSION_MAJOR=1
ARG BOOST_VERSION_MINOR=77
ARG BOOST_VERSION_PATCH=0
ARG GO_VERSION=1.20.3
ARG JSONCPP_VERSION=1.9.5

# Default build threads to 1; max is defined in Docker config (run `nproc` in Docker container)
ARG BUILD_THREADS
Expand Down Expand Up @@ -49,7 +50,7 @@ RUN --mount=type=cache,target=/var/cache/yum,id=oracle8-yum \
wget make git which perl-core openldap-devel \
bison krb5-server krb5-workstation krb5-devel \
numactl numactl-libs numactl-devel \
libudev-devel \
uuid-devel libudev-devel \
patchelf ncurses-devel java-1.8.0-openjdk-devel automake \
zlib-devel scl-utils \
vim pigz hostname
Expand Down Expand Up @@ -141,6 +142,22 @@ COPY <<-"EOF" /root/.m2/settings.xml
</settings>
EOF

# install updated jsoncpp
RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
wget -N --progress=bar:force -P $DOWNLOADS_CACHE_DIR \
https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/$JSONCPP_VERSION.tar.gz \
&& tar xf $DOWNLOADS_CACHE_DIR/$JSONCPP_VERSION.tar.gz -C . \
&& source scl_source enable gcc-toolset-12 \
&& ls -al \
&& cd jsoncpp-$JSONCPP_VERSION \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=ON -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp .. \
&& make -j$THREADS_ARG \
&& make install \
&& cd ../.. \
&& rm -rf jsoncpp-$JSONCPP_VERSION $JSONCPP_VERSION.tar.gz

# See https://stackoverflow.com/a/51264575/9068781 for conditional envs
FROM rondb-build-dependencies as build-all

Expand Down
19 changes: 18 additions & 1 deletion Dockerfile.oraclelinux9
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ARG BOOST_VERSION_MAJOR=1
ARG BOOST_VERSION_MINOR=77
ARG BOOST_VERSION_PATCH=0
ARG GO_VERSION=1.20.3
ARG JSONCPP_VERSION=1.9.5

# Default build threads to 1; max is defined in Docker config (run `nproc` in Docker container)
ARG BUILD_THREADS
Expand Down Expand Up @@ -67,7 +68,7 @@ RUN --mount=type=cache,target=/var/cache/yum,id=oracle9-yum \
yum -y install \
bison krb5-server krb5-workstation krb5-devel \
numactl numactl-libs numactl-devel \
libudev-devel \
uuid-devel libudev-devel \
patchelf ncurses-devel java-1.8.0-openjdk-devel automake \
vim pigz hostname libtirpc-devel

Expand Down Expand Up @@ -128,6 +129,22 @@ COPY <<-"EOF" /root/.m2/settings.xml
</settings>
EOF

# install updated jsoncpp
RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
wget -N --progress=bar:force -P $DOWNLOADS_CACHE_DIR \
https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/$JSONCPP_VERSION.tar.gz \
&& tar xf $DOWNLOADS_CACHE_DIR/$JSONCPP_VERSION.tar.gz -C . \
&& source scl_source enable gcc-toolset-12 \
&& ls -al \
&& cd jsoncpp-$JSONCPP_VERSION \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=ON -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp .. \
&& make -j$THREADS_ARG \
&& make install \
&& cd ../.. \
&& rm -rf jsoncpp-$JSONCPP_VERSION $JSONCPP_VERSION.tar.gz

# See https://stackoverflow.com/a/51264575/9068781 for conditional envs
FROM rondb-build-dependencies as build-all

Expand Down
21 changes: 21 additions & 0 deletions Dockerfile.ubuntu22
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG BOOST_VERSION_MAJOR=1
ARG BOOST_VERSION_MINOR=77
ARG BOOST_VERSION_PATCH=0
ARG GO_VERSION=1.20.3
ARG JSONCPP_VERSION=1.9.5

# Default build threads to 1; max is defined in Docker config (run `nproc` in Docker container)
ARG BUILD_THREADS
Expand Down Expand Up @@ -126,6 +127,26 @@ COPY <<-"EOF" /root/.m2/settings.xml
</settings>
EOF

# install updated jsoncpp
RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
wget -N --progress=bar:force -P $DOWNLOADS_CACHE_DIR \
https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/$JSONCPP_VERSION.tar.gz \
&& tar xf $DOWNLOADS_CACHE_DIR/$JSONCPP_VERSION.tar.gz -C . \
&& cd jsoncpp-$JSONCPP_VERSION \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=ON -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=include/jsoncpp .. \
&& make -j$THREADS_ARG \
&& make install \
&& cd ../.. \
&& rm -rf jsoncpp-$JSONCPP_VERSION $JSONCPP_VERSION.tar.gz

RUN --mount=type=cache,target=$DOWNLOADS_CACHE_DIR \
--mount=type=cache,target=/var/cache/apt,id=ubuntu22-apt \
--mount=type=cache,target=/var/lib/apt/lists,id=ubuntu22-apt-lists \
apt-get update -y \
&& apt-get install -y uuid-dev libudev-dev

RUN mkdir rondb-src rondb-bin rondb-tarball

# See https://stackoverflow.com/a/51264575/9068781 for conditional envs
Expand Down
7 changes: 6 additions & 1 deletion build_scripts/build_script_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ BISON_SETTING=
if test "x$BISON_PATH" != "x" ; then
BISON_SETTING="-DBISON_EXECUTABLE=$BISON_PATH"
fi
cmake $BISON_SETTING -DWITH_DEBUG=1 -DWITH_SSL=$OPENSSL_ROOT -DWITH_RDRS=1 -DWITH_NDB=1 -DWITH_NDB_TEST=1 -DWITH_NDBAPI_EXAMPLES=1 -DWITH_ROUTER=0 -DWITH_UNIT_TESTS=1 -DWITH_ERROR_INSERT=1 -DWITH_BOOST=$BOOST_ROOT -DWITH_NDB_JAVA=1 -DWITH_LIBEVENT=bundled -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE $SRC_DIR

if ! [ -z "${PREFIX_DIR}" ]; then
PREFIX_DIR="-DCMAKE_INSTALL_PREFIX=${PREFIX_DIR}"
fi

cmake $BISON_SETTING -DWITH_DEBUG=1 -DWITH_SSL=$OPENSSL_ROOT -DWITH_RDRS=1 -DWITH_NDB=1 -DWITH_NDB_TEST=1 -DWITH_NDBAPI_EXAMPLES=1 -DWITH_ROUTER=0 -DWITH_UNIT_TESTS=1 -DWITH_ERROR_INSERT=1 -DWITH_BOOST=$BOOST_ROOT -DWITH_NDB_JAVA=1 -DWITH_LIBEVENT=bundled -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE $PREFIX_DIR $SRC_DIR
make -j$(nproc)
6 changes: 5 additions & 1 deletion storage/ndb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ ENDIF()

ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(test)
ADD_SUBDIRECTORY(rest-server)
IF(WITH_NDB_TEST)
ADD_SUBDIRECTORY(src/cw/cpcd)
ENDIF()
Expand Down Expand Up @@ -343,3 +342,8 @@ IF(WITH_NDBAPI_EXAMPLES)
ENDIF()

ADD_SUBDIRECTORY(wix)

IF(WITH_RDRS)
ADD_SUBDIRECTORY(rest-server)
ADD_SUBDIRECTORY(rest-server2)
ENDIF()
17 changes: 17 additions & 0 deletions storage/ndb/rest-server2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is part of the RonDB REST API Server
# Copyright (c) 2023 Hopsworks AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

add_subdirectory(extra)
add_subdirectory(server)
17 changes: 17 additions & 0 deletions storage/ndb/rest-server2/extra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is part of the RonDB REST API Server
# Copyright (c) 2023 Hopsworks AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

add_subdirectory(drogon)
add_subdirectory(simdjson)
67 changes: 67 additions & 0 deletions storage/ndb/rest-server2/extra/drogon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This file is part of the RonDB REST API Server
# Copyright (c) 2023 Hopsworks AB
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

if(NOT WITH_RDRS)
MESSAGE(STATUS "Skip building Drogon for REST Server")
RETURN()
endif()

SET(DROGON_VERSION 1.8.7)
set(RDRS_DROGON_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/drogon-${DROGON_VERSION})
set(RDRS_DROGON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/drogon-${DROGON_VERSION})
set(RDRS_DROGON_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/drogon-${DROGON_VERSION}/install_dir)

IF(CRYPTO_CUSTOM_LIBRARY)
SET(RDRS_CRYPTO_LIBRARY ${CRYPTO_CUSTOM_LIBRARY})
ELSE()
SET(RDRS_CRYPTO_LIBRARY ${CRYPTO_LIBRARY})
ENDIF()

IF(OPENSSL_CUSTOM_LIBRARY)
SET(RDRS_OPENSSL_LIBRARY ${OPENSSL_CUSTOM_LIBRARY})
ELSE()
SET(RDRS_OPENSSL_LIBRARY ${OPENSSL_LIBRARY})
ENDIF()

MESSAGE(STATUS "RDRS DROGON RDRS_OPENSSL_LIBRARY ${RDRS_OPENSSL_LIBRARY}")
MESSAGE(STATUS "RDRS DROGON RDRS_CRYPTO_LIBRARY ${RDRS_CRYPTO_LIBRARY}")

FILE(WRITE "${RDRS_DROGON_BINARY_DIR}/builder.sh" "
set -e
if ! [ -f built ]; then
cmake \
-S${RDRS_DROGON_SOURCE_DIR} \
-B${RDRS_DROGON_BINARY_DIR} \
-DCMAKE_INSTALL_PREFIX=${RDRS_DROGON_INSTALL_DIR} \
-DRDRS_OPENSSL_LIBRARY=${RDRS_OPENSSL_LIBRARY} \
-DRDRS_CRYPTO_LIBRARY=${RDRS_CRYPTO_LIBRARY} \
-DRDRS_OPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR} \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
make -s -j $(nproc)
make install
touch built
else
echo Skipping Drogon web framework as it is already built. Delete ${RDRS_DROGON_BINARY_DIR}/built to rebuilt it
fi"
)

EXECUTE_PROCESS(COMMAND bash builder.sh WORKING_DIRECTORY ${RDRS_DROGON_BINARY_DIR} COMMAND_ERROR_IS_FATAL ANY)
ADD_CUSTOM_TARGET(DROGON_IS_BUILD DEPENDS ${RDRS_DROGON_BINARY_DIR}/built)

SET(RDRS_DROGON_CMAKE_MODULES_DIR ${RDRS_DROGON_INSTALL_DIR}/lib/cmake CACHE INTERNAL "Drogon cmake module dir" FORCE)
SET(RDRS_DROGON_CMAKE_MODULES_DIR_64 ${RDRS_DROGON_INSTALL_DIR}/lib64/cmake CACHE INTERNAL "Drogon cmake module dir" FORCE)
SET(RDRS_DROGON_INCLUDE_DIR ${RDRS_DROGON_INSTALL_DIR}/include CACHE INTERNAL "(Drogon include dir" FORCE)
SET(RDRS_DROGON_LIB_DIR ${RDRS_DROGON_INSTALL_DIR}/lib CACHE INTERNAL "(Drogon lib dir" FORCE)

Loading

0 comments on commit 1b1d87f

Please sign in to comment.