summaryrefslogtreecommitdiff
path: root/textproc/opensearch216/files
diff options
context:
space:
mode:
Diffstat (limited to 'textproc/opensearch216/files')
-rw-r--r--textproc/opensearch216/files/opensearch.in115
-rw-r--r--textproc/opensearch216/files/patch-config_jvm.options23
-rw-r--r--textproc/opensearch216/files/patch-config_opensearch.yml15
-rw-r--r--textproc/opensearch216/files/pkg-message.in27
4 files changed, 180 insertions, 0 deletions
diff --git a/textproc/opensearch216/files/opensearch.in b/textproc/opensearch216/files/opensearch.in
new file mode 100644
index 000000000000..71334ce1ee01
--- /dev/null
+++ b/textproc/opensearch216/files/opensearch.in
@@ -0,0 +1,115 @@
+#!/bin/sh
+
+# PROVIDE: opensearch
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable opensearch:
+#
+# opensearch_enable="YES"
+#
+# opensearch_user (username): Set to opensearch by default.
+# Set it to required username.
+# opensearch_group (group): Set to opensearch by default.
+# Set it to required group.
+# opensearch_config (path): Set to %%PREFIX%%/etc/opensearch/opensearch.yml by default.
+# Set it to the config file location.
+# opensearch_java_home (path): Set to %%JAVA_HOME%% by default.
+# Set it to the root of the JDK to use.
+#
+. /etc/rc.subr
+
+name=opensearch
+rcvar=opensearch_enable
+
+load_rc_config ${name}
+
+: ${opensearch_enable:=NO}
+: ${opensearch_user=opensearch}
+: ${opensearch_group=opensearch}
+: ${opensearch_config=%%PREFIX%%/etc/opensearch}
+: ${opensearch_login_class=root}
+: ${opensearch_java_home="%%JAVA_HOME%%"}
+
+required_files="${opensearch_config}/opensearch.yml"
+_pidprefix=/var/run/opensearch/opensearch
+pidfile=${_pidprefix}.pid
+procname=${opensearch_java_home}/bin/java
+
+extra_commands="console status"
+console_cmd=opensearch_console
+start_precmd=opensearch_precmd
+command=%%PREFIX%%/lib/opensearch/bin/opensearch
+command_args="-d --pidfile=${pidfile}"
+
+export OPENSEARCH_PATH_CONF=${opensearch_config}
+export JAVA_HOME=${opensearch_java_home}
+
+opensearch_precmd()
+{
+ /usr/bin/install -d -o ${opensearch_user} -g ${opensearch_group} -m 755 ${pidfile%/*}
+ /usr/bin/install -d -o ${opensearch_user} -g ${opensearch_group} -m 755 /var/db/opensearch
+ /usr/bin/install -d -o ${opensearch_user} -g ${opensearch_group} -m 755 /var/log/opensearch
+}
+
+opensearch_console()
+{
+ command_args=""
+ run_rc_command "start"
+}
+
+if [ -n "$2" ]; then
+ profile="$2"
+ if [ "x${opensearch_profiles}" != "x" ]; then
+ eval opensearch_config="\${opensearch_${profile}_config:-}"
+ if [ "x${opensearch_config}" = "x" ]; then
+ echo "You must define a configuration (opensearch_${profile}_config)"
+ exit 1
+ fi
+ export OPENSEARCH_PATH_CONF=${opensearch_config}
+ required_files="${opensearch_config}/opensearch.yml"
+ required_files="${opensearch_config}/jvm.options"
+ eval opensearch_enable="\${opensearch_${profile}_enable:-${opensearch_enable}}"
+ pidfile="${_pidprefix}.${profile}.pid"
+ command_args="-d --pidfile=${pidfile}"
+ echo "===> opensearch profile: ${profile}"
+ else
+ echo "$0: extra argument ignored"
+ fi
+else
+ if [ "x${opensearch_profiles}" != "x" -a "x$1" != "x" ]; then
+ for profile in ${opensearch_profiles}; do
+ eval _enable="\${opensearch_${profile}_enable}"
+ case "x${_enable:-${opensearch_enable}}" in
+ x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
+ continue
+ ;;
+ x[Yy][Ee][Ss])
+ ;;
+ *)
+ if test -z "$_enable"; then
+ _var=opensearch_enable
+ else
+ _var=opensearch_"${profile}"_enable
+ fi
+ echo "Bad value" \
+ "'${_enable:-${opensearch_enable}}'" \
+ "for ${_var}. " \
+ "Profile ${profile} skipped."
+ continue
+ ;;
+ esac
+ %%PREFIX%%/etc/rc.d/opensearch $1 ${profile}
+ retcode="$?"
+ if [ "0${retcode}" -ne 0 ]; then
+ failed="${profile} (${retcode}) ${failed:-}"
+ else
+ success="${profile} ${success:-}"
+ fi
+ done
+ exit 0
+ fi
+fi
+
+run_rc_command "$1"
diff --git a/textproc/opensearch216/files/patch-config_jvm.options b/textproc/opensearch216/files/patch-config_jvm.options
new file mode 100644
index 000000000000..f6276944b6db
--- /dev/null
+++ b/textproc/opensearch216/files/patch-config_jvm.options
@@ -0,0 +1,23 @@
+--- config/jvm.options.orig 2021-07-30 14:01:34 UTC
++++ config/jvm.options
+@@ -61,17 +61,17 @@
+ -XX:HeapDumpPath=data
+
+ # specify an alternative path for JVM fatal error logs
+--XX:ErrorFile=logs/hs_err_pid%p.log
++-XX:ErrorFile=/hs_err_pid%p.log
+
+ ## JDK 8 GC logging
+ 8:-XX:+PrintGCDetails
+ 8:-XX:+PrintGCDateStamps
+ 8:-XX:+PrintTenuringDistribution
+ 8:-XX:+PrintGCApplicationStoppedTime
+-8:-Xloggc:logs/gc.log
++8:-Xloggc:${OPENSEARCH_TMPDIR}/gc.log
+ 8:-XX:+UseGCLogFileRotation
+ 8:-XX:NumberOfGCLogFiles=32
+ 8:-XX:GCLogFileSize=64m
+
+ # JDK 9+ GC logging
+-9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
++9-:-Xlog:gc*,gc+age=trace,safepoint:file=${OPENSEARCH_TMPDIR}/gc.log:utctime,pid,tags:filecount=32,filesize=64m
diff --git a/textproc/opensearch216/files/patch-config_opensearch.yml b/textproc/opensearch216/files/patch-config_opensearch.yml
new file mode 100644
index 000000000000..f5aa3ed1a80e
--- /dev/null
+++ b/textproc/opensearch216/files/patch-config_opensearch.yml
@@ -0,0 +1,15 @@
+--- config/opensearch.yml.orig 2021-07-02 23:22:08 UTC
++++ config/opensearch.yml
+@@ -31,10 +31,12 @@
+ # Path to directory where to store the data (separate multiple locations by comma):
+ #
+ #path.data: /path/to/data
++path.data: /var/db/opensearch
+ #
+ # Path to log files:
+ #
+ #path.logs: /path/to/logs
++path.logs: /var/log/opensearch
+ #
+ # ----------------------------------- Memory -----------------------------------
+ #
diff --git a/textproc/opensearch216/files/pkg-message.in b/textproc/opensearch216/files/pkg-message.in
new file mode 100644
index 000000000000..c08de567504c
--- /dev/null
+++ b/textproc/opensearch216/files/pkg-message.in
@@ -0,0 +1,27 @@
+[
+{ type: install
+ message: <<EOM
+Opensearch was installed
+
+Please see %%ETCDIR%% for a sample version of
+opensearch.yml.
+
+OpenSearch requires memory locking of large amounts of RAM.
+You may need to set:
+
+sysctl security.bsd.unprivileged_mlock=1
+
+When running within a jail, it's highly advisable to set:
+
+enforce_statfs = 1
+
+for the jail running opensearch instance.
+
+If OpenSearch was built with the PLUGINS option enabled (default) it will not
+start until the security plugin is properly configured. Please refer to the
+OpenSearch documentation for setting-up TLS:
+
+https://opensearch.org/docs/security-plugin/configuration/tls
+EOM
+}
+]