diff --git a/.gitignore b/.gitignore index b72f9be..c0acaa4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.swp +.idea diff --git a/README.md b/README.md index 7af8459..7006bed 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,9 @@ docker run --name my-couchdb --user myuser -v /home/couchdb/data:/opt/couchdb/da # Development images + +## CouchDB + This repository provides definitions to run the very latest (`main` branch) CouchDB code: @@ -271,6 +274,46 @@ docker run --rm --help docker run -it -p 15984:15984 -p 25984:25984 -n 2 ``` +## CouchDB & Nouveau + +To run a CouchDB instance compiled from main as well as the latest Nouveau build, you can use use [Docker Compose](https://docs.docker.com/compose/). One caveat is that while CouchDB will be compiled from scratch, Nouveau will actually download the latest passing build for Bookwarm from [CloudBees CI artifacts](https://ci-couchdb.apache.org/job/jenkins-cm1/job/FullPlatformMatrix/job/main/lastSuccessfulBuild/artifact/pkgs/bookworm/). + +To stand up both services: + +1. Go into dev: `cd dev` +2. Start docker compose: `docker compose up` +3. If this is your first time running this - wait a good long while. Maybe [say "hello" to a co-worker](https://xkcd.com/303/). Compiling everything from source can take many minutes depending on CPU and bandwidth. +4. When it's done you should see `dev-couchdb-nouveau-1` and `dev-couchdb-1` containers start and a fun "Nouveau" ASCII art: + ```shell + => => writing image sha256:16b4265aae1844834895a16c67c984f794b0191f1279e5d5072bcda3b5c27477 0.0s + => => naming to docker.io/library/couchdb:dev 0.0s => [couchdb] resolving provenance for metadata file 0.0s + [+] Running 4/4 + ✔ couchdb Built 0.0s ✔ couchdb-nouveau Built 0.0s + ✔ Container dev-couchdb-nouveau-1 Created 0.2s + ✔ Container dev-couchdb-1 Created 0.1s Attaching to couchdb-1, couchdb-nouveau-1 + couchdb-nouveau-1 | INFO [2025-01-30 22:07:09,504] io.dropwizard.core.server.DefaultServerFactory: Registering jersey handle + r with root path prefix: / + couchdb-nouveau-1 | INFO [2025-01-30 22:07:09,507] io.dropwizard.core.server.DefaultServerFactory: Registering admin handler with root path prefix: / + couchdb-nouveau-1 | INFO [2025-01-30 22:07:09,578] io.dropwizard.core.server.ServerFactory: Starting Nouveau couchdb-nouveau-1 | .-. + couchdb-nouveau-1 | / | + couchdb-nouveau-1 | /\ | .-._.) ( ) .-..-. .-. ) ( + couchdb-nouveau-1 | / \ |( )( )( / ./.-'_( | ( ) + couchdb-nouveau-1 | .-' / \| `-' `--': \_/ (__.' `-'-'`--': + couchdb-nouveau-1 | (__.' `. + couchdb-nouveau-1 | + ``` +5. CouchDB will be on on port `5984` and the login is `admin` and the password is `password`. Nouveau will be on port `5988` + +In another terminal you can verify everything is working with `docker ps` + +```shell +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +26a343424fda couchdb:dev "tini -- /docker-ent…" 5 seconds ago Up 3 seconds (health: starting) 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp, :::5984->5984/tcp dev-couchdb-1 +b1e5de6cf445 couchdb-nouveau:dev "/usr/bin/java -serv…" 5 seconds ago Up 4 seconds 0.0.0.0:5987-5988->5987-5988/tcp, :::5987-5988->5987-5988/tcp dev-couchdb-nouveau-1 +``` + +To stop the services, hit `ctrl + c` in the `docker compose up` terminal. + # Image building for CouchDB release managers Check out the `build.sh` script in the apache/couchdb-docker GitHub repository, diff --git a/dev/Dockerfile-nouveau b/dev/Dockerfile-nouveau new file mode 100644 index 0000000..61ead19 --- /dev/null +++ b/dev/Dockerfile-nouveau @@ -0,0 +1,58 @@ +# 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. + +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 nouveau && useradd -u 5984 -d /opt/nouveau -g nouveau nouveau + +# be sure GPG and apt-transport-https are available and functional +# Nouveau wants a JRE/JDK +RUN set -ex; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + dirmngr \ + gnupg \ + openjdk-17-jre-headless \ + curl \ + unzip \ + procps \ + systemd \ + ; \ + rm -rf /var/lib/apt/lists/*; + +# this is a hack to avoid building nouveau in docker - instead, we'll grab it from last known +# good CI build on CloudBees CI artifacts +RUN set -eux; \ + curl -o /tmp/couchdb-packages.zip \ + https://ci-couchdb.apache.org/job/jenkins-cm1/job/FullPlatformMatrix/job/main/lastSuccessfulBuild/artifact/pkgs/bookworm/*zip*/bookworm.zip; \ + mkdir -p /tmp/couchdb-packages; \ + unzip /tmp/couchdb-packages.zip -d /tmp/couchdb-packages; \ + DEBIAN_FRONTEND=noninteractive COUCHDB_NOUVEAU_ENABLE=1 apt-get install -fy --allow-downgrades \ + --allow-remove-essential --allow-change-held-packages \ + /tmp/couchdb-packages/bookworm/couchdb-nouveau_*bookworm_amd64.deb; \ + chown -R nouveau:nouveau /opt/nouveau; + +COPY --chown=nouveau:nouveau nouveau.yaml /opt/nouveau/etc/nouveau.yaml + +VOLUME /opt/nouveau/data + +# 5987: Nouveau App +# 5988: Nouveau Admin +EXPOSE 5987 5988 + +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/dev/compose.yml b/dev/compose.yml new file mode 100644 index 0000000..c8b2fca --- /dev/null +++ b/dev/compose.yml @@ -0,0 +1,36 @@ +services: + couchdb: + build: + context: . + image: couchdb:dev + restart: unless-stopped + environment: + - "COUCHDB_USER=${COUCHDB_USER:-admin}" + - "COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}" + - "COUCHDB_SECRET=${COUCHDB_SECRET:-secret}" + - "COUCHDB_UUID=${COUCHDB_UUID:-56a30f87-1115-42a1-8317-098038871058}" + - "COUCHDB_LOG_LEVEL=${COUCHDB_LOG_LEVEL:-info}" + depends_on: + - couchdb-nouveau + volumes: + - couchdb:/opt/couchdb/data + - ./nouveau.ini:/opt/couchdb/etc/local.d/nouveau.ini` + healthcheck: + test: ["CMD-SHELL", "curl --fail -s http://couchdb:5984/_up"] + interval: 30s + timeout: 5s + retries: 5 + ports: + - 5984:5984 + + couchdb-nouveau: + build: + context: . + dockerfile: Dockerfile-nouveau + image: couchdb-nouveau:dev + ports: + - "5987:5987" + - "5988:5988" + +volumes: + couchdb: diff --git a/dev/nouveau.ini b/dev/nouveau.ini new file mode 100644 index 0000000..5ac96e9 --- /dev/null +++ b/dev/nouveau.ini @@ -0,0 +1,9 @@ +[nouveau] +enable = true +url = http://couchdb-nouveau:5987 + +[admins] +admin = -pbkdf2:sha256-6ee4d8e452a43eab4347de0bd87a4d05edc2f00ff6e710a65506f4f8f00d613e,a42656f6f0874c36474532485e98d9ca,600000 + +[couchdb] +uuid = 0fb7c0c1b93036ab4969f0a03665bdbf \ No newline at end of file diff --git a/dev/nouveau.yaml b/dev/nouveau.yaml new file mode 100644 index 0000000..6900744 --- /dev/null +++ b/dev/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 \ No newline at end of file