This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch nouveau
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git

commit 5489c628d24556cc48fc5c27a663467dc169e386
Author: Robert Newson <[email protected]>
AuthorDate: Thu Dec 7 17:46:24 2023 +0000

    Build nouveau package
---
 debian/conf/nouveau.yaml         | 28 ++++++++++++++++++++++++
 debian/control.in                | 15 +++++++++++++
 debian/couchdb-nouveau.dirs      |  3 +++
 debian/couchdb-nouveau.install   |  3 +++
 debian/couchdb-nouveau.postinst  | 46 ++++++++++++++++++++++++++++++++++++++++
 debian/couchdb-nouveau.postrm    | 45 +++++++++++++++++++++++++++++++++++++++
 debian/couchdb-nouveau.service   | 28 ++++++++++++++++++++++++
 debian/couchdb-nouveau.templates | 11 ++++++++++
 8 files changed, 179 insertions(+)

diff --git a/debian/conf/nouveau.yaml b/debian/conf/nouveau.yaml
new file mode 100644
index 0000000..30515ee
--- /dev/null
+++ b/debian/conf/nouveau.yaml
@@ -0,0 +1,28 @@
+maxIndexesOpen: 5000
+commitIntervalSeconds: 30
+idleSeconds: 60
+rootDir: /var/opt/nouveau/indexes
+
+logging:
+  level: INFO
+
+server:
+  applicationConnectors:
+    - type: http
+      bindHost: 127.0.0.1
+      port: 5987
+      useDateHeader: false
+  gzip:
+    includedMethods:
+      - GET
+      - POST
+  requestLog:
+    appenders:
+      - type: file
+        archive: true
+        archivedFileCount: 5
+        archivedLogFilenamePattern: /var/opt/nouveau/log/nouveau-%d.log
+        currentLogFilename: /var/opt/nouveau/log/nouveau.log
+        immediateFlush: false
+        maxFileSize: 10MB
+        queueSize: 512
diff --git a/debian/control.in b/debian/control.in
index bfd5074..4c87550 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -37,6 +37,7 @@ Depends: adduser,
          ${misc:Depends}
 Replaces: couchdb-bin,
           couchdb-common
+Suggests: couchdb-nouveau
 Breaks: couchdb-bin,
         couchdb-common
 Description: RESTful document oriented database
@@ -56,3 +57,17 @@ Description: RESTful document oriented database
  standalone node or part of a cluster, and associated other parameters as
  necessary. It adds the systemd / init job and other items needed for a
  system-wide CouchDB instance that is started at boot.
+
+Package: couchdb-nouveau
+Architecture: any
+Depends: systemd,
+         default-jre-headless | java11-runtime-headless | java11-runtime,
+         lsb-base,
+         procps,
+         ${misc:Depends}
+Description: Nouveau is a modern replacement for dreyfus/clouseau
+  Nouveau is a modern replacement for dreyfus/clouseau built on DropWizard,
+  Java 11+ and Lucene 9.
+  .
+  Nouveau transforms Apache CouchDB databases into Apache Lucene indexes at
+  the shard level and then merges the results together.
diff --git a/debian/couchdb-nouveau.dirs b/debian/couchdb-nouveau.dirs
new file mode 100644
index 0000000..a40f803
--- /dev/null
+++ b/debian/couchdb-nouveau.dirs
@@ -0,0 +1,3 @@
+etc/opt/nouveau
+opt/nouveau
+var/opt/nouveau
diff --git a/debian/couchdb-nouveau.install b/debian/couchdb-nouveau.install
new file mode 100755
index 0000000..3f6f9ac
--- /dev/null
+++ b/debian/couchdb-nouveau.install
@@ -0,0 +1,3 @@
+#!/usr/bin/dh-exec
+rel/couchdb/nouveau /opt
+debian/conf/nouveau.yaml /etc/opt/nouveau/
diff --git a/debian/couchdb-nouveau.postinst b/debian/couchdb-nouveau.postinst
new file mode 100644
index 0000000..5d928a8
--- /dev/null
+++ b/debian/couchdb-nouveau.postinst
@@ -0,0 +1,46 @@
+#!/bin/sh
+# 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.
+
+set -e
+
+# without this, debconf doesn't run on initial install
+. /usr/share/debconf/confmodule
+
+case $1 in
+    configure)
+        if ! getent passwd nouveau > /dev/null; then
+            adduser --system --quiet \
+                    --home /opt/nouveau --no-create-home \
+                    --disabled-login --disabled-password \
+                    --shell /bin/bash --group \
+                    --gecos "CouchDB Nouveau Administrator" \
+                    nouveau
+        fi
+        if test "`id -u nouveau`" -eq 0; then
+            echo "The nouveau administrative user must not be root." >&2
+            false
+        fi
+        if test "`id -g nouveau`" -eq 0; then
+            echo "The nouveau administrative group must not be root." >&2
+            false
+        fi
+        ;;
+
+    abort-upgrade|abort-remove|abort-configure)
+        ;;
+
+    *)
+        echo "postinst called with unknown argument '$1'" 1>&2
+        exit 1
+        ;;
+esac
diff --git a/debian/couchdb-nouveau.postrm b/debian/couchdb-nouveau.postrm
new file mode 100644
index 0000000..9e2ac61
--- /dev/null
+++ b/debian/couchdb-nouveau.postrm
@@ -0,0 +1,45 @@
+#!/bin/sh -e
+# 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.
+
+. /usr/share/debconf/confmodule
+
+case $1 in
+    purge)
+        if test -d "/opt/nouveau"; then
+            rm -rf "/opt/nouveau"
+        fi
+
+        db_input high couchdb-nouveau/postrm_remove_indexes || true
+        db_go || true
+        db_get couchdb-nouveau/postrm_remove_indexes || true
+
+        if [ "$RET" = "true" ]; then
+            if test -d "/var/opt/nouveau"; then
+                rm -rf "/var/opt/nouveau"
+            fi
+
+            # If we didn't delete the data, we should
+            # keep the uid and gid too.
+            if getent passwd nouveau > /dev/null; then
+                deluser nouveau >/dev/null 2>&1
+            fi
+            if getent group nouveau > /dev/null; then
+                delgroup nouveau >/dev/null 2>&1
+            fi
+        fi
+
+        #db_reset nouveau/?
+        ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/couchdb-nouveau.service b/debian/couchdb-nouveau.service
new file mode 100644
index 0000000..d885109
--- /dev/null
+++ b/debian/couchdb-nouveau.service
@@ -0,0 +1,28 @@
+[Unit]
+After=network-online.target
+Description=Apache CouchDB - Nouveau
+Wants=network-online.target
+
+[Service]
+
+# Configuration
+RuntimeDirectory=nouveau
+
+# Lifecycle
+ExecStart=/opt/nouveau/bin/nouveau server /etc/opt/nouveau/nouveau.yaml
+LimitNOFILE=infinity
+Restart=on-failure
+
+# Security
+Group=nouveau
+NoNewPrivileges=true
+ProtectHome=yes
+ProtectSystem=strict
+ReadWritePaths=/var/opt/nouveau/
+SystemCallErrorNumber=EPERM
+SystemCallFilter=@system-service
+User=nouveau
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/debian/couchdb-nouveau.templates b/debian/couchdb-nouveau.templates
new file mode 100644
index 0000000..7b27166
--- /dev/null
+++ b/debian/couchdb-nouveau.templates
@@ -0,0 +1,11 @@
+# NOTE TO DEVELOPERS
+# If you change this file, run debconf-updatepo !
+# Failure to do so will result in a rejected pull request.
+
+Template: couchdb-nouveau/postrm_remove_indexes
+Type: boolean
+Default: false
+_Description: Remove all CouchDB Nouveau indexes?
+ The /var/opt/couchdb-nouveau/ directory containing all CouchDB databases will
+ be removed. This will also clear the stored node name for this machine,
+ and remove the couchdb-nouveau user and group.

Reply via email to