Skip to content

Commit 2660034

Browse files
committed
New release 3.5.0
1 parent d9ab5e5 commit 2660034

7 files changed

Lines changed: 397 additions & 0 deletions

File tree

3.5.0-nouveau/Dockerfile

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
# use this file except in compliance with the License. You may obtain a copy of
3+
# the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations under
11+
# the License.
12+
13+
FROM debian:bookworm-slim
14+
15+
LABEL maintainer="CouchDB Developers dev@couchdb.apache.org"
16+
17+
# Add CouchDB user account to make sure the IDs are assigned consistently
18+
RUN groupadd -g 5984 -r nouveau && useradd -u 5984 -d /opt/nouveau -g nouveau nouveau
19+
20+
# be sure GPG and apt-transport-https are available and functional
21+
RUN set -ex; \
22+
apt-get update; \
23+
apt-get install -y --no-install-recommends \
24+
apt-transport-https \
25+
ca-certificates \
26+
dirmngr \
27+
gnupg \
28+
; \
29+
rm -rf /var/lib/apt/lists/*
30+
31+
# Nouveau wants a JRE/JDK
32+
RUN set -ex; \
33+
apt-get update; \
34+
apt-get install -y --no-install-recommends \
35+
openjdk-17-jre-headless \
36+
; \
37+
rm -rf /var/lib/apt/lists/*
38+
39+
# grab tini for signal handling and zombie reaping
40+
# see https://github.com/apache/couchdb-docker/pull/28#discussion_r141112407
41+
RUN set -eux; \
42+
apt-get update; \
43+
apt-get install -y --no-install-recommends tini; \
44+
rm -rf /var/lib/apt/lists/*; \
45+
tini --version
46+
47+
# http://docs.couchdb.org/en/latest/install/unix.html#installing-the-apache-couchdb-packages
48+
# gpg: rsa8192 205-01-19 The Apache Software Foundation (Package repository signing key) <root@apache.org>
49+
50+
ENV GPG_COUCH_KEY 390EF70BB1EA12B2773962950EE62FB37A00258D
51+
52+
RUN set -eux; \
53+
apt-get update; \
54+
apt-get install -y curl; \
55+
export GNUPGHOME="$(mktemp -d)"; \
56+
curl -fL -o keys.asc https://couchdb.apache.org/repo/keys.asc; \
57+
gpg --batch --import keys.asc; \
58+
gpg --batch --export "${GPG_COUCH_KEY}" > /usr/share/keyrings/couchdb-archive-keyring.gpg; \
59+
command -v gpgconf && gpgconf --kill all || :; \
60+
rm -rf "$GNUPGHOME"; \
61+
apt-key list; \
62+
apt purge -y --autoremove curl; \
63+
rm -rf /var/lib/apt/lists/*
64+
65+
RUN . /etc/os-release; \
66+
echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ bookworm main" | \
67+
tee /etc/apt/sources.list.d/couchdb.list >/dev/null
68+
69+
# https://github.com/apache/couchdb-pkg/blob/master/debian/README.Debian
70+
RUN set -eux; \
71+
apt-get update; \
72+
\
73+
echo "couchdb-nouveau couchdb-nouveau/enable select false" | debconf-set-selections; \
74+
DEBIAN_FRONTEND=noninteractive COUCHDB_NOUVEAU_ENABLE=1 apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages --no-install-recommends \
75+
couchdb-nouveau=3.5.0~bookworm; \
76+
rm -rf /var/lib/apt/lists/*; \
77+
chown -R nouveau:nouveau /opt/nouveau
78+
79+
COPY --chown=nouveau:nouveau nouveau.yaml /opt/nouveau/etc/nouveau.yaml
80+
81+
VOLUME /opt/nouveau/data
82+
83+
# 5987: Nouveau App
84+
# 5988: Nouveau Admin
85+
EXPOSE 5987 5988
86+
87+
# TODO: re-add tini
88+
CMD ["/usr/bin/java", "-server", "-Djava.awt.headless=true", "-Xmx2g", "-jar", "/opt/nouveau/lib/nouveau-1.0-SNAPSHOT.jar", "server", "/opt/nouveau/etc/nouveau.yaml"]

3.5.0-nouveau/nouveau.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
maxIndexesOpen: 3000
2+
commitIntervalSeconds: 30
3+
idleSeconds: 60
4+
rootDir: ./data/nouveau
5+
6+
logging:
7+
level: INFO
8+
9+
server:
10+
applicationConnectors:
11+
- type: http
12+
bindHost: 0.0.0.0
13+
port: 5987
14+
useDateHeader: false
15+
adminConnectors:
16+
- type: http
17+
bindHost: 0.0.0.0
18+
port: 5988
19+
useDateHeader: false
20+
gzip:
21+
includedMethods:
22+
- GET
23+
- POST
24+
requestLog:
25+
appenders:
26+
- type: console
27+
target: stderr

3.5.0/10-docker-default.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
; CouchDB Configuration Settings
2+
3+
; Custom settings should be made in this file. They will override settings
4+
; in default.ini, but unlike changes made to default.ini, this file won't be
5+
; overwritten on server upgrade.
6+
7+
[chttpd]
8+
bind_address = any

3.5.0/Dockerfile

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
2+
# use this file except in compliance with the License. You may obtain a copy of
3+
# the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations under
11+
# the License.
12+
13+
FROM debian:bookworm-slim
14+
15+
LABEL maintainer="CouchDB Developers dev@couchdb.apache.org"
16+
17+
# Add CouchDB user account to make sure the IDs are assigned consistently
18+
RUN groupadd -g 5984 -r couchdb && useradd -u 5984 -d /opt/couchdb -g couchdb couchdb
19+
20+
# be sure GPG and apt-transport-https are available and functional
21+
RUN set -ex; \
22+
apt-get update; \
23+
apt-get install -y --no-install-recommends \
24+
apt-transport-https \
25+
ca-certificates \
26+
dirmngr \
27+
gnupg \
28+
; \
29+
rm -rf /var/lib/apt/lists/*
30+
31+
# grab tini for signal handling and zombie reaping
32+
# see https://github.com/apache/couchdb-docker/pull/28#discussion_r141112407
33+
RUN set -eux; \
34+
apt-get update; \
35+
apt-get install -y --no-install-recommends tini; \
36+
rm -rf /var/lib/apt/lists/*; \
37+
tini --version
38+
39+
# http://docs.couchdb.org/en/latest/install/unix.html#installing-the-apache-couchdb-packages
40+
ENV GPG_COUCH_KEY \
41+
# gpg: rsa8192 205-01-19 The Apache Software Foundation (Package repository signing key) <root@apache.org>
42+
390EF70BB1EA12B2773962950EE62FB37A00258D
43+
RUN set -eux; \
44+
apt-get update; \
45+
apt-get install -y curl; \
46+
export GNUPGHOME="$(mktemp -d)"; \
47+
curl -fL -o keys.asc https://couchdb.apache.org/repo/keys.asc; \
48+
gpg --batch --import keys.asc; \
49+
gpg --batch --export "${GPG_COUCH_KEY}" > /usr/share/keyrings/couchdb-archive-keyring.gpg; \
50+
command -v gpgconf && gpgconf --kill all || :; \
51+
rm -rf "$GNUPGHOME"; \
52+
apt-key list; \
53+
apt purge -y --autoremove curl; \
54+
rm -rf /var/lib/apt/lists/*
55+
56+
ENV COUCHDB_VERSION 3.5.0
57+
58+
RUN . /etc/os-release; \
59+
echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" | \
60+
tee /etc/apt/sources.list.d/couchdb.list >/dev/null
61+
62+
# https://github.com/apache/couchdb-pkg/blob/master/debian/README.Debian
63+
RUN set -eux; \
64+
apt-get update; \
65+
\
66+
echo "couchdb couchdb/mode select none" | debconf-set-selections; \
67+
# we DO want recommends this time
68+
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
69+
couchdb="$COUCHDB_VERSION"~bookworm \
70+
; \
71+
# Undo symlinks to /var/log and /var/lib
72+
rmdir /var/lib/couchdb /var/log/couchdb; \
73+
rm /opt/couchdb/data /opt/couchdb/var/log; \
74+
mkdir -p /opt/couchdb/data /opt/couchdb/var/log; \
75+
chown couchdb:couchdb /opt/couchdb/data /opt/couchdb/var/log; \
76+
chmod 777 /opt/couchdb/data /opt/couchdb/var/log; \
77+
# Remove file that sets logging to a file
78+
rm /opt/couchdb/etc/default.d/10-filelog.ini; \
79+
# Check we own everything in /opt/couchdb. Matches the command in dockerfile_entrypoint.sh
80+
find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown -f couchdb:couchdb '{}' +; \
81+
# Setup directories and permissions for config. Technically these could be 555 and 444 respectively
82+
# but we keep them as 755 and 644 for consistency with CouchDB defaults and the dockerfile_entrypoint.sh.
83+
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +; \
84+
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +; \
85+
# only local.d needs to be writable for the docker_entrypoint.sh
86+
chmod -f 0777 /opt/couchdb/etc/local.d; \
87+
# apt clean-up
88+
rm -rf /var/lib/apt/lists/*;
89+
90+
# Add configuration
91+
COPY --chown=couchdb:couchdb 10-docker-default.ini /opt/couchdb/etc/default.d/
92+
COPY --chown=couchdb:couchdb vm.args /opt/couchdb/etc/
93+
94+
COPY docker-entrypoint.sh /usr/local/bin
95+
RUN ln -s usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat
96+
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
97+
98+
VOLUME /opt/couchdb/data
99+
100+
# 5984: Main CouchDB endpoint
101+
# 4369: Erlang portmap daemon (epmd)
102+
# 9100: CouchDB cluster communication port
103+
EXPOSE 5984 4369 9100
104+
CMD ["/opt/couchdb/bin/couchdb"]

3.5.0/docker-entrypoint.sh

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#!/bin/bash
2+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
3+
# use this file except in compliance with the License. You may obtain a copy of
4+
# the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
# License for the specific language governing permissions and limitations under
12+
# the License.
13+
14+
set -e
15+
16+
# first arg is `-something` or `+something`
17+
if [ "${1#-}" != "$1" ] || [ "${1#+}" != "$1" ]; then
18+
set -- /opt/couchdb/bin/couchdb "$@"
19+
fi
20+
21+
# first arg is the bare word `couchdb`
22+
if [ "$1" = 'couchdb' ]; then
23+
shift
24+
set -- /opt/couchdb/bin/couchdb "$@"
25+
fi
26+
27+
if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
28+
# this is where runtime configuration changes will be written.
29+
# we need to explicitly touch it here in case /opt/couchdb/etc has
30+
# been mounted as an external volume, in which case it won't exist.
31+
# If running as the couchdb user (i.e. container starts as root),
32+
# write permissions will be granted below.
33+
touch /opt/couchdb/etc/local.d/docker.ini
34+
35+
# if user is root, assume running under the couchdb user (default)
36+
# and ensure it is able to access files and directories that may be mounted externally
37+
if [ "$(id -u)" = '0' ]; then
38+
# Check that we own everything in /opt/couchdb and fix if necessary. We also
39+
# add the `-f` flag in all the following invocations because there may be
40+
# cases where some of these ownership and permissions issues are non-fatal
41+
# (e.g. a config file owned by root with o+r is actually fine), and we don't
42+
# to be too aggressive about crashing here ...
43+
find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown -f couchdb:couchdb '{}' +
44+
45+
# Ensure that data files have the correct permissions. We were previously
46+
# preventing any access to these files outside of couchdb:couchdb, but it
47+
# turns out that CouchDB itself does not set such restrictive permissions
48+
# when it creates the files. The approach taken here ensures that the
49+
# contents of the datadir have the same permissions as they had when they
50+
# were initially created. This should minimize any startup delay.
51+
find /opt/couchdb/data -type d ! -perm 0755 -exec chmod -f 0755 '{}' +
52+
find /opt/couchdb/data -type f ! -perm 0644 -exec chmod -f 0644 '{}' +
53+
54+
# Do the same thing for configuration files and directories. Technically
55+
# CouchDB only needs read access to the configuration files as all online
56+
# changes will be applied to the "docker.ini" file below, but we set 644
57+
# for the sake of consistency.
58+
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +
59+
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +
60+
fi
61+
62+
if [ ! -z "$NODENAME" ] && ! grep "couchdb@" /opt/couchdb/etc/vm.args; then
63+
echo "-name couchdb@$NODENAME" >> /opt/couchdb/etc/vm.args
64+
fi
65+
66+
if [ "$COUCHDB_USER" ] && [ "$COUCHDB_PASSWORD" ]; then
67+
# Create admin only if not already present
68+
if ! grep -Pzoqr "\[admins\]\n$COUCHDB_USER =" /opt/couchdb/etc/local.d/*.ini /opt/couchdb/etc/local.ini; then
69+
printf "\n[admins]\n%s = %s\n" "$COUCHDB_USER" "$COUCHDB_PASSWORD" >> /opt/couchdb/etc/local.d/docker.ini
70+
fi
71+
fi
72+
73+
if [ "$COUCHDB_SECRET" ]; then
74+
# Set secret only if not already present
75+
if ! grep -Pzoqr "\[chttpd_auth\]\nsecret =" /opt/couchdb/etc/local.d/*.ini /opt/couchdb/etc/local.ini; then
76+
printf "\n[chttpd_auth]\nsecret = %s\n" "$COUCHDB_SECRET" >> /opt/couchdb/etc/local.d/docker.ini
77+
fi
78+
fi
79+
80+
if [ "$COUCHDB_ERLANG_COOKIE" ]; then
81+
cookieFile='/opt/couchdb/.erlang.cookie'
82+
if [ -e "$cookieFile" ]; then
83+
if [ "$(cat "$cookieFile" 2>/dev/null)" != "$COUCHDB_ERLANG_COOKIE" ]; then
84+
echo >&2
85+
echo >&2 "warning: $cookieFile contents do not match COUCHDB_ERLANG_COOKIE"
86+
echo >&2
87+
fi
88+
else
89+
echo "$COUCHDB_ERLANG_COOKIE" > "$cookieFile"
90+
fi
91+
chown couchdb:couchdb "$cookieFile"
92+
chmod 600 "$cookieFile"
93+
fi
94+
95+
if [ "$(id -u)" = '0' ]; then
96+
chown -f couchdb:couchdb /opt/couchdb/etc/local.d/docker.ini || true
97+
fi
98+
99+
# if we don't find an [admins] section followed by a non-comment, display a warning
100+
if ! grep -Pzoqr '\[admins\]\n[^;]\w+' /opt/couchdb/etc/default.d/*.ini /opt/couchdb/etc/local.d/*.ini /opt/couchdb/etc/local.ini; then
101+
# The - option suppresses leading tabs but *not* spaces. :)
102+
cat >&2 <<-'EOWARN'
103+
*************************************************************
104+
ERROR: CouchDB 3.0+ will no longer run in "Admin Party"
105+
mode. You *MUST* specify an admin user and
106+
password, either via your own .ini file mapped
107+
into the container at /opt/couchdb/etc/local.ini
108+
or inside /opt/couchdb/etc/local.d, or with
109+
"-e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password"
110+
to set it via "docker run".
111+
*************************************************************
112+
EOWARN
113+
exit 1
114+
fi
115+
116+
if [ "$(id -u)" = '0' ]; then
117+
export HOME=$(echo ~couchdb)
118+
exec setpriv --reuid=couchdb --regid=couchdb --clear-groups "$@"
119+
fi
120+
fi
121+
122+
exec "$@"

0 commit comments

Comments
 (0)