View | Details | Raw Unified | Return to bug 237374 | Differences between
and this patch

Collapse All | Expand All

(-)textproc/elasticsearch7/Makefile (+133 lines)
Line 0 Link Here
1
# Created by: Tom Judge <tj@FreeBSD.org>
2
# $FreeBSD$
3
4
PORTNAME=	elasticsearch
5
PORTVERSION=	7.4.2
6
DISTFILES=     ${PORTNAME}-${PORTVERSION}-darwin-x86_64.tar.gz
7
CATEGORIES=	textproc java devel
8
MASTER_SITES=	https://artifacts.elastic.co/downloads/${PORTNAME}/ 
9
PKGNAMESUFFIX=	7
10
11
MAINTAINER=	feld@FreeBSD.org
12
COMMENT=	Full-text search engine for Java
13
14
LICENSE=	APACHE20
15
16
BUILD_DEPENDS=	jna>0:devel/jna
17
RUN_DEPENDS=	bash>0:shells/bash \
18
		jna>0:devel/jna
19
20
CONFLICTS=	elasticsearch-[0-9]* elasticsearch[2-6]-[0-9]*
21
22
USES=		cpe shebangfix
23
NO_ARCH=	yes
24
USE_JAVA=	yes
25
NO_BUILD=	yes
26
JAVA_VERSION=	8+
27
USE_RC_SUBR=	${PORTNAME}
28
SHEBANG_FILES=	bin/elasticsearch \
29
		bin/elasticsearch-certgen \
30
		bin/elasticsearch-certutil \
31
		bin/elasticsearch-cli \
32
		bin/elasticsearch-croneval \
33
		bin/elasticsearch-env \
34
		bin/elasticsearch-keystore \
35
		bin/elasticsearch-migrate \
36
		bin/elasticsearch-node \
37
		bin/elasticsearch-plugin \
38
		bin/elasticsearch-saml-metadata \
39
		bin/elasticsearch-setup-passwords \
40
		bin/elasticsearch-shard \
41
		bin/elasticsearch-sql-cli \
42
		bin/elasticsearch-syskeygen \
43
		bin/elasticsearch-users \
44
		bin/x-pack-env \
45
		bin/x-pack-security-env \
46
		bin/x-pack-watcher-env
47
48
OPTIONS_DEFINE=	DOCS
49
50
.include <bsd.port.options.mk>
51
52
CONFIG_FILES=	elasticsearch.yml \
53
		log4j2.properties \
54
		jvm.options \
55
		role_mapping.yml \
56
		roles.yml
57
BINS=		elasticsearch \
58
		elasticsearch-certgen \
59
		elasticsearch-certutil \
60
		elasticsearch-cli \
61
		elasticsearch-croneval \
62
		elasticsearch-env \
63
		elasticsearch-keystore \
64
		elasticsearch-migrate \
65
		elasticsearch-node \
66
		elasticsearch-plugin \
67
		elasticsearch-saml-metadata \
68
		elasticsearch-setup-passwords \
69
		elasticsearch-shard \
70
		elasticsearch-sql-cli \
71
		elasticsearch-sql-cli-${PORTVERSION}.jar \
72
		elasticsearch-syskeygen \
73
		elasticsearch-users \
74
		x-pack-env \
75
		x-pack-security-env \
76
		x-pack-watcher-env
77
78
PORTDOCS=	LICENSE.txt \
79
		NOTICE.txt \
80
		README.textile
81
82
SIGAR_ARCH=	${ARCH:S|i386|x86|}
83
SEARCHUSER?=	elasticsearch
84
SEARCHGROUP?=	${SEARCHUSER}
85
USERS=		${SEARCHUSER}
86
GROUPS=		${SEARCHGROUP}
87
88
SUB_LIST=	ETCDIR=${ETCDIR} JAVA_HOME=${JAVA_HOME}
89
SUB_FILES=	pkg-message
90
91
post-patch:
92
	${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/config/elasticsearch.yml
93
	${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/bin/elasticsearch
94
	${RM} ${WRKSRC}/lib/jna-*.jar
95
	# ML plugin not supported on FreeBSD
96
	${RM} -rf ${WRKSRC}/modules/x-pack/x-pack-ml
97
98
do-install:
99
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/elasticsearch
100
.for f in ${CONFIG_FILES}
101
	${INSTALL} ${WRKSRC}/config/${f} ${STAGEDIR}${ETCDIR}/${f}.sample
102
.endfor
103
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/elasticsearch/bin
104
.for f in ${BINS}
105
	${INSTALL_SCRIPT} ${WRKSRC}/bin/${f} ${STAGEDIR}${PREFIX}/lib/elasticsearch/bin
106
.endfor
107
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/elasticsearch/lib
108
	(cd ${WRKSRC}/lib && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/lib/elasticsearch/lib/ "-name *\.jar")
109
110
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/elasticsearch/modules
111
	(cd ${WRKSRC}/modules && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/lib/elasticsearch/modules/)
112
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/elasticsearch/plugins
113
	${MKDIR} ${STAGEDIR}${PREFIX}/libexec/elasticsearch
114
	${INSTALL} -lrs ${STAGEDIR}${ETCDIR} ${STAGEDIR}${PREFIX}/lib/elasticsearch/config
115
	${LN} -s ${JAVASHAREDIR}/classes/jna.jar ${STAGEDIR}${PREFIX}/lib/elasticsearch/lib/jna.jar
116
117
do-install-DOCS-on:
118
	${MKDIR} ${STAGEDIR}${DOCSDIR}
119
.for f in ${PORTDOCS}
120
	${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}
121
.endfor
122
123
post-install:
124
	${ECHO} "@sample ${ETCDIR}/elasticsearch.yml.sample" >> ${TMPPLIST}
125
	${ECHO} "@sample ${ETCDIR}/log4j2.properties.sample" >> ${TMPPLIST}
126
	${ECHO} "@sample ${ETCDIR}/jvm.options.sample" >> ${TMPPLIST}
127
	${FIND} -s ${STAGEDIR}${PREFIX}/lib/elasticsearch -not -type d | ${SORT} | \
128
		${SED} -e 's#^${STAGEDIR}${PREFIX}/##' >> ${TMPPLIST}
129
	${ECHO} "@dir lib/elasticsearch/plugins" >> ${TMPPLIST}
130
	${ECHO} "@dir libexec/elasticsearch" >> ${TMPPLIST}
131
	${ECHO} "@dir(elasticsearch,elasticsearch,0755) ${ETCDIR}" >> ${TMPPLIST}
132
133
.include <bsd.port.mk>
(-)textproc/elasticsearch7/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1573233354
2
SHA256 (elasticsearch-7.4.2-darwin-x86_64.tar.gz) = 6d59a91a57c0d15cb302cf12ea835b40d0bcef05499fbc880247580b3f8720ed
3
SIZE (elasticsearch-7.4.2-darwin-x86_64.tar.gz) = 279956874
(-)textproc/elasticsearch7/files/elasticsearch.in (+130 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# $FreeBSD: head/textproc/elasticsearch6/files/elasticsearch.in 513796 2019-10-05 00:09:16Z glewis $
4
#
5
# PROVIDE: elasticsearch
6
# REQUIRE: NETWORKING SERVERS
7
# BEFORE: DAEMON
8
# KEYWORD: shutdown
9
#
10
# Add the following line to /etc/rc.conf to enable elasticsearch:
11
#
12
# elasticsearch_enable="YES"
13
#
14
# elasticsearch_user (username): Set to elasticsearch by default.
15
#               Set it to required username.
16
# elasticsearch_group (group):   Set to elasticsearch by default.
17
#               Set it to required group.
18
# elasticsearch_config (path):   Set to %%PREFIX%%/etc/elasticsearch/elasticsearch.yml by default.
19
#               Set it to the config file location.
20
# elasticsearch_java_home (path): Set to %%JAVA_HOME%% by default.
21
#               Set it to the root of the JDK to use.
22
#
23
. /etc/rc.subr
24
25
name=elasticsearch
26
rcvar=elasticsearch_enable
27
28
load_rc_config ${name}
29
30
: ${elasticsearch_enable:=NO}
31
: ${elasticsearch_user=elasticsearch}
32
: ${elasticsearch_group=elasticsearch}
33
: ${elasticsearch_config=%%PREFIX%%/etc/elasticsearch}
34
: ${elasticsearch_login_class=root}
35
: ${elasticsearch_java_home="%%JAVA_HOME%%"}
36
37
required_files="${elasticsearch_config}/elasticsearch.yml"
38
_pidprefix=/var/run/elasticsearch/elasticsearch
39
pidfile=${_pidprefix}.pid
40
procname=${elasticsearch_java_home}/bin/java
41
42
extra_commands="console status"
43
console_cmd=elasticsearch_console
44
start_precmd=elasticsearch_precmd
45
command=%%PREFIX%%/lib/elasticsearch/bin/elasticsearch
46
command_args="-d --pidfile=${pidfile}"
47
48
export ES_PATH_CONF=${elasticsearch_config}
49
export JAVA_HOME=${elasticsearch_java_home}
50
51
elasticsearch_precmd()
52
{
53
    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 ${pidfile%/*}
54
    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 /var/db/elasticsearch
55
    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 /var/log/elasticsearch
56
}
57
58
elasticsearch_console()
59
{
60
    command_args=""
61
    run_rc_command "start"
62
}
63
64
if [ -n "$2" ]; then
65
    profile="$2"
66
    if [ "x${elasticsearch_profiles}" != "x" ]; then
67
        eval elasticsearch_config="\${elasticsearch_${profile}_config:-}"
68
        if [ "x${elasticsearch_config}" = "x" ]; then
69
            echo "You must define a configuration  (elasticsearch_${profile}_config)"
70
            exit 1
71
        fi
72
	export ES_PATH_CONF=${elasticsearch_config}
73
        required_files="${elasticsearch_config}/elasticsearch.yml"
74
        required_files="${elasticsearch_config}/jvm.options"
75
        eval elasticsearch_enable="\${elasticsearch_${profile}_enable:-${elasticsearch_enable}}"
76
        pidfile="${_pidprefix}.${profile}.pid"
77
	command_args="-d --pidfile=${pidfile}"
78
	echo "===> elasticsearch profile: ${profile}"
79
    else
80
        echo "$0: extra argument ignored"
81
    fi
82
else
83
    if [ "x${elasticsearch_profiles}" != "x" -a "x$1" != "x" ]; then
84
        for profile in ${elasticsearch_profiles}; do
85
            eval _enable="\${elasticsearch_${profile}_enable}"
86
            case "x${_enable:-${elasticsearch_enable}}" in
87
            x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
88
                continue
89
                ;;
90
            x[Yy][Ee][Ss])
91
                ;;
92
            *)
93
                if test -z "$_enable"; then
94
                    _var=elasticsearch_enable
95
                else
96
                    _var=elasticsearch_"${profile}"_enable
97
                fi
98
                echo "Bad value" \
99
                    "'${_enable:-${elasticsearch_enable}}'" \
100
                    "for ${_var}. " \
101
                    "Profile ${profile} skipped."
102
                continue
103
                ;;
104
            esac
105
            %%PREFIX%%/etc/rc.d/elasticsearch $1 ${profile}
106
            retcode="$?"
107
            if [ "0${retcode}" -ne 0 ]; then
108
                failed="${profile} (${retcode}) ${failed:-}"
109
            else
110
                success="${profile} ${success:-}"
111
            fi
112
        done
113
        exit 0
114
    fi
115
fi
116
117
if [ "x${elasticsearch_mem_min}" != "x" ]; then
118
    echo "The elasticsearch_mem_min variable is no longer supported please set this in %%PREFIX%%/etc/jvm.options"
119
    exit 1;
120
fi
121
if [ "x${elasticsearch_mem_max}" != "x" ]; then
122
    echo "The elasticsearch_mem_max variable is no longer supported please set this in %%PREFIX%%/etc/jvm.options"
123
    exit 1;
124
fi
125
if [ "x${elasticsearch_props}" != "x" ]; then
126
    echo "The elasticsearch_props variable is no longer supported please set this in %%PREFIX%%/etc/jvm.options"
127
    exit 1;
128
fi
129
130
run_rc_command "$1"
(-)textproc/elasticsearch7/files/patch-config_elasticsearch.yml (+22 lines)
Line 0 Link Here
1
--- config/elasticsearch.yml.orig	2018-09-26 13:30:23 UTC
2
+++ config/elasticsearch.yml
3
@@ -31,10 +31,12 @@
4
 # Path to directory where to store the data (separate multiple locations by comma):
5
 #
6
 #path.data: /path/to/data
7
+path.data: /var/db/elasticsearch
8
 #
9
 # Path to log files:
10
 #
11
 #path.logs: /path/to/logs
12
+path.logs: /var/log/elasticsearch
13
 #
14
 # ----------------------------------- Memory -----------------------------------
15
 #
16
@@ -86,3 +88,6 @@
17
 # Require explicit names when deleting indices:
18
 #
19
 #action.destructive_requires_name: true
20
+
21
+# ml is not supported on FreeBSD
22
+xpack.ml.enabled: false
(-)textproc/elasticsearch7/files/patch-config_jvm.options (+18 lines)
Line 0 Link Here
1
--- config/jvm.options.orig	2019-07-24 08:21:42.000000000 -0700
2
+++ config/jvm.options	2019-08-16 13:41:33.818798000 -0700
3
@@ -107,13 +107,13 @@
4
 8:-XX:+PrintGCDateStamps
5
 8:-XX:+PrintTenuringDistribution
6
 8:-XX:+PrintGCApplicationStoppedTime
7
-8:-Xloggc:logs/gc.log
8
+8:-Xloggc:${ES_TMPDIR}/gc.log
9
 8:-XX:+UseGCLogFileRotation
10
 8:-XX:NumberOfGCLogFiles=32
11
 8:-XX:GCLogFileSize=64m
12
 
13
 # JDK 9+ GC logging
14
-9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
15
+9-:-Xlog:gc*,gc+age=trace,safepoint:file=${ES_TMPDIR}/gc.log:utctime,pid,tags:filecount=32,filesize=64m
16
 # due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
17
 # time/date parsing will break in an incompatible way for some date patterns and locals
18
 9-:-Djava.locale.providers=COMPAT
(-)textproc/elasticsearch7/files/pkg-message.in (+34 lines)
Line 0 Link Here
1
[
2
{ type: install
3
  message: <<EOM
4
Please see %%ETCDIR%% for sample versions of
5
elasticsearch.yml and logging.yml.
6
7
ElasticSearch requires memory locking of large amounts of RAM.
8
You may need to set:
9
10
sysctl security.bsd.unprivileged_mlock=1
11
12
!!! PLUGINS NOTICE !!!
13
14
ElasticSearch plugins should only be installed via the elasticsearch-plugin
15
included with this software. As we strive to provide a minimum semblance
16
of security, the files installed by the package are owned by root:wheel.
17
This is different than upstream which expects all of the files to be
18
owned by the user and for you to execute the elasticsearch-plugin script
19
as said user.
20
21
You will encounter permissions errors with configuration files and
22
directories created by plugins which you will have to manually correct.
23
This is the price we have to pay to protect ourselves in the face of
24
a poorly designed security model.
25
26
e.g., after installing X-Pack you will have to correct:
27
28
%%ETCDIR%%/elasticsearch.keystore file to be owned by elasticsearch:elasticsearch
29
%%ETCDIR%%/x-pack directory/files to be owned by elasticsearch:elasticsearch
30
31
!!! PLUGINS NOTICE !!!
32
EOM
33
}
34
]
(-)textproc/elasticsearch7/pkg-descr (+4 lines)
Line 0 Link Here
1
Elasticsearch aims to be a Distributed, RESTful, Search Engine built on top of
2
Apache Lucene.
3
4
WWW: https://www.elastic.co/

Return to bug 237374