You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
160 lines
6.6 KiB
Tcl
160 lines
6.6 KiB
Tcl
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
|
|
|
|
PortSystem 1.0
|
|
PortGroup java 1.0
|
|
|
|
name apache-solr8
|
|
version 8.11.4
|
|
revision 0
|
|
categories java textproc
|
|
supported_archs noarch
|
|
platforms {darwin any}
|
|
license Apache-2
|
|
maintainers {ieee.org:s.t.smith @essandess} openmaintainer
|
|
|
|
description An open source enterprise search platform.
|
|
|
|
long_description Solr is the popular, blazing fast open source \
|
|
enterprise search platform from the Apache \
|
|
Lucene project.
|
|
|
|
homepage https://solr.apache.org/
|
|
|
|
dist_subdir apache-solr
|
|
distname solr-${version}
|
|
extract.suffix .tgz
|
|
|
|
master_sites apache:lucene/solr/${version}/
|
|
|
|
checksums rmd160 740266658348ec123883c533958383a62bcfdc8c \
|
|
sha256 163fbdf246bbd78910bc36c3257ad50cdf31ccc3329a5ef885c23c9ef69e0ebe \
|
|
size 225264820
|
|
|
|
conflicts apache-solr9
|
|
|
|
# log4j vulnerability CVE-2021-44228
|
|
# diff -NaurdwB -I '^ *#' ./solr-orig/bin/solr.in.sh ./solr-new/bin/solr.in.sh | sed -E -e 's/\.\/solr-(orig|new)\//\.\//' > patch-solr-in-sh.diff
|
|
patchfiles-append patch-solr-in-sh.diff
|
|
|
|
# log4j vulnerability CVE-2021-45046
|
|
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45046
|
|
depends_build-append \
|
|
port:zip
|
|
post-patch {
|
|
system -W ${worksrcpath}/server/lib/ext \
|
|
"zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class"
|
|
}
|
|
|
|
# see https://lucene.apache.org/solr/guide/8_1/solr-system-requirements.html
|
|
java.version 9+
|
|
# LTS JDK port to install if required java not found
|
|
java.fallback openjdk11
|
|
|
|
set solrGroup solr
|
|
set solrUser solr
|
|
add_users ${solrUser} group=${solrGroup} home=${prefix}/var/solr
|
|
|
|
# set the destination paths.
|
|
set java_basepath ${prefix}/share/java
|
|
set solr_destpath ${java_basepath}/${distname}
|
|
set solr_path ${solr_destpath}
|
|
# Used to define environment variables for bin/solr
|
|
set solr_home ${prefix}/var/solr
|
|
set solr_data_home ${prefix}/var/db/solr
|
|
set solr_logs_dir ${solr_home}/logs
|
|
set solr_pid_dir ${prefix}/var/run/solr
|
|
set solr_port 8983
|
|
set solr_heap 1g
|
|
# This is what to set for fine-tuned Java memory control; see bin/solr
|
|
# set solr_java_mem ""
|
|
set solr_log_prestart_rotation true
|
|
set solr_ulimit_checks false
|
|
|
|
use_configure no
|
|
|
|
build {}
|
|
|
|
destroot {
|
|
# copy the distribution
|
|
xinstall -d ${destroot}${java_basepath}
|
|
copy ${worksrcpath} ${destroot}${java_basepath}
|
|
# create default directories
|
|
xinstall -o ${solrUser} -g ${solrGroup} -m 755 -d ${destroot}${solr_home}
|
|
xinstall -o ${solrUser} -g ${solrGroup} -m 755 -d ${destroot}${solr_logs_dir}
|
|
xinstall -o ${solrUser} -g ${solrGroup} -m 755 -d ${destroot}${prefix}/var/db/solr
|
|
xinstall -o ${solrUser} -g ${solrGroup} -m 775 -d ${destroot}${solr_pid_dir}
|
|
# install the solr script
|
|
xinstall -m 755 ${filespath}/solr.in ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_path@|${solr_path}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_home@|${solr_home}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_data_home@|${solr_data_home}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_logs_dir@|${solr_logs_dir}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_pid_dir@|${solr_pid_dir}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_port@|${solr_port}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_heap@|${solr_heap}|g" ${destroot}${prefix}/bin/solr8
|
|
# reinplace "s|@solr_java_mem@|${solr_java_mem}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_log_prestart_rotation@|${solr_log_prestart_rotation}|g" ${destroot}${prefix}/bin/solr8
|
|
reinplace "s|@solr_ulimit_checks@|${solr_ulimit_checks}|g" ${destroot}${prefix}/bin/solr8
|
|
# copy the solr home files
|
|
xinstall -o ${solrUser} -g ${solrGroup} -m 644 ${filespath}/solr.xml ${destroot}${solr_home}/solr.xml
|
|
xinstall -o ${solrUser} -g ${solrGroup} -m 644 ${filespath}/solr.xml ${destroot}${solr_home}/solr.xml.default
|
|
# remove `nohup` from `bin/solr`, which causes this error on macOS:
|
|
# sudo -u solr solr8 start # hangs with this error
|
|
# nohup: can't detach from console: Inappropriate ioctl for device
|
|
reinplace -E {s|^([[:space:]]+)nohup[[:space:]]+|\1|} ${destroot}${solr_destpath}/bin/solr
|
|
}
|
|
|
|
post-activate {
|
|
# Make sure initial conf files are present and setup correctly
|
|
foreach f { solr.xml } {
|
|
if {![file exists ${solr_home}/${f}]} {
|
|
file copy ${solr_home}/${f}.default \
|
|
${solr_home}/${f}
|
|
}
|
|
}
|
|
}
|
|
|
|
startupitem.create yes
|
|
startupitem.name Solr
|
|
# Note: solr8 must start in the foreground so that launchd keeps it running
|
|
startupitem.init "export SOLR_JAVA_HOME=\${SOLR_JAVA_HOME:-\$(/usr/libexec/java_home)}"
|
|
startupitem.start "sudo -E -u ${solrUser} -g ${solrGroup} bash -c '${prefix}/bin/solr8 start -p ${solr_port} -f 1> ${solr_logs_dir}/solr-${solr_port}-console.log 2>&1'"
|
|
startupitem.stop "sudo -E -u ${solrUser} -g ${solrGroup} ${prefix}/bin/solr8 stop -p ${solr_port} 2>/dev/null"
|
|
startupitem.restart "sudo -E -u ${solrUser} -g ${solrGroup} ${prefix}/bin/solr8 restart -p ${solr_port} 2>/dev/null"
|
|
startupitem.pidfile none
|
|
|
|
notes "This port is configured with a launch daemon for solr. See the solr\
|
|
dashboard at http://localhost:${solr_port}.
|
|
|
|
See 'solr8 start -help' for help. solr8 sets these environment variables\
|
|
before calling bin/solr. These can be redefined, then calling\
|
|
`sudo -E -u ${solrUser} solr8 start`.
|
|
|
|
export SOLR_HOME=${solr_home}
|
|
export SOLR_DATA_HOME=${solr_data_home}
|
|
export SOLR_LOGS_DIR=${solr_logs_dir}
|
|
export SOLR_PID_DIR=${solr_pid_dir}
|
|
export SOLR_PORT=${solr_port}
|
|
export SOLR_HEAP=${solr_heap}
|
|
export SOLR_LOG_PRESTART_ROTATION=${solr_log_prestart_rotation}
|
|
export SOLR_ULIMIT_CHECKS=${solr_ulimit_checks}
|
|
|
|
${name} is tested with the JDK provided in port ${java.fallback}. Add these\
|
|
lines to your ~/.profile to set up your java environment and test with\
|
|
'java -version':
|
|
|
|
# Java environment
|
|
if \[ -x /usr/libexec/java_home \]; then
|
|
export JAVA_HOME=\$(/usr/libexec/java_home)
|
|
export KEYTOOL=\"\$JAVA_HOME\"/jre/bin
|
|
fi
|
|
"
|
|
|
|
destroot.keepdirs ${destroot}${solr_pid_dir} \
|
|
${destroot}${solr_home} \
|
|
${destroot}${prefix}/var/db/solr ${destroot}${solr_logs_dir}
|
|
|
|
livecheck.type regex
|
|
livecheck.url https://www.apache.org/dist/lucene/solr/
|
|
livecheck.regex {(8(\.\d+)+)/}
|