Skip to content

add dev Dockerfile for nouveau #275

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
*.swp
.idea
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <image-hash> --help
docker run -it -p 15984:15984 -p 25984:25984 <image-hash> -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,
58 changes: 58 additions & 0 deletions dev/Dockerfile-nouveau
Original file line number Diff line number Diff line change
@@ -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"]
36 changes: 36 additions & 0 deletions dev/compose.yml
Original file line number Diff line number Diff line change
@@ -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:
9 changes: 9 additions & 0 deletions dev/nouveau.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[nouveau]
enable = true
url = http://couchdb-nouveau:5987

[admins]
admin = -pbkdf2:sha256-6ee4d8e452a43eab4347de0bd87a4d05edc2f00ff6e710a65506f4f8f00d613e,a42656f6f0874c36474532485e98d9ca,600000

[couchdb]
uuid = 0fb7c0c1b93036ab4969f0a03665bdbf
27 changes: 27 additions & 0 deletions dev/nouveau.yaml
Original file line number Diff line number Diff line change
@@ -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