You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2024/08/29 12:59:31 UTC
(couchdb-pkg) branch main updated: RPM support for nouveau
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git
The following commit(s) were added to refs/heads/main by this push:
new 366942b RPM support for nouveau
366942b is described below
commit 366942bb4ca42eafdf69b66471173686ef900631
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Thu Aug 22 01:25:10 2024 -0400
RPM support for nouveau
This is a simple version that goes along with the release artifacts
file setup mostly, just adds a systemd unit file for nouveau.
Nouveau config setting can be automatically enabled the rpm install
using `COUCHDB_NOUVEAU_ENABLE=true`.
For instance:
`COUCHDB_NOUVEAU_ENABLE=true COUCHDB_COOKIE=c00kie dnf install couchdb*.rpm`
Java dependency is declared as a `Suggests:...`. This is the weakest
form of dependency declaration. It won't automatically bring in java
21.
In the next minor version it may become a `Recommends:` which is one
level higher and will automatically install it.
If nouveau config is enabled during the RPM install, user is then
urged to install java (suggestion via dnf but they may install their
own from any vendor) and to enable the systemd unit to auto-start
after boot.
CouchDB service also works this way: it has to be enabled
explicitly. This part didn't change:
`systemctl enable couchdb`
`systemctl enable couchdb-nouveau`
This lets a user choose to start just CouchDB on a server, just
Nouveau, or both CouchDB and Noveau.
In addition, since we're updating the RPM package, remove some of
deprecated/redundant settings needed for old CentOS-es:
- Log to journald instead of a file
- Log level is already set to info, so no need to override it again in the RPM package
- No need for an init file, all supported OSes have systemd
---
rpm/SOURCES/10-filelog.ini | 4 --
rpm/SOURCES/couchdb-nouveau.service | 22 ++++++
rpm/SOURCES/couchdb.init | 131 ------------------------------------
rpm/SOURCES/couchdb.logrotate | 9 ---
rpm/SPECS/couchdb.spec.in | 42 +++++++++---
5 files changed, 54 insertions(+), 154 deletions(-)
diff --git a/rpm/SOURCES/10-filelog.ini b/rpm/SOURCES/10-filelog.ini
deleted file mode 100644
index 6e0d7cf..0000000
--- a/rpm/SOURCES/10-filelog.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[log]
-writer = file
-file = /var/log/couchdb/couchdb.log
-level = info
diff --git a/rpm/SOURCES/couchdb-nouveau.service b/rpm/SOURCES/couchdb-nouveau.service
new file mode 100644
index 0000000..17916dd
--- /dev/null
+++ b/rpm/SOURCES/couchdb-nouveau.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=Apache CouchDB - Nouveau
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Environment="JAVA_OPTS=-server"
+ExecStart=/opt/couchdb/nouveau/bin/nouveau server /opt/couchdb/etc/nouveau.yaml
+LimitNOFILE=infinity
+Restart=on-failure
+NoNewPrivileges=true
+ProtectHome=yes
+ProtectSystem=strict
+ReadWritePaths=/var/lib/couchdb/nouveau/
+SystemCallErrorNumber=EPERM
+SystemCallFilter=@system-service
+RuntimeDirectory=couchdb-nouveau
+User=couchdb
+Group=couchdb
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rpm/SOURCES/couchdb.init b/rpm/SOURCES/couchdb.init
deleted file mode 100644
index 66c30e4..0000000
--- a/rpm/SOURCES/couchdb.init
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/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.
-#
-# chkconfig: - 26 74
-# description: Starts and stops the CouchDB daemon that handles \
-# all database requests.
-#
-### BEGIN INIT INFO
-# Provides: couchdb
-# Required-Start: $remote_fs $syslog $network
-# Required-Stop: $remote_fs $syslog $network
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Apache CouchDB, a RESTful document oriented database
-# Description: Apache CouchDB is a distributed, fault-tolerant and schema-free
-# document-oriented database accessible via a RESTful HTTP/JSON API. Among other
-# features, it provides robust, incremental replication with bi-directional
-# conflict detection and resolution, and is queryable and indexable using a
-# table-oriented view engine with JavaScript acting as the default view
-# definition language.
-### END INIT INFO
-# Author: CouchDB Developers <de...@couchdb.apache.org>
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-prog=couchdb
-exec=/opt/couchdb/bin/$prog
-
-COUCHDB_USER=couchdb
-COUCHDB_PIDFILE=/var/run/$prog.pid
-
-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
-
-PID="$(pgrep -u couchdb beam* || true)"
-LOCKFILE=/var/lock/subsys/$prog
-
-start() {
- [ -x $exec ] || exit 5
- echo -n $"Starting $prog: "
- status_q && echo -n "already running" && warning && echo && exit 0
- daemon --user $COUCHDB_USER \
- --pidfile $COUCHDB_PIDFILE \
- nohup $exec $COUCHDB_OPTIONS >/dev/null 2>&1 &
- retval=$?
- [ $retval -eq 0 ] && touch $LOCKFILE && success || failure
- echo
- return $retval
-}
-
-stop() {
- echo -n $"Stopping $prog: "
- retval=0
- if ! status_q ; then
- echo -n "already stopped" && warning
- else
- pkill -u $COUCHDB_USER beam\*
- retval=$?
- [ $retval -eq 0 ] && rm -f $lockfile && success || failure
- fi
- echo
- return $retval
-}
-
-restart() {
- stop
- start
-}
-
-reload() {
- restart
-}
-
-usage() {
- echo "Usage: couchdb {start|stop|status|restart|force-reload}" >&2
-}
-
-status() {
- pgrep -u couchdb beam* > /dev/null && status="$?" || status="$?"
- if [ "$status" = 0 ]; then
- echo "$prog is running"
- return 0
- elif [ "$status" = 4 ]; then
- echo "could not access PID file for $prog"
- return $status
- else
- echo "$prog is not running"
- return $status
- fi
-}
-
-status_q() {
- status >/dev/null 2>&1
-}
-
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status
- ;;
- reload)
- usage
- exit 3
- ;;
- force-reload)
- reload
- ;;
- restart)
- restart
- ;;
- '')
- usage
- exit 3
- ;;
-esac
-exit $?
diff --git a/rpm/SOURCES/couchdb.logrotate b/rpm/SOURCES/couchdb.logrotate
deleted file mode 100644
index 920ee73..0000000
--- a/rpm/SOURCES/couchdb.logrotate
+++ /dev/null
@@ -1,9 +0,0 @@
-/var/log/couchdb/couchdb.log {
- daily
- rotate 7
- copytruncate
- delaycompress
- compress
- notifempty
- missingok
-}
diff --git a/rpm/SPECS/couchdb.spec.in b/rpm/SPECS/couchdb.spec.in
index 6a6cf5b..eb3ecf9 100644
--- a/rpm/SPECS/couchdb.spec.in
+++ b/rpm/SPECS/couchdb.spec.in
@@ -21,9 +21,7 @@ Version: %{_version}
Release: 1%{?dist}
Source: https://www.apache.org/dist/couchdb/source/${version}/apache-couchdb-%{version}.tar.gz
Source1: %{name}.service
-Source2: %{name}.init
-Source3: 10-filelog.ini
-Source5: %{name}.logrotate
+Source2: %{name}-nouveau.service
Prefix: %{prefix}
Group: Applications/Databases
URL: https://couchdb.apache.org/
@@ -40,16 +38,18 @@ Requires(pre): shadow-utils
BuildRequires: git
BuildRequires: help2man
-#BuildRequires: %SPIDERMONKEY_DEV%
BuildRequires: libcurl-devel
BuildRequires: libicu-devel
BuildRequires: nodejs >= 6.10.1
+BuildRequires: java-21-openjdk-devel
Requires(post): curl
Requires(post): %SPIDERMONKEY%
Requires(post): libicu >= 4.2.1
Requires(post): procps
+Suggests: java-21-openjdk-headless
+
BuildRequires: xfsprogs-devel
%{?systemd_requires}
BuildRequires: systemd
@@ -93,14 +93,12 @@ if ! /usr/bin/getent passwd couchdb > /dev/null; then /usr/sbin/adduser \
%install
%{__install} -d -m0755 %{buildroot}/opt
%{__cp} -r rel/couchdb %{buildroot}/opt
-%{__install} -d -m0750 %{buildroot}/var/log/%{name}
%{__install} -d -m0750 %{buildroot}%{_sharedstatedir}/%{name}
-%{__install} -Dp -m0644 %{SOURCE3} %{buildroot}/opt/%{name}/etc/default.d/10-filelog.ini
-%{__install} -Dp -m0644 %{SOURCE5} %{buildroot}/etc/logrotate.d/%{name}
+%{__install} -d -m0750 %{buildroot}%{_sharedstatedir}/%{name}/nouveau
/bin/find %{buildroot}/opt/%{name} -name *.ini -exec %{__chmod} 0640 {} \;
%{__install} -Dp -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
+%{__install} -Dp -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}-nouveau.service
%{__ln_s} -f -T %{_sharedstatedir}/%{name} %{buildroot}/opt/%{name}/data
-%{__ln_s} -f -T /var/log/%{name} %{buildroot}/opt/%{name}/var/log/%{name}
%post
if %{__grep} -q "^-setcookie monster$" /opt/%{name}/etc/vm.args; then
@@ -126,26 +124,50 @@ elif %{__grep} -q "^[# ]*-setcookie$" /opt/%{name}/etc/vm.args; then
escaped_cookie=$(printf '%s' "$cookie" | sed 's:\\:\\\\:g')
%{__sed} -i "/^[# ]*-setcookie/c\-setcookie '${escaped_cookie}'" /opt/%{name}/etc/vm.args
fi
+
+if [[ -v COUCHDB_NOUVEAU_ENABLE ]]; then
+ echo "Enabling nouveau in /opt/couchdb/etc/default.d/10-nouveau.ini"
+ echo " * Make sure to install java version 11+ (dnf install java-21-openjdk-headless)"
+ echo " * Enable couchdb-nouveau systemd unit"
+ cat <<EOF > /opt/couchdb/etc/default.d/10-nouveau.ini
+[nouveau]
+enable = true
+EOF
+fi
+
%{__chown} -R couchdb:couchdb /opt/%{name}
%{__chmod} a+x /opt/%{name}/bin/*
+%{__chmod} a+x /opt/%{name}/nouveau/bin/*
%systemd_post %{name}.service
+%systemd_post %{name}-nouveau.service
%preun
%systemd_preun %{name}.service
+%systemd_preun %{name}-nouveau.service
%postun
%systemd_postun_with_restart %{name}.service
+%systemd_postun_with_restart %{name}-nouveau.service
+
+if [ $1 -eq 0 ] ; then
+ # uninstall, remove auto-generated nouveau enable file
+ ${__rm} /opt/couchdb/etc/default.d/10-nouveau.ini
+fi
%files
%attr(0755, %{name}, %{name}) /opt/couchdb
%attr(0755, %{name}, %{name}) %dir %{_sharedstatedir}/%{name}
-%attr(0755, %{name}, %{name}) %dir /var/log/%{name}
+%attr(0755, %{name}, %{name}) %dir %{_sharedstatedir}/%{name}/nouveau
%config(noreplace) /opt/couchdb/etc/local.ini
%config(noreplace) /opt/couchdb/etc/vm.args
-%config /etc/logrotate.d/%{name}
+%config(noreplace) /opt/couchdb/etc/nouveau.yaml
%{_unitdir}/%{name}.service
+%{_unitdir}/%{name}-nouveau.service
%changelog
+* Thu Aug 22 2024 CouchDB Developers <de...@couchdb.apache.org> 3.4
+- Add nouveau service with a suggested dependency for java 21
+- Remove file-based logger, use journalctl for both couchdb and couchdb-nouveau
* Tue May 2 2017 CouchDB Developers <de...@couchdb.apache.org> 2.0.0-1
- New upstream version
- New sysvinit and systemd service files