From 5f1019d9fd37b4647c484f34f74fec5a6c569f81 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 1 Dec 2022 13:42:56 +0000 Subject: [PATCH] Creating pure BB-CouchDB image. --- hosting/bbcouch/Dockerfile | 31 ++++++++++++++++++++++ hosting/bbcouch/clouseau/clouseau | 12 +++++++++ hosting/bbcouch/clouseau/clouseau.ini | 13 +++++++++ hosting/bbcouch/clouseau/log4j.properties | 4 +++ hosting/bbcouch/couch/local.ini | 5 ++++ hosting/bbcouch/couch/vm.args | 32 +++++++++++++++++++++++ hosting/bbcouch/runner.sh | 7 +++++ 7 files changed, 104 insertions(+) create mode 100644 hosting/bbcouch/Dockerfile create mode 100644 hosting/bbcouch/clouseau/clouseau create mode 100644 hosting/bbcouch/clouseau/clouseau.ini create mode 100644 hosting/bbcouch/clouseau/log4j.properties create mode 100644 hosting/bbcouch/couch/local.ini create mode 100644 hosting/bbcouch/couch/vm.args create mode 100644 hosting/bbcouch/runner.sh diff --git a/hosting/bbcouch/Dockerfile b/hosting/bbcouch/Dockerfile new file mode 100644 index 0000000000..7f2f4815d5 --- /dev/null +++ b/hosting/bbcouch/Dockerfile @@ -0,0 +1,31 @@ +FROM couchdb:3.2.1 + +ENV COUCHDB_USER admin +ENV COUCHDB_PASSWORD admin +EXPOSE 5984 + +RUN apt-get update && apt-get install -y software-properties-common wget unzip curl && \ + apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && \ + apt-get update && apt-get install -y openjdk-8-jdk + +# setup clouseau +WORKDIR / +RUN wget https://github.com/cloudant-labs/clouseau/releases/download/2.21.0/clouseau-2.21.0-dist.zip && \ + unzip clouseau-2.21.0-dist.zip && \ + mv clouseau-2.21.0 /opt/clouseau && \ + rm clouseau-2.21.0-dist.zip + +WORKDIR /opt/clouseau +RUN mkdir ./bin +ADD clouseau/clouseau ./bin/ +ADD clouseau/log4j.properties clouseau/clouseau.ini ./ +RUN chmod +x ./bin/clouseau + +# setup CouchDB +WORKDIR /opt/couchdb +ADD couch/vm.args couch/local.ini ./etc/ + +WORKDIR / +ADD runner.sh ./bbcouch-runner.sh +RUN chmod +x ./bbcouch-runner.sh +ENTRYPOINT ["./bbcouch-runner.sh"] diff --git a/hosting/bbcouch/clouseau/clouseau b/hosting/bbcouch/clouseau/clouseau new file mode 100644 index 0000000000..1095ea24cb --- /dev/null +++ b/hosting/bbcouch/clouseau/clouseau @@ -0,0 +1,12 @@ +#!/bin/sh +/usr/bin/java -server \ + -Xmx2G \ + -Dsun.net.inetaddr.ttl=30 \ + -Dsun.net.inetaddr.negative.ttl=30 \ + -Dlog4j.configuration=file:/opt/clouseau/log4j.properties \ + -XX:OnOutOfMemoryError="kill -9 %p" \ + -XX:+UseConcMarkSweepGC \ + -XX:+CMSParallelRemarkEnabled \ + -classpath '/opt/clouseau/*' \ + com.cloudant.clouseau.Main \ + /opt/clouseau/clouseau.ini \ No newline at end of file diff --git a/hosting/bbcouch/clouseau/clouseau.ini b/hosting/bbcouch/clouseau/clouseau.ini new file mode 100644 index 0000000000..578a5acafa --- /dev/null +++ b/hosting/bbcouch/clouseau/clouseau.ini @@ -0,0 +1,13 @@ +[clouseau] + +; the name of the Erlang node created by the service, leave this unchanged +name=clouseau@127.0.0.1 + +; set this to the same distributed Erlang cookie used by the CouchDB nodes +cookie=monster + +; the path where you would like to store the search index files +dir=DATA_DIR/search + +; the number of search indexes that can be open simultaneously +max_indexes_open=500 diff --git a/hosting/bbcouch/clouseau/log4j.properties b/hosting/bbcouch/clouseau/log4j.properties new file mode 100644 index 0000000000..9d4d9311bc --- /dev/null +++ b/hosting/bbcouch/clouseau/log4j.properties @@ -0,0 +1,4 @@ +log4j.rootLogger=debug, CONSOLE +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %c [%p] %m%n \ No newline at end of file diff --git a/hosting/bbcouch/couch/local.ini b/hosting/bbcouch/couch/local.ini new file mode 100644 index 0000000000..266c0d4b60 --- /dev/null +++ b/hosting/bbcouch/couch/local.ini @@ -0,0 +1,5 @@ +; CouchDB Configuration Settings + +[couchdb] +database_dir = DATA_DIR/couch/dbs +view_index_dir = DATA_DIR/couch/views diff --git a/hosting/bbcouch/couch/vm.args b/hosting/bbcouch/couch/vm.args new file mode 100644 index 0000000000..e9e4416863 --- /dev/null +++ b/hosting/bbcouch/couch/vm.args @@ -0,0 +1,32 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +# erlang cookie for clouseau security +-name couchdb@127.0.0.1 +-setcookie monster + +# Ensure that the Erlang VM listens on a known port +-kernel inet_dist_listen_min 9100 +-kernel inet_dist_listen_max 9100 + +# Tell kernel and SASL not to log anything +-kernel error_logger silent +-sasl sasl_error_logger false + +# Use kernel poll functionality if supported by emulator ++K true + +# Start a pool of asynchronous IO threads ++A 16 + +# Comment this line out to enable the interactive Erlang shell on startup ++Bd -noinput diff --git a/hosting/bbcouch/runner.sh b/hosting/bbcouch/runner.sh new file mode 100644 index 0000000000..01b4aee3dc --- /dev/null +++ b/hosting/bbcouch/runner.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +/docker-entrypoint.sh /opt/couchdb/bin/couchdb & +sleep 10 +curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@localhost:5984/_users +curl -X PUT http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@localhost:5984/_replicator +sleep infinity \ No newline at end of file