Skip to content

Commit e6a9505

Browse files
committed
Add Clouseau to the Docker images
This change makes it possible to run tests that require the Search functionality to be configured. Therefore the test coverage could be increased and issues could be caught with the related applications, such as Dreyfus and the `text` searches in Mango. Note that because Clouseau requires a relatively old version of JDK, it could be run on x86-64-based systems only.
1 parent 399ab8b commit e6a9505

File tree

11 files changed

+181
-11
lines changed

11 files changed

+181
-11
lines changed

bin/install-clouseau.sh

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/usr/bin/env bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
# stop on error
21+
set -e
22+
23+
CLOUSEAU_VSN=${CLOUSEAU_VERSION:-2.22.0}
24+
CLOUSEAU_DIST=https://github.com/cloudant-labs/clouseau/releases/download/"${CLOUSEAU_VSN}"/clouseau-"${CLOUSEAU_VSN}"-dist.zip
25+
26+
# Dependencies:
27+
# - SLF4J Provider
28+
SLF4J_VSN=${SLF4J_VERSION:-1.6.1}
29+
SLF4J_SIMPLE_JAR=https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/"${SLF4J_VSN}"/slf4j-simple-"${SLF4J_VSN}".jar
30+
# - JDK
31+
ZULU_VSN=${ZULU_VERSION:-7.56.0.11-ca-jdk7.0.352}
32+
ZULU_PLATFORM=${ZULU_ARCH:-linux_x64}
33+
ZULU_DIST=https://static.azul.com/zulu/bin/zulu"${ZULU_VSN}"-"${ZULU_PLATFORM}".tar.gz
34+
35+
SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
36+
37+
# Zulu 7 requires x86_64
38+
case "${ARCH}" in
39+
x86_64)
40+
;;
41+
*)
42+
echo "Clouseau cannot run on ${ARCH} hence it will not be installed"
43+
exit 0
44+
;;
45+
esac
46+
47+
# Check if running as root
48+
if [[ ${EUID} -ne 0 ]]; then
49+
echo "Sorry, this script must be run as root."
50+
echo "Try: sudo $0 $*"
51+
exit 1
52+
fi
53+
54+
function ensure_tool() {
55+
_tool="$1"
56+
57+
if ! type "${_tool}" > /dev/null 2>&1; then
58+
echo "Please install `${_tool}`"
59+
exit 1
60+
fi
61+
}
62+
63+
function download() {
64+
_output="$1"
65+
_url="$2"
66+
67+
wget -q --max-redirect=1 -O "${_output}" "${_url}"
68+
}
69+
70+
ensure_tool unzip
71+
ensure_tool tar
72+
ensure_tool wget
73+
74+
echo "==> Downloading Clouseau from ${CLOUSEAU_DIST}"
75+
if ! download /tmp/clouseau.zip "${CLOUSEAU_DIST}"; then
76+
echo "===> Cannot download Clouseau distribution"
77+
exit 1
78+
fi
79+
mkdir -p /opt/
80+
if ! unzip -qq /tmp/clouseau.zip -d /opt/; then
81+
echo "===> Cannot unpack Clouseau distribution"
82+
exit 1
83+
fi
84+
rm -f /tmp/clouseau.zip
85+
86+
echo "==> Downloading Zulu JDK from ${ZULU_DIST}"
87+
if ! download /tmp/zulu.tar.gz "${ZULU_DIST}"; then
88+
echo "===> Cannot download Zulu JDK distribution"
89+
exit 1
90+
fi
91+
mkdir -p /opt/java/
92+
if ! tar -xf /tmp/zulu.tar.gz -C /opt/java/; then
93+
echo "===> Cannot unpack Zulu JDK distribution"
94+
exit 1
95+
fi
96+
rm -f /tmp/zulu.tar.gz
97+
98+
CLOUSEAU_HOME=/opt/clouseau-"${CLOUSEAU_VSN}"
99+
JDK_HOME=/opt/java/zulu"${ZULU_VSN}"-"${ZULU_PLATFORM}"
100+
101+
if ! download "${CLOUSEAU_HOME}"/slf4j-simple-"${SLF4J_VSN}".jar "${SLF4J_SIMPLE_JAR}"; then
102+
echo "Cannot download slf4j-simple"
103+
exit 1
104+
fi
105+
106+
echo "===> Finalizing Clouseau deployment"
107+
# Extras:
108+
# - Configuration
109+
_INI="${CLOUSEAU_HOME}"/clouseau.ini
110+
cat <<EOF > "${_INI}"
111+
[clouseau]
112+
name = clouseau1@127.0.0.1
113+
dir = /tmp/clouseau/indexes
114+
close_if_idle = false
115+
idle_check_interval_secs = 300
116+
EOF
117+
# - Launcher script
118+
_JARS=$(find "${CLOUSEAU_HOME}" -type f -name '*.jar' | paste -sd ':')
119+
_LAUNCHER="${CLOUSEAU_HOME}"/clouseau
120+
cat <<EOF > "${_LAUNCHER}"
121+
epmd -daemon
122+
"${JDK_HOME}/bin/java" \\
123+
-cp "${_JARS}" \\
124+
com.cloudant.clouseau.Main \\
125+
"${_INI}"
126+
EOF
127+
chmod +x "${_LAUNCHER}"
128+
129+
echo "===> ALL DONE"

bin/install-dependencies.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ if [[ $2 == "noerlang" ]]; then
5252
SKIPERLANG=1
5353
fi
5454

55+
if [[ $3 == "noclouseau" ]]; then
56+
SKIPCLOUSEAU=1
57+
fi
58+
5559
# Check if running as root
5660
if [[ ${EUID} -ne 0 ]]; then
5761
echo "Sorry, this script must be run as root."
@@ -94,6 +98,9 @@ case "${OSTYPE}" in
9498
ERLANGVERSION=${ERLANGVERSION} ${SCRIPTPATH}/yum-erlang.sh
9599
ELIXIRVERSION=${ELIXIRVERSION} ${SCRIPTPATH}/install-elixir.sh
96100
fi
101+
if [[ ! ${SKIPCLOUSEAU} ]]; then
102+
CLOUSEAUVERSION=${CLOUSEAUVERSION} ${SCRIPTPATH}/install-clouseau.sh
103+
fi
97104
run_scripts ${EXTRA_SCRIPTS_DIR} 'yum-'
98105
elif [[ ${ID} =~ ${debians} ]]; then
99106

@@ -103,6 +110,9 @@ case "${OSTYPE}" in
103110
ERLANGVERSION=${ERLANGVERSION} ${SCRIPTPATH}/apt-erlang.sh
104111
ELIXIRVERSION=${ELIXIRVERSION} ${SCRIPTPATH}/install-elixir.sh
105112
fi
113+
if [[ ! ${SKIPCLOUSEAU} ]]; then
114+
CLOUSEAUVERSION=${CLOUSEAUVERSION} ${SCRIPTPATH}/install-clouseau.sh
115+
fi
106116
run_scripts ${EXTRA_SCRIPTS_DIR} 'apt-'
107117
else
108118
echo "Sorry, we don't support this Linux (${ID}) yet."

dockerfiles/almalinux-8

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31+
# Choose whether to install Clouseau, default yes
32+
ARG clouseau=clouseau
3133
# Select version of Node, Erlang and Elixir to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseauversion=2.22.0
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -53,7 +56,8 @@ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
5356
RUN ERLANGVERSION=$erlangversion \
5457
ELIXIRVERSION=$elixirversion \
5558
NODEVERSION=$nodeversion \
56-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
59+
CLOUSEAUVERSION=$clouseauversion \
60+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5761

5862
# Allow Jenkins to sudo
5963
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/almalinux-9

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31+
# Choose whether to install Clouseau, default yes
32+
ARG clouseau=clouseau
3133
# Select version of Node, Erlang and Elixir to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseauversion=2.22.0
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -53,7 +56,8 @@ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
5356
RUN ERLANGVERSION=$erlangversion \
5457
ELIXIRVERSION=$elixirversion \
5558
NODEVERSION=$nodeversion \
56-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
59+
CLOUSEAUVERSION=$clouseauversion \
60+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5761

5862
# Allow Jenkins to sudo
5963
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/centos-7

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31+
# Choose whether to install Clouseau, default yes
32+
ARG clouseau=clouseau
3133
# Select version of Node, Erlang and Elixir to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseauversion=2.22.0
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -53,7 +56,8 @@ RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
5356
RUN ERLANGVERSION=$erlangversion \
5457
ELIXIRVERSION=$elixirversion \
5558
NODEVERSION=$nodeversion \
56-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
59+
CLOUSEAUVERSION=$clouseauversion \
60+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $closueau
5761

5862
# Allow Jenkins to sudo
5963
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/debian-bullseye

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
3030
ARG js=js
3131
# Choose whether to install Erlang, default yes
3232
ARG erlang=erlang
33-
# Select version of Node, Erlang and Elixir
33+
# Choose whether to install Clouseau, default yes
34+
ARG clouseau=clouseau
35+
# Select version of Node, Erlang, Elixir, and Clouseau
3436
ARG erlangversion=24.3.4.14
3537
ARG elixirversion=v1.14.5
3638
ARG nodeversion=14
39+
ARG clouseauversion=2.22.0
3740

3841
# Create Jenkins user and group
3942
RUN groupadd --gid 910 jenkins; \
@@ -52,7 +55,8 @@ RUN mkdir -p /usr/src/couchdb; \
5255
RUN ERLANGVERSION=$erlangversion \
5356
ELIXIRVERSION=$elixirversion \
5457
NODEVERSION=$nodeversion \
55-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
58+
CLOUSEAUVERSION=$clouseauversion \
59+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5660

5761
# Allow Jenkins to sudo
5862
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/debian-buster

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
3030
ARG js=js
3131
# Choose whether to install Erlang, default yes
3232
ARG erlang=erlang
33+
# Choose whether to install Clouseau, default yes
34+
ARG clouseau=clouseau
3335
# Select version of Node, Erlang and Elixir
3436
ARG erlangversion=24.3.4.14
3537
ARG elixirversion=v1.14.5
3638
ARG nodeversion=14
39+
ARG clouseauversion=2.22.0
3740

3841
# Create Jenkins user and group
3942
RUN groupadd --gid 910 jenkins; \
@@ -52,7 +55,8 @@ RUN mkdir -p /usr/src/couchdb; \
5255
RUN ERLANGVERSION=$erlangversion \
5356
ELIXIRVERSION=$elixirversion \
5457
NODEVERSION=$nodeversion \
55-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
58+
CLOUSEAUVERSION=$clouseauversion \
59+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5660

5761
# Allow Jenkins to sudo
5862
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/ubuntu-bionic

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31+
# Choose whether to install Clouseau, default yes
32+
ARG clouseau=clouseau
3133
# Select version of Node, Erlang and Elixir to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseauversion=2.22.0
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -50,7 +53,8 @@ RUN mkdir -p /usr/src/couchdb; \
5053
RUN ERLANGVERSION=$erlangversion \
5154
ELIXIRVERSION=$elixirversion \
5255
NODEVERSION=$nodeversion \
53-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
56+
CLOUSEAUVERSION=$clouseauversion \
57+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5458

5559
# Allow Jenkins to sudo
5660
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/ubuntu-focal

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31+
# Choose whether to install Clouseau, default yes
32+
ARG clouseau=clouseau
3133
# Select version of Node, Erlang and Elixir to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseauversion=2.22.0
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -50,7 +53,8 @@ RUN mkdir -p /usr/src/couchdb; \
5053
RUN ERLANGVERSION=$erlangversion \
5154
ELIXIRVERSION=$elixirversion \
5255
NODEVERSION=$nodeversion \
53-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
56+
CLOUSEAUVERSION=$clouseauversion \
57+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5458

5559
# Allow Jenkins to sudo
5660
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

dockerfiles/ubuntu-jammy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}"
2828
ARG js=js
2929
# Choose whether to install Erlang, default yes
3030
ARG erlang=erlang
31+
# Choose whether to install Clouseau, default yes
32+
ARG clouseau=clouseau
3133
# Select version of Node, Erlang and Elixir to install
3234
ARG erlangversion=24.3.4.14
3335
ARG elixirversion=v1.14.5
3436
ARG nodeversion=14
37+
ARG clouseauversion=2.22.0
3538

3639
# Create Jenkins user and group
3740
RUN groupadd --gid 910 jenkins; \
@@ -50,7 +53,8 @@ RUN mkdir -p /usr/src/couchdb; \
5053
RUN ERLANGVERSION=$erlangversion \
5154
ELIXIRVERSION=$elixirversion \
5255
NODEVERSION=$nodeversion \
53-
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang
56+
CLOUSEAUVERSION=$clouseauversion \
57+
/root/couchdb-ci/bin/install-dependencies.sh $js $erlang $clouseau
5458

5559
# Allow Jenkins to sudo
5660
RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins

0 commit comments

Comments
 (0)