Merge pull request #19601 from Hinidu/fix/neo4j-update-3
neo4j: 2.1.3 -> 3.0.6
This commit is contained in:
commit
4bb91b315d
2 changed files with 55 additions and 62 deletions
|
@ -5,34 +5,34 @@ with lib;
|
|||
let
|
||||
cfg = config.services.neo4j;
|
||||
|
||||
serverConfig = pkgs.writeText "neo4j-server.properties" ''
|
||||
org.neo4j.server.database.location=${cfg.dataDir}/data/graph.db
|
||||
org.neo4j.server.webserver.address=${cfg.listenAddress}
|
||||
org.neo4j.server.webserver.port=${toString cfg.port}
|
||||
${optionalString cfg.enableHttps ''
|
||||
org.neo4j.server.webserver.https.enabled=true
|
||||
org.neo4j.server.webserver.https.port=${toString cfg.httpsPort}
|
||||
org.neo4j.server.webserver.https.cert.location=${cfg.cert}
|
||||
org.neo4j.server.webserver.https.key.location=${cfg.key}
|
||||
org.neo4j.server.webserver.https.keystore.location=${cfg.dataDir}/data/keystore
|
||||
serverConfig = pkgs.writeText "neo4j.conf" ''
|
||||
dbms.directories.data=${cfg.dataDir}/data
|
||||
dbms.directories.certificates=${cfg.certDir}
|
||||
dbms.directories.logs=${cfg.dataDir}/logs
|
||||
dbms.directories.plugins=${cfg.dataDir}/plugins
|
||||
dbms.connector.http.type=HTTP
|
||||
dbms.connector.http.enabled=true
|
||||
dbms.connector.http.address=${cfg.listenAddress}:${toString cfg.port}
|
||||
${optionalString cfg.enableBolt ''
|
||||
dbms.connector.bolt.type=BOLT
|
||||
dbms.connector.bolt.enabled=true
|
||||
dbms.connector.bolt.tls_level=OPTIONAL
|
||||
dbms.connector.bolt.address=${cfg.listenAddress}:${toString cfg.boltPort}
|
||||
''}
|
||||
org.neo4j.server.webadmin.rrdb.location=${cfg.dataDir}/data/rrd
|
||||
org.neo4j.server.webadmin.data.uri=/db/data/
|
||||
org.neo4j.server.webadmin.management.uri=/db/manage/
|
||||
org.neo4j.server.db.tuning.properties=${cfg.package}/share/neo4j/conf/neo4j.properties
|
||||
org.neo4j.server.manage.console_engines=shell
|
||||
${optionalString cfg.enableHttps ''
|
||||
dbms.connector.https.type=HTTP
|
||||
dbms.connector.https.enabled=true
|
||||
dbms.connector.https.encryption=TLS
|
||||
dbms.connector.https.address=${cfg.listenAddress}:${toString cfg.httpsPort}
|
||||
''}
|
||||
dbms.shell.enabled=true
|
||||
${cfg.extraServerConfig}
|
||||
'';
|
||||
|
||||
loggingConfig = pkgs.writeText "logging.properties" cfg.loggingConfig;
|
||||
|
||||
wrapperConfig = pkgs.writeText "neo4j-wrapper.conf" ''
|
||||
wrapper.java.additional=-Dorg.neo4j.server.properties=${serverConfig}
|
||||
wrapper.java.additional=-Djava.util.logging.config.file=${loggingConfig}
|
||||
wrapper.java.additional=-XX:+UseConcMarkSweepGC
|
||||
wrapper.java.additional=-XX:+CMSClassUnloadingEnabled
|
||||
wrapper.pidfile=${cfg.dataDir}/neo4j-server.pid
|
||||
wrapper.name=neo4j
|
||||
dbms.jvm.additional=-Dunsupported.dbms.udc.source=tarball
|
||||
dbms.jvm.additional=-XX:+UseConcMarkSweepGC
|
||||
dbms.jvm.additional=-XX:+CMSClassUnloadingEnabled
|
||||
'';
|
||||
|
||||
in {
|
||||
|
@ -65,6 +65,18 @@ in {
|
|||
type = types.int;
|
||||
};
|
||||
|
||||
enableBolt = mkOption {
|
||||
description = "Enable bolt for Neo4j.";
|
||||
default = true;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
boltPort = mkOption {
|
||||
description = "Neo4j port to listen for BOLT traffic.";
|
||||
default = 7687;
|
||||
type = types.int;
|
||||
};
|
||||
|
||||
enableHttps = mkOption {
|
||||
description = "Enable https for Neo4j.";
|
||||
default = false;
|
||||
|
@ -77,15 +89,9 @@ in {
|
|||
type = types.int;
|
||||
};
|
||||
|
||||
cert = mkOption {
|
||||
description = "Neo4j https certificate.";
|
||||
default = "${cfg.dataDir}/conf/ssl/neo4j.cert";
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
key = mkOption {
|
||||
description = "Neo4j https certificate key.";
|
||||
default = "${cfg.dataDir}/conf/ssl/neo4j.key";
|
||||
certDir = mkOption {
|
||||
description = "Neo4j TLS certificates directory.";
|
||||
default = "${cfg.dataDir}/certificates";
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
|
@ -95,26 +101,11 @@ in {
|
|||
type = types.path;
|
||||
};
|
||||
|
||||
loggingConfig = mkOption {
|
||||
description = "Neo4j logging configuration.";
|
||||
default = ''
|
||||
handlers=java.util.logging.ConsoleHandler
|
||||
.level=INFO
|
||||
org.neo4j.server.level=INFO
|
||||
|
||||
java.util.logging.ConsoleHandler.level=INFO
|
||||
java.util.logging.ConsoleHandler.formatter=org.neo4j.server.logging.SimpleConsoleFormatter
|
||||
java.util.logging.ConsoleHandler.filter=org.neo4j.server.logging.NeoLogFilter
|
||||
'';
|
||||
type = types.lines;
|
||||
};
|
||||
|
||||
extraServerConfig = mkOption {
|
||||
description = "Extra configuration for neo4j server.";
|
||||
default = "";
|
||||
type = types.lines;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
@ -124,14 +115,18 @@ in {
|
|||
description = "Neo4j Daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
environment = { NEO4J_INSTANCE = cfg.dataDir; };
|
||||
environment = {
|
||||
NEO4J_HOME = "${cfg.package}/share/neo4j";
|
||||
NEO4J_CONF = "${cfg.dataDir}/conf";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/neo4j console";
|
||||
User = "neo4j";
|
||||
PermissionsStartOnly = true;
|
||||
};
|
||||
preStart = ''
|
||||
mkdir -m 0700 -p ${cfg.dataDir}/{data/graph.db,conf}
|
||||
mkdir -m 0700 -p ${cfg.dataDir}/{data/graph.db,conf,logs}
|
||||
ln -fs ${serverConfig} ${cfg.dataDir}/conf/neo4j.conf
|
||||
ln -fs ${wrapperConfig} ${cfg.dataDir}/conf/neo4j-wrapper.conf
|
||||
if [ "$(id -u)" = 0 ]; then chown -R neo4j ${cfg.dataDir}; fi
|
||||
'';
|
||||
|
@ -146,5 +141,4 @@ in {
|
|||
home = cfg.dataDir;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
{ stdenv, fetchurl, makeWrapper, jre, which, gnused }:
|
||||
{ stdenv, fetchurl, makeWrapper, jre8, which, gawk }:
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "neo4j-${version}";
|
||||
version = "2.1.3";
|
||||
version = "3.0.6";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://dist.neo4j.org/neo4j-community-${version}-unix.tar.gz";
|
||||
sha256 = "0gcyy6ayn8qvxj6za5463lgy320mn4rq7q5qysc26fxjd73drrrk";
|
||||
sha256 = "efeab41183e9e5fa94a2d396c65ea93a24e9f105cb3b5f0d0a8e42fb709f4660";
|
||||
};
|
||||
|
||||
buildInputs = [ makeWrapper jre which gnused ];
|
||||
|
||||
patchPhase = ''
|
||||
substituteInPlace "bin/neo4j" --replace "NEO4J_INSTANCE=\$NEO4J_HOME" ""
|
||||
'';
|
||||
buildInputs = [ makeWrapper jre8 which gawk ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/share/neo4j"
|
||||
cp -R * "$out/share/neo4j"
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
makeWrapper "$out/share/neo4j/bin/neo4j" "$out/bin/neo4j" \
|
||||
--prefix PATH : "${stdenv.lib.makeBinPath [ jre which gnused ]}"
|
||||
makeWrapper "$out/share/neo4j/bin/neo4j-shell" "$out/bin/neo4j-shell" \
|
||||
--prefix PATH : "${stdenv.lib.makeBinPath [ jre which gnused ]}"
|
||||
for NEO4J_SCRIPT in neo4j neo4j-admin neo4j-import neo4j-shell
|
||||
do
|
||||
makeWrapper "$out/share/neo4j/bin/$NEO4J_SCRIPT" \
|
||||
"$out/bin/$NEO4J_SCRIPT" \
|
||||
--prefix PATH : "${stdenv.lib.makeBinPath [ jre8 which gawk ]}" \
|
||||
--set JAVA_HOME "$jre8"
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
|
Loading…
Reference in a new issue