neo4j-community: bump to 4.0.0

This commit is contained in:
Yury Martynov 2020-01-31 17:31:03 +03:00
parent 2f1aa3c7d6
commit 162ec2b75c
No known key found for this signature in database
GPG key ID: EBE62DD0CCEAE19E
5 changed files with 209 additions and 4 deletions

View file

@ -1,2 +1,3 @@
DIST neo4j-community-3.5.12-unix.tar.gz 154093256 BLAKE2B 2dcf7baeb977ce21b2637fc92a2dc937b3684d7e1a788ff7a59dd5f56658a8ec8178b9a56e636628f6e512b04966b7c6554ebb63a1d77bb4e08ef1c9fa50243e SHA512 4851098f6e3f8a4a0946ab3d5dc9ba2387b6d4e1c56e064474856c8e60a4ce22c9fb5fa78016057ebd5862eb67e4eea86a863495a359e70f2490f03122d26251
DIST neo4j-community-3.5.3-unix.tar.gz 101923016 BLAKE2B 6f2084834c4c2c596c448eccace2d187a3deacb287b88f619e860618ead5b34ce6756d1af60a4e82a686d0b7604f3ee17856610341789ce3e2d800b1aff3f0a4 SHA512 29f58d41d2733bd34077dd26d3be9211b508a07278ed2f14dbb2c1880b2fc12c36fb901ab3b3b52d358d3ddf94ac1da6129207c9b293dbc130c52325e5ab47ee
DIST neo4j-community-4.0.0-unix.tar.gz 129042779 BLAKE2B 2011f086ffadbe00e6169aab68dacb7588a32068903daf556937438987db70dc786e2cc04d298351941ac21f011447a2fcc050599da54af642758723a11c303e SHA512 3ea64f05207a611a11593de5dc974500afcc4d78e1924e9e156d6b96e90061e9af277bc3f4364ea47f51e5c981c7c6813087980f7c31c5db8de84935a1aebbda

View file

@ -0,0 +1,22 @@
# /etc/conf.d/neo4j-daemon: config file for /etc/init.d/neo4j-daemon
########################################################################################
# WARNING! It requires OpenJDK(TM) 11
# Unfortunately, virtual/jdk:11 (jre) is not completely working with Gentoo (masked at: 2020.01.31)
# but you can manualy install 'dev-java/oracle-jdk-bin' package and use JAVA_CMD variable
#
# Please uncomment and enter the path to the 'java' command after installing OpenJDK
# (needs to be absolute path)
#JAVA_CMD="/opt/openjdk-bin-<openjdk_version>/bin/java"
########################################################################################
# Configurations (needs to be absolute path)
#NEO4J_CONF="/etc/neo4j-community"
# Data files (needs to be absolute path)
#NEO4J_DATA="/var/lib/neo4j-community/data"
# Path to log dir (needs to be absolute path)
#NEO4J_LOGS="/var/log/neo4j-community"

View file

@ -14,10 +14,6 @@ GROUP="nobody"
export NEO4J_CONF NEO4J_DATA NEO4J_LOGS NEO4J_PLUGINS NEO4J_PIDFILE
depend() {
need net
}
checkconfig() {
if [ ! -d ${NEO4J_PIDDIR} ]; then
checkpath -q -d -o ${USER}:${GROUP} -m 0755 ${NEO4J_PIDDIR} || return 1

View file

@ -0,0 +1,46 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
NEO4J_EXEC="/opt/bin/neo4j"
NEO4J_CONF="${NEO4J_CONF:-/etc/neo4j-community}"
NEO4J_DATA="${NEO4J_DATA:-"/var/lib/neo4j-community/data"}"
NEO4J_LOGS="${NEO4J_LOGS:-"/var/log/neo4j-community"}"
NEO4J_PIDDIR="/run/${RC_SVCNAME}"
NEO4J_PIDFILE="${NEO4J_PIDDIR}/neo4j.pid"
USER="nobody"
GROUP="neo4j"
export JAVA_CMD NEO4J_CONF NEO4J_DATA NEO4J_LOGS NEO4J_PLUGINS NEO4J_PIDFILE
checkconfig() {
if [ -z ${JAVA_CMD} ]; then
eerror "Please use Oracle(R) Java(TM) 11, OpenJDK(TM) 11 to run Neo4j"
eerror "and modify your /etc/conf.d/neo4j-daemon:"
eerror " JAVA_CMD=\"/opt/openjdk-bin-<openjdk_version>/bin/java\""
return 1
fi
if [ ! -d ${NEO4J_PIDDIR} ]; then
checkpath -q -d -o ${USER}:${GROUP} -m 0755 ${NEO4J_PIDDIR} || return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting ${RC_SVCNAME}"
start-stop-daemon --start --pidfile "${NEO4J_PIDFILE}" --user "${USER}" \
--quiet --exec "${NEO4J_EXEC}" -- start
eend ${?}
}
stop() {
ebegin "Stopping ${RC_SVCNAME}"
mark_service_stopping
${NEO4J_EXEC} stop
eend ${?} && mark_service_stopped
}
# vim: set ft=gentoo-init-d ts=4 :

View file

@ -0,0 +1,140 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit eutils user
DESCRIPTION="Neo4j is a high-performance, NOSQL graph database with all the features of a mature and robust database"
HOMEPAGE="https://neo4j.com/"
SRC_URI="https://dist.neo4j.org/${P}-unix.tar.gz"
KEYWORDS="~amd64 ~x86"
LICENSE="GPL-3"
SLOT=0
# TODO: add support virtual/jre:11 (masked)
RDEPEND="
!dev-db/neo4j-advanced
!dev-db/neo4j-enterprise
virtual/jre"
pkg_setup() {
enewgroup ${PN%-community}
}
src_prepare() {
mv conf/neo4j.conf "${T}" || die
# set absolute path
sed -e "s:dbms.directories.import=import:dbms.directories.import=/var/lib/${PN}/import:" \
-e "s:#dbms.directories.data=data:dbms.directories.data=/var/lib/${PN}/data:" \
-e "s:#dbms.directories.plugins=plugins:#dbms.directories.plugins=/opt/${P}/plugins:" \
-e "s:#dbms.directories.lib=lib:#dbms.directories.lib=/opt/${P}/lib:" \
-e "s:#dbms.directories.certificates=certificates:dbms.directories.certificates=/var/lib/${PN}/certificates:" \
-e "s:#dbms.directories.logs=logs:dbms.directories.logs=/var/log/${PN}:" \
-e "s:#dbms.directories.run=run:dbms.directories.run=/run/neo4j-daemon:" \
-i "${T}"/neo4j.conf || die "sed failed!"
# cleanup
rm -fr logs conf run data import LICENSE{,S}.txt || die
default
}
src_install() {
local dest_dir="/opt/${P}"
local limitsdfile="50-${PN}.conf"
dodir "${dest_dir}"
cp -Rp . "${D}${dest_dir}" || die "failed to install!"
insinto "/etc/${PN}"
doins "${T}"/neo4j.conf
keepdir "/var/log/${PN}" "/var/lib/${PN}"
fowners -R nobody:neo4j "/var/log/${PN}" "/var/lib/${PN}"
fperms -R 750 "/var/lib/${PN}" "/var/log/${PN}"
dodir "/opt/bin"
for x in $(find bin -type f -executable -printf "%f\n"); do
cat > "${D}/opt/bin"/${x} <<-_EOF_ || die "cat EOF failed"
#!/bin/sh
JAVA_CMD="\${JAVA_CMD:-"/usr/bin/java"}"
NEO4J_HOME="\${NEO4J_HOME:-"${dest_dir}"}"
NEO4J_CONF="\${NEO4J_CONF:-"/etc/${PN}"}"
NEO4J_DATA="\${NEO4J_DATA:-"/var/lib/${PN}/data"}"
NEO4J_LIB="\${NEO4J_LIB:-"${dest_dir}/lib"}"
NEO4J_LOGS="\${NEO4J_LOGS:-"/var/log/${PN}"}"
NEO4J_PIDFILE="\${NEO4J_PIDFILE:-"/var/lib/${PN}/${PN%-community}.pid"}" # run it as user
NEO4J_PLUGINS="\${NEO4J_PLUGINS:-"${dest_dir}/plugins"}"
export JAVA_CMD NEO4J_HOME NEO4J_CONF NEO4J_DATA NEO4J_LIB NEO4J_LOGS NEO4J_PIDFILE NEO4J_PLUGINS
cd "${dest_dir}/bin" &&
exec "${dest_dir}/bin/${x}" "\$@"
_EOF_
fperms 0755 "/opt/bin/${x}"
done
dodir "/etc/security/limits.d"
cat > "${D}/etc/security/limits.d"/${limitsdfile} <<-_EOF_ || die "cat EOF failed"
# Start of ${limitsdfile} from ${P}
# This is needed because neo4j can open a high number of file
# descriptors
@${PN%-community} soft nofile 40000
@${PN%-community} hard nofile 40000
# End of ${limitsdfile} from ${P}
_EOF_
newinitd "${FILESDIR}"/neo4j-daemon.initd-r1 neo4j-daemon
newconfd "${FILESDIR}"/neo4j-daemon.confd neo4j-daemon
dodoc *.txt
}
pkg_config() {
local _yesno_ask
ewarn "*** Please create a backup!!! ***"
ewarn "Reset databases and log files for new configuring ..."
read -r -p " [>] Are you sure? [y/N] " _yesno_ask
if [[ ${_yesno_ask,,} =~ ^(yes|y)$ ]]; then
ewarn "Remove: \"${EROOT}/var/lib/${PN}\" and \"${EROOT}/var/lib/${PN}\" ..."
read -r -p " [>] Continue? [y/N] " _yesno_ask
if [[ ${_yesno_ask,,} =~ ^(yes|y)$ ]]; then
rm -rf -- "${EROOT}/var/lib/${PN}" "${EROOT}/var/lib/${PN}" || die
fi
ebegin "Preparing a new configuration for ${PF}"
mkdir -p "${EROOT}/var/lib/${PN}" "${EROOT}/var/lib/${PN}"
chown nobody:neo4j "${EROOT}/var/lib/${PN}" "${EROOT}/var/lib/${PN}"
chmod 750 "${EROOT}/var/lib/${PN}" "${EROOT}/var/lib/${PN}"
touch \
"${EROOT}/var/lib/${PN}/.keep_dev-db_neo4j-community-${SLOT}" \
"${EROOT}/var/lib/${PN}/.keep_dev-db_neo4j-community-${SLOT}"
eend ${?} || die
fi
}
pkg_postinst() {
ewarn "\nFor upgrade instructions ('3.5.any' to '4.0.0'), please see:"
ewarn " https://neo4j.com/docs/operations-manual/current/upgrade/"
ewarn " https://neo4j.com/docs/migration-guide/4.0/"
ewarn "\nAlso create a backup from \"/var/lib/${PN}\" and run:"
ewarn " ~# emerge --config \"=${CATEGORY}/${PF}\""
ewarn "for new configuring"
ewarn "\nWARNING: Use Oracle(R) Java(TM) 11, OpenJDK(TM) 11 to run ${PF} !!!"
ewarn " ~# emerge -avw dev-java/oracle-jdk-bin:11"
ewarn " ~# JAVA_CMD=\"/opt/openjdk-bin-<openjdk_version>/bin/java\" neo4j start"
ewarn "or:"
ewarn " ~# echo JAVA_CMD=\"/opt/openjdk-bin-<openjdk_version>/bin/java\" >> /etc/conf.d/neo4j-daemon"
ewarn " ~# rc-service neo4j-daemon start\n"
ewarn "Wait for few seconds and open in browser http://localhost:7474/\n"
}