Skip to content

Commit

Permalink
Fix mongodb build on docker applying patch for ssl=no
Browse files Browse the repository at this point in the history
  • Loading branch information
renanccastro committed Mar 24, 2021
1 parent 25e31a4 commit 6377c67
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
57 changes: 57 additions & 0 deletions 0001-Fix-SSL-off-build-OCSPManager-shouldn-t-be-used-when.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 5101ec645038dd09edc8f4c295aacdf1c3827eeb Mon Sep 17 00:00:00 2001
From: Renan Castro <[email protected]>
Date: Wed, 24 Mar 2021 15:53:12 -0300
Subject: [PATCH] Fix SSL off build, OCSPManager shouldn't be used when ssl =
off

---
src/mongo/db/db.cpp | 2 ++
src/mongo/s/server.cpp | 2 ++
src/mongo/shell/dbshell.cpp | 2 ++
3 files changed, 6 insertions(+)

diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 4804715116..a920e69c96 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -338,7 +338,9 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) {
auto runner = makePeriodicRunner(serviceContext);
serviceContext->setPeriodicRunner(std::move(runner));

+#ifdef MONGO_CONFIG_SSL
OCSPManager::get()->startThreadPool();
+#endif

if (!storageGlobalParams.repair) {
auto tl =
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index e2f3550486..41d2327ad2 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -640,7 +640,9 @@ ExitCode runMongosServer(ServiceContext* serviceContext) {
serviceContext->setPeriodicRunner(std::move(runner));
}

+#ifdef MONGO_CONFIG_SSL
OCSPManager::get()->startThreadPool();
+#endif

serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongos>(serviceContext));

diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index 9fc8a96911..cdaff940c6 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -728,7 +728,9 @@ int _main(int argc, char* argv[], char** envp) {
// TODO This should use a TransportLayerManager or TransportLayerFactory
auto serviceContext = getGlobalServiceContext();

+#ifdef MONGO_CONFIG_SSL
OCSPManager::get()->startThreadPool();
+#endif

transport::TransportLayerASIO::Options opts;
opts.enableIPv6 = shellGlobalParams.enableIPv6;
--
2.30.2

4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM centos:7

RUN yum install -y epel-release centos-release-scl
RUN yum install -y python3-devel python3-scons devtoolset-8-gcc devtoolset-8-gcc-c++
RUN yum install -y python3-devel python3-scons devtoolset-8-gcc devtoolset-8-gcc-c++ xz-compat-libs libcurl-devel
RUN yum install -y xz-lzma-compat xz-devel


ADD build.sh .
ENTRYPOINT ["/build.sh"]
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ source /opt/rh/devtoolset-8/enable
pip3 install -r etc/pip/compile-requirements.txt

./buildscripts/scons.py \
mongod mongo \
install-core \
--ssl=off \
--enable-free-mon=off \
-j 12 \
LINKFLAGS='-static-libstdc++' \
CC=/opt/rh/devtoolset-8/root/usr/bin/gcc \
CXX=/opt/rh/devtoolset-8/root/usr/bin/g++

cd build/install/bin
strip mongo mongod
6 changes: 4 additions & 2 deletions run-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ TARGET="mongodb-linux-x86_64-${MONGODB_VERSION}"
BIN="$TARGET/bin"

[ ! -d $SRC ] && curl "https://fastdl.mongodb.org/src/$SRC.tar.gz" | tar -xz
cd $SRC/ && patch -p1 -f -s < ../0001-Fix-SSL-off-build-OCSPManager-shouldn-t-be-used-when.patch
cd ../
docker run --memory=16g --rm -it -v $(pwd)/$SRC:/mongodb mongodb-builder
mkdir -p $BIN
mv "$SRC/mongo" "$SRC/mongod" $BIN
tar -czf "$TARGET.tgz" $TARGET
sudo mv "$SRC/build/install/bin/mongo" "$SRC/build/install/bin/mongod" $BIN
sudo tar -czf "$TARGET.tgz" $TARGET

0 comments on commit 6377c67

Please sign in to comment.