You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
147 lines
6.1 KiB
Tcl
147 lines
6.1 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-solr9
|
|
version 9.10.1
|
|
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:solr/solr/${version}/
|
|
|
|
checksums rmd160 4f978a8aed7d5c5d20064780fad3003de321d8a6 \
|
|
sha256 31dd91aeade540f4d7005cc1a1f7cc583ad77a78d800c9065cac06af1b097454 \
|
|
size 388948979
|
|
|
|
conflicts apache-solr8
|
|
|
|
# see https://solr.apache.org/guide/solr/latest/deployment-guide/system-requirements.html
|
|
java.version 11+
|
|
# 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/solr9
|
|
reinplace "s|@solr_path@|${solr_path}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_home@|${solr_home}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_data_home@|${solr_data_home}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_logs_dir@|${solr_logs_dir}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_pid_dir@|${solr_pid_dir}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_port@|${solr_port}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_heap@|${solr_heap}|g" ${destroot}${prefix}/bin/solr9
|
|
# reinplace "s|@solr_java_mem@|${solr_java_mem}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_log_prestart_rotation@|${solr_log_prestart_rotation}|g" ${destroot}${prefix}/bin/solr9
|
|
reinplace "s|@solr_ulimit_checks@|${solr_ulimit_checks}|g" ${destroot}${prefix}/bin/solr9
|
|
# 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 solr9 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: solr9 must start in the foreground so that launchd keeps it running
|
|
startupitem.init "export SOLR_JAVA_HOME=\${SOLR_JAVA_HOME:-\$(/usr/libexec/java_home)}\nexport SOLR_MODULES=\"analysis-extras\""
|
|
startupitem.start "sudo -E -u ${solrUser} -g ${solrGroup} bash -c '${prefix}/bin/solr9 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/solr9 stop -p ${solr_port} 2>/dev/null"
|
|
startupitem.restart "sudo -E -u ${solrUser} -g ${solrGroup} ${prefix}/bin/solr9 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 'solr9 start -help' for help. solr9 sets these environment variables\
|
|
before calling bin/solr. These can be redefined, then calling\
|
|
`sudo -E -u ${solrUser} solr9 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/solr/solr/
|
|
livecheck.regex {(9(\.\d+)+)/}
|