freebsd-ports/databases/couchdb3/files/couchdb3.in
Dave Cottlehuber 6924dfdf7e databases/couchdb3: update to 3.4.2, resolve PR282217
- include QuickJS engine
- support xxHash for data integrity checksums
- improved mango keys-only indexes
- https://blog.couchdb.org/2024/10/22/3-4-2/
- https://docs.couchdb.org/en/stable/whatsnew/3.4.html

- ensure snappy NIF is compiled without optimisations to avoid
    corrupted documents under newer clang versions, used in
    in 14.1-RELEASE (see PR282217 for details)

Sponsored by:	SkunkWerks, GmbH

PR:		282217
2024-11-22 17:27:52 +00:00

90 lines
2.2 KiB
Bash

#!/bin/sh
# PROVIDE: couchdb3
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# couchdb3_enable (bool): Set to NO by default.
# Set it to YES to enable couchdb.
. /etc/rc.subr
name=%%PORTNAME%%
rcvar=%%PORTNAME%%_enable
start_cmd="${name}_start"
stop_cmd="${name}_stop"
status_cmd="${name}_status"
load_rc_config $name
: ${%%PORTNAME%%_enable:="NO"}
: ${%%PORTNAME%%_user="couchdb"}
: ${%%PORTNAME%%_erl_flags="-couch_ini %%APPDIR%%/etc/default.ini %%ETCDIR%%/local.ini"}
: ${%%PORTNAME%%_chdir="/var/db/%%PORTNAME%%"}
command="%%PREFIX%%/libexec/%%PORTNAME%%/bin/couchdb"
pidfile="/var/run/${name}.pid"
daemonpidfile="/var/run/${name}-daemon.pid"
%%PORTNAME%%_start()
{
# chdir manually as overriding _start() blocks rc.subr defaults
cd "${%%PORTNAME%%_chdir}"
/usr/sbin/daemon -p ${pidfile} \
-P ${daemonpidfile} \
-t ${name} \
-u ${%%PORTNAME%%_user} \
env ERL_FLAGS="${erl_flags}" \
HOME=/var/run/%%PORTNAME%% \
ERL_CRASH_DUMP=/var/run/%%PORTNAME%%/erl_crash.dump \
COUCHDB_FAUXTON_DOCROOT=%%WWWDIR%% \
COUCHDB_ARGS_FILE=%%PREFIX%%/etc/couchdb3/vm.args \
COUCHDB_INI_FILES='%%PREFIX%%/libexec/couchdb3/etc/default.ini %%PREFIX%%/etc/couchdb3/local.ini' \
${command}
}
%%PORTNAME%%_stop()
{
echo -n "Stopping ${name}: "
retval=0
if ! status_quiet
then
echo "already stopped"
return 1
else
%%PORTNAME%%_pids=$(/bin/pgrep -ifU ${%%PORTNAME%%_user} ${name})
kill ${%%PORTNAME%%_pids}
wait_for_pids ${%%PORTNAME%%_pids}
retval=$?
echo "stopped"
fi
return $retval
}
%%PORTNAME%%_status()
{
/bin/pgrep -ifU ${%%PORTNAME%%_user} ${name} > /dev/null && status="$?" || status="$?"
if [ "${status}" = 0 ]; then
echo "${name} is running"
return 0
elif [ "${status}" = 4 ]; then
echo "could not access PID file for ${name}"
return ${status}
else
echo "${name} is not running"
return ${status}
fi
}
status_quiet()
{
%%PORTNAME%%_status >/dev/null 2>&1
}
run_rc_command $1