Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions acct-group/opensearch-dashboards/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>matoro@users.noreply.github.com</email>
<name>matoro</name>
</maintainer>
</pkgmetadata>
10 changes: 10 additions & 0 deletions acct-group/opensearch-dashboards/opensearch-dashboards-0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit acct-group

DESCRIPTION="Group for wwwp-apps/opensearch-dashboards-bin"

ACCT_GROUP_ID=-1
8 changes: 8 additions & 0 deletions acct-user/opensearch-dashboards/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>matoro@users.noreply.github.com</email>
<name>matoro</name>
</maintainer>
</pkgmetadata>
14 changes: 14 additions & 0 deletions acct-user/opensearch-dashboards/opensearch-dashboards-0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit acct-user

DESCRIPTION="User for www-apps/opensearch-dashboards-bin"
ACCT_USER_ID=-1
ACCT_USER_GROUPS=( "${PN}" )
ACCT_USER_HOME="/var/lib/${PN}"
ACCT_USER_HOME_PERMS="0750"

acct-user_add_deps
14 changes: 14 additions & 0 deletions acct-user/opensearch/opensearch-0-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit acct-user

DESCRIPTION="User for dev-db/opensearch-bin"
ACCT_USER_ID=-1
ACCT_USER_GROUPS=( "${PN}" )
ACCT_USER_HOME="/var/lib/${PN}"
ACCT_USER_HOME_PERMS="0750"

acct-user_add_deps
4 changes: 4 additions & 0 deletions dev-db/opensearch-bin/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DIST opensearch-3.3.2-linux-arm64.tar.gz 737650112 BLAKE2B a7bd3d49b188a9b6a5c4b949891dcc35c5bc2f5f6e0dfb016247057b7a4f4e564a7cc73aa5f3e9dd6ce7c13e860ae21ab254023ac789dbf84cf6f389274d5589 SHA512 ab055a9192b04be020272a7769801f041c28ad9e12849d54c5ed96b844692b8fcf2ab66ae91f761cc052d3f19777a4a49c43fa81a7ffb037cb2afbe62c4a8dec
DIST opensearch-3.3.2-linux-arm64.tar.gz.sig 543 BLAKE2B ab99d6fe9e8e990aa79004d6eedb8772f4a5d77671f889c8a2059bbd98a1d6e8ba8b860271b8c8a997ce287f0a44d85709e9600647292b5a525b77f39f394afc SHA512 4ac350faeefefd7a92d8d21bc224834c5f98c2b549a3c1f41b61bfa7da3a9384ff56a681750d282373d3733c3a0969af36a74268544f4f38b66fe30205b8260f
DIST opensearch-3.3.2-linux-x64.tar.gz 985756492 BLAKE2B 5d81f27bb4cac928ae00becadf6c2e75763e0d918937c553d288c43452dda7725b9c59317c98e9edb010ae3106d9af66470e1c14bc7713280811a94f3a0ee4e5 SHA512 68dc91ada02bda29a1efed6ef9916d893e58eef42e20482a6bdb1aab21c2fae490ef198a815b4ab8bcbcc87e44ce272b5943d8f67dcf37bb432e0205031a94e4
DIST opensearch-3.3.2-linux-x64.tar.gz.sig 543 BLAKE2B 896938bfccf61621fa9ef79c4e59cfa49d98082ac75188386ed4fbb1b720985a92b07f531116dbb1c21c81cac08b3e4a904891401f4b76f34db5963970def0f0 SHA512 ce19facfef9c098a495e8402b4160921f44c0e76e140c6f3bfd17a1a093896a35a906abb61cda97c6a3d423708833276312c91be093d02b69261818d6b4c5202
31 changes: 31 additions & 0 deletions dev-db/opensearch-bin/files/opensearch-env-r2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- a/bin/opensearch-env
+++ b/bin/opensearch-env
@@ -15,6 +15,28 @@
OS="other"
fi

+eerror()
+{
+ echo "$@" >&2
+}
+
+OPENSEARCH_JAVA_VER=XXX
+if [[ -z $OPENSEARCH_JAVA_HOME ]]; then
+ if [[ -z ${OPENSEARCH_JAVA_VER} ]]; then
+ eerror "Neither OPENSEARCH_JAVA_HOME nor OPENSEARCH_JAVA_VER is set"
+ exit 1
+ fi
+ GENTOO_VM=$(depend-java-query --get-vm virtual/jre:${OPENSEARCH_JAVA_VER})
+ if [[ -n $GENTOO_VM ]]; then
+ OPENSEARCH_JAVA_HOME=$(java-config-2 --select-vm=${GENTOO_VM} --jre-home)
+ fi
+
+ if [[ -z $OPENSEARCH_JAVA_HOME ]]; then
+ eerror "Could not find a suitable JVM for java v${OPENSEARCH_JAVA_VER}"
+ exit 1
+ fi
+fi
+
# SCRIPT might be an arbitrarily deep series of symbolic links; loop until we
# have the concrete path
while [ -h "$SCRIPT" ] ; do
12 changes: 12 additions & 0 deletions dev-db/opensearch-bin/files/opensearch-systemd-pre-exec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# CONF_FILE setting was removed
if [ ! -z "$CONF_FILE" ]; then
echo "CONF_FILE setting is no longer supported. opensearch.yml must be placed in the config directory and cannot be renamed."
exit 1
fi

# fails to start without keystore
if [ ! -f "${OPENSEARCH_PATH_CONF}/opensearch.keystore" ]; then
"${OPENSEARCH_HOME}/bin/opensearch-keystore" create
fi
65 changes: 65 additions & 0 deletions dev-db/opensearch-bin/files/opensearch.conf.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
################################
# Opensearch
################################

# Required Java major version
OPENSEARCH_JAVA_VER=XXX

# Opensearch home directory
#OPENSEARCH_HOME=/usr/share/opensearch

# Opensearch Java path
#OPENSEARCH_JAVA_HOME=

# Opensearch configuration directory
#CONF_DIR=/etc/opensearch

# Opensearch data directory
#DATA_DIR=/var/lib/opensearch

# Opensearch logs directory
#LOG_DIR=/var/log/opensearch

# Additional Java OPTS
#OPENSEARCH_JAVA_OPTS=

################################
# Opensearch service
################################

# When executing the init script, this user will be used to run the opensearch service.
# The default value is 'opensearch' and is declared in the init.d file.
# Note that this setting is only used by the init script. If changed, make sure that
# the configured user can read and write into the data, work, plugins and log directories.
# For systemd service, the user is usually configured in file /usr/lib/systemd/system/opensearch.service
#OPENSEARCH_USER=opensearch
#OPENSEARCH_GROUP=opensearch

# The number of seconds to wait before checking if Opensearch started successfully as a daemon process
#OPENSEARCH_STARTUP_SLEEP_TIME=5

################################
# System properties
################################

# Specifies the maximum file descriptor number that can be opened by this process
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
# /usr/lib/systemd/system/opensearch.service takes precedence
MAX_OPEN_FILES=65536

# The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
# in opensearch.yml.
# When using Systemd, the LimitMEMLOCK property must be set
# in /usr/lib/systemd/system/opensearch.service
MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
# property is set at boot time in /usr/lib/sysctl.d/opensearch.conf
#MAX_MAP_COUNT=262144

# https://www.elastic.co/guide/en/opensearch/reference/master/max-number-of-threads.html
MAX_THREADS=4096

rc_ulimit="-l $MAX_LOCKED_MEMORY -n $MAX_OPEN_FILES -u $MAX_THREADS"
86 changes: 86 additions & 0 deletions dev-db/opensearch-bin/files/opensearch.init.9
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/sbin/openrc-run

name="Opensearch"
description="Opensearch Server"

OPENSEARCH_INSTANCE=${RC_SVCNAME#*.}

if [ -n "${OPENSEARCH_INSTANCE}" ] && [ ${RC_SVCNAME} != "opensearch" ]; then
OPENSEARCH_BASE_PATH="/var/lib/opensearch/${OPENSEARCH_INSTANCE}"
CONF_DIR="/etc/opensearch/${OPENSEARCH_INSTANCE}"
DEFAULT_LOG_DIR="/var/log/opensearch/${OPENSEARCH_INSTANCE}"
else
OPENSEARCH_BASE_PATH="/var/lib/opensearch/_default"
CONF_DIR="/etc/opensearch"
DEFAULT_LOG_DIR="/var/log/opensearch/_default"
fi

OPENSEARCH_HOME=${OPENSEARCH_HOME:="/usr/share/opensearch"}
OPENSEARCH_USER=${OPENSEARCH_USER:="opensearch"}
OPENSEARCH_GROUP=${OPENSEARCH_GROUP:="opensearch"}
OPENSEARCH_STARTUP_SLEEP_TIME=${OPENSEARCH_STARTUP_TIME:=5}
##OPENSEARCH_JAVA_HOME=${OPENSEARCH_JAVA_HOME:=$(java-config -g JAVA_HOME)}
MAX_OPEN_FILES=${MAX_OPEN_FILES:=65536}
MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144}

DATA_DIR=${DATA_DIR:="${OPENSEARCH_BASE_PATH}/data"}
LOG_DIR=${LOG_DIR:="${DEFAULT_LOG_DIR}"}

if [ -f "${CONF_DIR}/opensearch.in.sh" ]; then
OPENSEARCH_INCLUDE="${CONF_DIR}/opensearch.in.sh"
fi

if [[ -z $OPENSEARCH_JAVA_HOME ]]; then
if [[ -z ${OPENSEARCH_JAVA_VER} ]]; then
eerror "Neither OPENSEARCH_JAVA_HOME nor OPENSEARCH_JAVA_VER is set"
exit 1
fi
GENTOO_VM=$(depend-java-query --get-vm virtual/jre:${OPENSEARCH_JAVA_VER})
if [[ -n $GENTOO_VM ]]; then
OPENSEARCH_JAVA_HOME=$(java-config-2 --select-vm=${GENTOO_VM} --jre-home)
fi

if [[ -z $OPENSEARCH_JAVA_HOME ]]; then
eerror "Could not find a suitable JVM for java v${OPENSEARCH_JAVA_VER}"
exit 1
fi
fi

export OPENSEARCH_INCLUDE
export OPENSEARCH_JAVA_HOME
export OPENSEARCH_JAVA_OPTS
export OPENSEARCH_JVM_OPTIONS
export OPENSEARCH_STARTUP_SLEEP_TIME
export OPENSEARCH_PATH_CONF="${CONF_DIR}"

pidfile="/run/opensearch/${RC_SVCNAME}.pid"

command="/usr/share/opensearch/bin/opensearch"
command_args="-Epath.logs=${LOG_DIR} -Epath.data=${DATA_DIR}"
command_args_background="--daemonize --pidfile=${pidfile}"
command_user="${OPENSEARCH_USER}:${OPENSEARCH_GROUP}"
required_files="${CONF_DIR}/opensearch.yml"
retry="TERM/30/KILL/30"

depend() {
use net
}

start_pre() {
if [ -n "${MAX_MAP_COUNT}" -a -f /proc/sys/vm/max_map_count ]; then
sysctl -q -w vm.max_map_count=${MAX_MAP_COUNT}
fi

checkpath -d -o "${OPENSEARCH_USER}:${OPENSEARCH_GROUP}" -m750 "/var/lib/opensearch"
checkpath -d -o "${OPENSEARCH_USER}:${OPENSEARCH_GROUP}" -m750 "/var/log/opensearch"
checkpath -d -o "${OPENSEARCH_USER}:${OPENSEARCH_GROUP}" -m750 "/run/opensearch"
checkpath -d -o "${OPENSEARCH_USER}:${OPENSEARCH_GROUP}" -m750 "${OPENSEARCH_BASE_PATH}"
checkpath -d -o "${OPENSEARCH_USER}:${OPENSEARCH_GROUP}" -m750 "${LOG_DIR}"

# fails to start without keystore
if [ ! -f "${CONF_DIR}/opensearch.keystore" ]; then
"${OPENSEARCH_HOME}/bin/opensearch-keystore" create
else
"${OPENSEARCH_HOME}/bin/opensearch-keystore" upgrade
fi
}
67 changes: 67 additions & 0 deletions dev-db/opensearch-bin/files/opensearch.service.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[Unit]
Description=Opensearch
Documentation=https://opensearch.org/docs/latest
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
RuntimeDirectory=opensearch
PrivateTmp=true
Environment=OPENSEARCH_HOME=/usr/share/opensearch
Environment=OPENSEARCH_PATH_CONF=/etc/opensearch

WorkingDirectory=/usr/share/opensearch

ExecStartPre=+"/usr/share/opensearch/bin/opensearch-systemd-pre-exec"

User=opensearch
Group=opensearch

ExecStart=/usr/share/opensearch/bin/opensearch \
-p ${PID_DIR}/opensearch.pid \
-Epath.logs=${LOG_DIR} \
-Epath.data=${DATA_DIR} \
--quiet

# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# opensearch logging system is initialized. Opensearch
# stores its logs in /var/log/opensearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535

# Specifies the maximum number of processes
LimitNPROC=4096

# Specifies the maximum size of virtual memory
LimitAS=infinity

# Specifies the maximum file size
LimitFSIZE=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Send the signal only to the JVM rather than its control group
KillMode=process

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

# Allow a slow startup before the systemd notifier module kicks in to extend the timeout
TimeoutStartSec=75

[Install]
WantedBy=multi-user.target
6 changes: 6 additions & 0 deletions dev-db/opensearch-bin/files/opensearch.service.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Service]
Environment="OPENSEARCH_HOME=/usr/share/opensearch"
Environment="OPENSEARCH_PATH_CONF=/etc/opensearch"
Environment="DATA_DIR=/var/lib/opensearch"
Environment="LOG_DIR=/var/log/opensearch"
Environment="PID_DIR=/run/opensearch"
1 change: 1 addition & 0 deletions dev-db/opensearch-bin/files/opensearch.sysctl.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vm.max_map_count=262144
1 change: 1 addition & 0 deletions dev-db/opensearch-bin/files/opensearch.tmpfiles.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d /run/opensearch 0755 opensearch opensearch -
8 changes: 8 additions & 0 deletions dev-db/opensearch-bin/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>matoro@users.noreply.github.com</email>
<name>matoro</name>
</maintainer>
</pkgmetadata>
Loading