Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update couchdb, add new couchdb-nouveau fulltext search addon #17633

Merged

Conversation

janl
Copy link
Contributor

@janl janl commented Sep 27, 2024

No description provided.

This comment has been minimized.

Copy link
Contributor

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1

This fails for me at least:

Starting buildx build at Fri Sep 27 03:50:08 EDT 2024...
[+] Building 3.1s (6/6) FINISHED                                                                                                                                             docker-container:apache-couchdb
 => [internal] load build definition from Dockerfile                                                                                                                                                    0.0s
 => => transferring dockerfile: 4.46kB                                                                                                                                                                  0.0s
 => CANCELED [linux/arm64 internal] load metadata for docker.io/library/debian:bullseye-slim                                                                                                            3.0s
 => CANCELED [linux/amd64 internal] load metadata for docker.io/library/debian:bullseye-slim                                                                                                            3.0s
 => ERROR [linux/s390x internal] load metadata for docker.io/library/debian:bullseye-slim                                                                                                               3.0s
 => ERROR [linux/ppc64le internal] load metadata for docker.io/library/debian:bullseye-slim                                                                                                             3.0s
 => [auth] library/debian:pull token for registry-1.docker.io                                                                                                                                           0.0s
------
 > [linux/s390x internal] load metadata for docker.io/library/debian:bullseye-slim:
------
------
 > [linux/ppc64le internal] load metadata for docker.io/library/debian:bullseye-slim:
------
Dockerfile:13
--------------------
  11 |     # the License.
  12 |     
  13 | >>> FROM debian:bullseye-slim
  14 |     
  15 |     LABEL maintainer="CouchDB Developers dev@couchdb.apache.org"
--------------------
ERROR: failed to solve: debian:bullseye-slim: failed to resolve source metadata for docker.io/library/debian:bullseye-slim: no match for platform in manifest: not found

@janl
Copy link
Contributor Author

janl commented Sep 27, 2024

fix incoming shortly

This comment has been minimized.

@tianon
Copy link
Member

tianon commented Sep 27, 2024

From the CI:

Invalid 'FROM' + 'Architectures' combinations detected:

  • couchdb:3.3.3 (FROM debian:bullseye-slim) [ppc64le, s390x]

Debian Bullseye is officially in LTS now, so the set of supported architectures is limited and you'll need to either drop the now-unsupported ones or update to Bookworm.

I think you'll also want to remove 3.2, right? (I understand it's EOL now?) As a reminder, removing tags here will remove them from the "Supported" section on the Hub readme (and will prevent us from spending cycles rebuilding them on the official build servers), but the tags will still be available to users who want them. (See https://github.com/docker-library/official-images#library-definition-files for more detail on this.)

Also, unfortunately we won't likely accept nouveau as a new image (new repo namespace) -- I would suggest using a tag naming scheme like couchdb:3.4-nouveau if nouveau is simply an optional add-on to couchdb, or couchdb:nouveau-3.4 if nouveau is a wholly separate tool (and the version numbers are only coincidentally the same). Relevant to the former, would it be possible/reasonable for the new nouveau images to be FROM couchdb:3.4 so they can share layers? One major benefit of doing so is that it's then less "expensive" for users to swap back and forth between them.

@nickva
Copy link
Contributor

nickva commented Sep 27, 2024

@tianon Thank you for your guidance. We'll use bookworm for the base, remove 3.2 and use a tagging scheme for nouveau

@janl
Copy link
Contributor Author

janl commented Sep 28, 2024

Relevant to the former, would it be possible/reasonable for the new nouveau images to be FROM couchdb:3.4 so they can share layers? One major benefit of doing so is that it's then less "expensive" for users to swap back and forth between them.

Nouveau needs a Java runtime environment and CouchDB needs an Erlang runtime environment, so stacking them on top of each other does not make too much sense.

The other points I have addressed with the latest commit. Am I missing anything?

This comment has been minimized.

@janl
Copy link
Contributor Author

janl commented Sep 28, 2024

OH! does the CI error mean we have to bump 3.3.3 to bookworm as well? Sorry if I misunderstood that.

Fix incoming shortly

This comment has been minimized.

This comment has been minimized.

@janl
Copy link
Contributor Author

janl commented Sep 28, 2024

finally, all checks green ✅✅✅

thanks for the help!

@yosifkit
Copy link
Member

yosifkit commented Oct 2, 2024

One comment for change and a few others for thought:
A few of the new/modified apt-get install lines are missing a corresponding rm -rf /var/lib/apt/lists/* in the same layer.

I don't know what the -server argument does for /usr/bin/java, but I guess if it runs, it is probably fine. You could get away with just java for the CMD instead of the whole path (since container runtimes use PATH for resolution), but it is fine either way.

@janl
Copy link
Contributor Author

janl commented Oct 2, 2024

@yosifkit thanks for the additional notes. We’re happy to address those in future releases unless anyone here thinks these are showstoppers? Nouveau is marked as a beta feature for this release.

We’d love to get the new CouchDB release onto the official library. If the new Nouveau image is holding that up, we can also split this out into a separate PR.

@yosifkit
Copy link
Member

yosifkit commented Oct 2, 2024

I guess they are fine this time. It will make the nouveau image a little bit larger (20 MB or more).


Something to consider for later: are any of the other Docker official images a suitable base instead of apt installing the OpenJDK? It is fine either way to us. Here they are in alphabetical order:

Copy link
Member

@yosifkit yosifkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, 🙇 one more thing and this is a blocker for me.

RUN chown -R nouveau:nouveau /opt/nouveau
<missing>      About a minute ago   RUN /bin/sh -c chown -R nouveau:nouveau /opt…   38.5MB    buildkit.dockerfile.v0

This chown layer is inflating the image size. Because this is changing ownership of files from an earlier layer, there is now an extra copy of everything in /opt/nouveau for this chown layer. Any permissions (or mode) changes need to be done in the same layer in which the files originate.

If you'd like to open a separate PR that is just the couchdb bump I can merge that while we continue iterating here for couchdb:*-nouveau.

@janl
Copy link
Contributor Author

janl commented Oct 4, 2024

@yosifkit there you go, threw in the cleanup as well ✌️

This comment has been minimized.

Copy link
Contributor

@nickva nickva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from me

For commit on 1c0ff3713acf5f5cb2c0dc0229dce3325557bb4f on https://github.com/apache/couchdb-docker

Used buildx to push 3.4.1, 3.4, 3andlatest` to https://hub.docker.com/repository/docker/apache/couchdb/tags

@nickva
Copy link
Contributor

nickva commented Oct 4, 2024

@big-r81 had noticed we missed another cleanup and we just merged it fix: apache/couchdb-docker#270

@janl
Copy link
Contributor Author

janl commented Oct 5, 2024

+1, anything else to get this merged? :)

Copy link

github-actions bot commented Oct 5, 2024

Diff for efa4407:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 46b25ab..27fe25e 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,11 +1,16 @@
 Maintainers: Joan Touzet <wohali@apache.org> (@wohali), Jan Lehnardt <jan@apache.org> (@janl), Nick Vatamaniuc (@nickva)
 GitRepo: https://github.com/apache/couchdb-docker
 GitFetch: refs/heads/main
-GitCommit: 58910ed097489dc588b2a87592406f8faa1bdadf
+GitCommit: e748fc4a483c1a651758df4900258701570d2533
 
-Tags: 3.2.3, 3.2
-Directory: 3.2.3
-
-Tags: latest, 3.3.3, 3.3, 3
+Tags: 3.3.3, 3.3
 Architectures: amd64, arm64v8, ppc64le, s390x
 Directory: 3.3.3
+
+Tags: 3.4.1-nouveau, 3.4-nouveau, 3-nouveau
+Architectures: amd64, arm64v8, s390x
+Directory: 3.4.1-nouveau
+
+Tags: latest, 3.4.1, 3.4, 3
+Architectures: amd64, arm64v8, s390x
+Directory: 3.4.1
diff --git a/_bashbrew-list b/_bashbrew-list
index 3457842..a1e649e 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,6 +1,9 @@
 couchdb:3
-couchdb:3.2
-couchdb:3.2.3
+couchdb:3-nouveau
 couchdb:3.3
 couchdb:3.3.3
+couchdb:3.4
+couchdb:3.4-nouveau
+couchdb:3.4.1
+couchdb:3.4.1-nouveau
 couchdb:latest
diff --git a/_bashbrew-list-build-order b/_bashbrew-list-build-order
index 66a11cc..833251e 100644
--- a/_bashbrew-list-build-order
+++ b/_bashbrew-list-build-order
@@ -1,2 +1,3 @@
 couchdb:3
-couchdb:3.2
+couchdb:3-nouveau
+couchdb:3.3
diff --git a/couchdb_3.2/Dockerfile b/couchdb_3-nouveau/Dockerfile
similarity index 37%
copy from couchdb_3.2/Dockerfile
copy to couchdb_3-nouveau/Dockerfile
index d1d4d4f..ffcb96b 100644
--- a/couchdb_3.2/Dockerfile
+++ b/couchdb_3-nouveau/Dockerfile
@@ -10,12 +10,12 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-FROM debian:bullseye-slim
+FROM debian:bookworm-slim
 
 LABEL maintainer="CouchDB Developers dev@couchdb.apache.org"
 
 # Add CouchDB user account to make sure the IDs are assigned consistently
-RUN groupadd -g 5984 -r couchdb && useradd -u 5984 -d /opt/couchdb -g couchdb couchdb
+RUN groupadd -g 5984 -r nouveau && useradd -u 5984 -d /opt/nouveau -g nouveau nouveau
 
 # be sure GPG and apt-transport-https are available and functional
 RUN set -ex; \
@@ -28,6 +28,14 @@ RUN set -ex; \
      ; \
     rm -rf /var/lib/apt/lists/*
 
+# Nouveau wants a JRE/JDK
+RUN set -ex; \
+    apt-get update; \
+    apt-get install -y --no-install-recommends \
+        openjdk-17-jre-headless \
+     ; \
+    rm -rf /var/lib/apt/lists/*
+
 # grab tini for signal handling and zombie reaping
 # see https://github.com/apache/couchdb-docker/pull/28#discussion_r141112407
 RUN set -eux; \
@@ -37,9 +45,10 @@ RUN set -eux; \
     tini --version
 
 # http://docs.couchdb.org/en/latest/install/unix.html#installing-the-apache-couchdb-packages
-ENV GPG_COUCH_KEY \
 # gpg: rsa8192 205-01-19 The Apache Software Foundation (Package repository signing key) <root@apache.org>
-    390EF70BB1EA12B2773962950EE62FB37A00258D
+
+ENV GPG_COUCH_KEY 390EF70BB1EA12B2773962950EE62FB37A00258D
+
 RUN set -eux; \
    apt-get update; \
    apt-get install -y curl; \
@@ -53,52 +62,27 @@ RUN set -eux; \
    apt purge -y --autoremove curl; \
    rm -rf /var/lib/apt/lists/*
 
-ENV COUCHDB_VERSION 3.2.3
-
 RUN . /etc/os-release; \
-    echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" | \
+   echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ bookworm main" | \
        tee /etc/apt/sources.list.d/couchdb.list >/dev/null
 
 # https://github.com/apache/couchdb-pkg/blob/master/debian/README.Debian
 RUN set -eux; \
     apt-get update; \
     \
-    echo "couchdb couchdb/mode select none" | debconf-set-selections; \
-# we DO want recommends this time
-    DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
-            couchdb="$COUCHDB_VERSION"~bullseye \
-    ; \
-# Undo symlinks to /var/log and /var/lib
-    rmdir /var/lib/couchdb /var/log/couchdb; \
-    rm /opt/couchdb/data /opt/couchdb/var/log; \
-    mkdir -p /opt/couchdb/data /opt/couchdb/var/log; \
-    chown couchdb:couchdb /opt/couchdb/data /opt/couchdb/var/log; \
-    chmod 777 /opt/couchdb/data /opt/couchdb/var/log; \
-# Remove file that sets logging to a file
-    rm /opt/couchdb/etc/default.d/10-filelog.ini; \
-# Check we own everything in /opt/couchdb. Matches the command in dockerfile_entrypoint.sh
-    find /opt/couchdb \! \( -user couchdb -group couchdb \) -exec chown -f couchdb:couchdb '{}' +; \
-# Setup directories and permissions for config. Technically these could be 555 and 444 respectively
-# but we keep them as 755 and 644 for consistency with CouchDB defaults and the dockerfile_entrypoint.sh.
-    find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +; \
-    find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +; \
-# only local.d needs to be writable for the docker_entrypoint.sh
-    chmod -f 0777 /opt/couchdb/etc/local.d; \
-# apt clean-up
-    rm -rf /var/lib/apt/lists/*;
+    echo "couchdb-nouveau couchdb-nouveau/enable select false" | debconf-set-selections; \
+    DEBIAN_FRONTEND=noninteractive COUCHDB_NOUVEAU_ENABLE=1 apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages --no-install-recommends \
+            couchdb-nouveau=3.4.1~bookworm; \
+    rm -rf /var/lib/apt/lists/*; \
+    chown -R nouveau:nouveau /opt/nouveau
 
-# Add configuration
-COPY --chown=couchdb:couchdb 10-docker-default.ini /opt/couchdb/etc/default.d/
-COPY --chown=couchdb:couchdb vm.args /opt/couchdb/etc/
+COPY --chown=nouveau:nouveau nouveau.yaml /opt/nouveau/etc/nouveau.yaml
 
-COPY docker-entrypoint.sh /usr/local/bin
-RUN ln -s usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat
-ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
+VOLUME /opt/nouveau/data
 
-VOLUME /opt/couchdb/data
+# 5987: Nouveau App
+# 5988: Nouveau Admin
+EXPOSE 5987 5988
 
-# 5984: Main CouchDB endpoint
-# 4369: Erlang portmap daemon (epmd)
-# 9100: CouchDB cluster communication port
-EXPOSE 5984 4369 9100
-CMD ["/opt/couchdb/bin/couchdb"]
+# TODO: re-add tini
+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"]
diff --git a/couchdb_3-nouveau/nouveau.yaml b/couchdb_3-nouveau/nouveau.yaml
new file mode 100644
index 0000000..5750942
--- /dev/null
+++ b/couchdb_3-nouveau/nouveau.yaml
@@ -0,0 +1,27 @@
+maxIndexesOpen: 3000
+commitIntervalSeconds: 30
+idleSeconds: 60
+rootDir: ./data/nouveau
+
+logging:
+  level: INFO
+
+server:
+  applicationConnectors:
+    - type: http
+      bindHost: 0.0.0.0
+      port: 5987
+      useDateHeader: false
+  adminConnectors:
+    - type: http
+      bindHost: 0.0.0.0
+      port: 5988
+      useDateHeader: false
+  gzip:
+    includedMethods:
+      - GET
+      - POST
+  requestLog:
+    appenders:
+      - type: console
+        target: stderr
diff --git a/couchdb_3.2/vm.args b/couchdb_3.2/vm.args
deleted file mode 100644
index d606217..0000000
diff --git a/couchdb_3.2/10-docker-default.ini b/couchdb_3.3/10-docker-default.ini
similarity index 100%
rename from couchdb_3.2/10-docker-default.ini
rename to couchdb_3.3/10-docker-default.ini
diff --git a/couchdb_3.2/Dockerfile b/couchdb_3.3/Dockerfile
similarity index 97%
rename from couchdb_3.2/Dockerfile
rename to couchdb_3.3/Dockerfile
index d1d4d4f..6d86dfb 100644
--- a/couchdb_3.2/Dockerfile
+++ b/couchdb_3.3/Dockerfile
@@ -10,7 +10,7 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-FROM debian:bullseye-slim
+FROM debian:bookworm-slim
 
 LABEL maintainer="CouchDB Developers dev@couchdb.apache.org"
 
@@ -53,7 +53,7 @@ RUN set -eux; \
     apt purge -y --autoremove curl; \
     rm -rf /var/lib/apt/lists/*
 
-ENV COUCHDB_VERSION 3.2.3
+ENV COUCHDB_VERSION 3.3.3
 
 RUN . /etc/os-release; \
     echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" | \
@@ -66,7 +66,7 @@ RUN set -eux; \
     echo "couchdb couchdb/mode select none" | debconf-set-selections; \
 # we DO want recommends this time
     DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
-            couchdb="$COUCHDB_VERSION"~bullseye \
+            couchdb="$COUCHDB_VERSION-1"~bookworm \
     ; \
 # Undo symlinks to /var/log and /var/lib
     rmdir /var/lib/couchdb /var/log/couchdb; \
diff --git a/couchdb_3.2/docker-entrypoint.sh b/couchdb_3.3/docker-entrypoint.sh
similarity index 100%
rename from couchdb_3.2/docker-entrypoint.sh
rename to couchdb_3.3/docker-entrypoint.sh
diff --git a/couchdb_3/vm.args b/couchdb_3.3/vm.args
similarity index 100%
copy from couchdb_3/vm.args
copy to couchdb_3.3/vm.args
diff --git a/couchdb_3/Dockerfile b/couchdb_3/Dockerfile
index 16bdf32..2314c8d 100644
--- a/couchdb_3/Dockerfile
+++ b/couchdb_3/Dockerfile
@@ -10,7 +10,7 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-FROM debian:bullseye-slim
+FROM debian:bookworm-slim
 
 LABEL maintainer="CouchDB Developers dev@couchdb.apache.org"
 
@@ -53,7 +53,7 @@ RUN set -eux; \
     apt purge -y --autoremove curl; \
     rm -rf /var/lib/apt/lists/*
 
-ENV COUCHDB_VERSION 3.3.3
+ENV COUCHDB_VERSION 3.4.1
 
 RUN . /etc/os-release; \
     echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" | \
@@ -66,7 +66,7 @@ RUN set -eux; \
     echo "couchdb couchdb/mode select none" | debconf-set-selections; \
 # we DO want recommends this time
     DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages \
-            couchdb="$COUCHDB_VERSION"~bullseye \
+            couchdb="$COUCHDB_VERSION"~bookworm \
     ; \
 # Undo symlinks to /var/log and /var/lib
     rmdir /var/lib/couchdb /var/log/couchdb; \

Relevant Maintainers:

Copy link

@big-r81 big-r81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Added the corresponding rm -rf /var/lib/apt/lists/* lines and removed the layer bloating of the separate chown command.

All is ✅.

@tianon
Copy link
Member

tianon commented Oct 7, 2024

You don't need to source /etc/os-release anymore since you're hard coding the codename, but that's immaterial.

It also seems strange to chown the whole /opt directory, given most of it is installed from a package and you probably don't want the application to be able to write to/modify anything but the runtime data files there, as something else to think about.

@tianon tianon merged commit c5a83ee into docker-library:master Oct 7, 2024
8 checks passed
@janl janl deleted the update-couchdb-3.4.1-and-add-nouveau branch October 9, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants