From db8635870c186867ddf5bee1596bc9f937c860cc Mon Sep 17 00:00:00 2001 From: Erle Pereira Date: Thu, 23 Jul 2015 22:44:13 +1000 Subject: [PATCH] Neo4j + OpenJDK: Experimental Build, also switched to smaller base. This container now clocks in under 190MB in total. Removed Oracle Java, using OpenJDK. --- docker_alpine_neo4j/Dockerfile | 35 +++++++++ .../conf/neo4j-server.properties | 75 +++++++++++++++++++ docker_alpine_neo4j/conf/neo4j-wrapper.conf | 26 +++++++ docker_alpine_neo4j/conf/neo4j.conf | 2 + docker_alpine_neo4j/conf/neo4j.properties | 35 +++++++++ docker_alpine_neo4j/etc/init.d/neo4j | 55 ++++++++++++++ 6 files changed, 228 insertions(+) create mode 100644 docker_alpine_neo4j/Dockerfile create mode 100644 docker_alpine_neo4j/conf/neo4j-server.properties create mode 100644 docker_alpine_neo4j/conf/neo4j-wrapper.conf create mode 100644 docker_alpine_neo4j/conf/neo4j.conf create mode 100644 docker_alpine_neo4j/conf/neo4j.properties create mode 100644 docker_alpine_neo4j/etc/init.d/neo4j diff --git a/docker_alpine_neo4j/Dockerfile b/docker_alpine_neo4j/Dockerfile new file mode 100644 index 0000000..875bcae --- /dev/null +++ b/docker_alpine_neo4j/Dockerfile @@ -0,0 +1,35 @@ +FROM alpine +MAINTAINER Erle Pereira + +ENV neohome /usr/local/neo4j-server +ENV neolib /var/lib/neo4j-server + +RUN apk --update add openjdk7-jre-base wget bash + +RUN wget http://neo4j.com/artifact.php?name=neo4j-community-2.2.2-unix.tar.gz -O /tmp/neo4j.tar.gz && \ + adduser -h ${neohome} -S neo4j && \ + addgroup neo4j && \ + cd /tmp && \ + mkdir neo4j && \ + tar -zxf neo4j.tar.gz -C ./ && \ + rm neo4j.tar.gz && \ + mv neo4j-community-2.2.2/* ${neohome} && \ + ln -s ${neohome}/bin/neo4j /usr/local/bin/neo4j && \ + mkdir ${neolib} && \ + chown -R neo4j:neo4j ${neohome} && \ + chown -R neo4j:neo4j ${neolib} + +VOLUME ${neolib} + +ADD etc/init.d/neo4j /etc/init.d/neo4j +ADD conf/neo4j-server.properties ${neohome}/conf/neo4j-server.properties +ADD conf/neo4j.properties ${neohome}/conf/neo4j.properties +ADD conf/neo4j-wrapper.conf ${neohome}/conf/neo4j-wrapper.conf +ADD conf/neo4j.conf /etc/security/limits.d/neo4j.conf + +RUN chmod +x /etc/init.d/neo4j + +USER neo4j + +EXPOSE 7474 +CMD ["neo4j", "console"] diff --git a/docker_alpine_neo4j/conf/neo4j-server.properties b/docker_alpine_neo4j/conf/neo4j-server.properties new file mode 100644 index 0000000..f223327 --- /dev/null +++ b/docker_alpine_neo4j/conf/neo4j-server.properties @@ -0,0 +1,75 @@ +################################################################ +# Neo4j configuration +# +################################################################ + +#*************************************************************** +# Server configuration +#*************************************************************** + +# location of the database directory +org.neo4j.server.database.location=/var/lib/neo4j-server/data/graph.db + +# let the webserver only listen on the specified IP. Default +# is localhost (only accept local connections). Uncomment to allow +# any connection. Please see the security section in the neo4j +# manual before modifying this. +org.neo4j.server.webserver.address=0.0.0.0 + +# +# HTTP Connector +# + +# Turn http-support on/off, mostly if you want your +# server accessible via https only. +org.neo4j.server.webserver.http.enabled=true + +# http port (for all data, administrative, and UI access) +org.neo4j.server.webserver.port=7474 + +# +# HTTPS Connector +# + +# Turn https-support on/off +org.neo4j.server.webserver.https.enabled=true + +# https port (for all data, administrative, and UI access) +org.neo4j.server.webserver.https.port=7473 + +# Certificate location (auto generated if the file does not exist) +org.neo4j.server.webserver.https.cert.location=conf/ssl/snakeoil.cert + +# Private key location (auto generated if the file does not exist) +org.neo4j.server.webserver.https.key.location=conf/ssl/snakeoil.key + +# Internally generated keystore (don't try to put your own +# keystore there, it will get deleted when the server starts) +org.neo4j.server.webserver.https.keystore.location=system/keystore + +#***************************************************************** +# Administration client configuration +#***************************************************************** + +# location of the servers round-robin database directory. possible values: +# - absolute path like /var/rrd +# - path relative to the server working directory like data/rrd +# - commented out, will default to the database data directory. +org.neo4j.server.webadmin.rrdb.location=data/rrd + +# REST endpoint for the data API +# Note the / in the end is mandatory +org.neo4j.server.webadmin.data.uri=/db/data/ + +# REST endpoint of the administration API (used by Webadmin) +org.neo4j.server.webadmin.management.uri=/db/manage/ + +# Low-level graph engine tuning file +org.neo4j.server.db.tuning.properties=/usr/local/neo4j-server/conf/neo4j.properties + + +#Comma separated list of JAXRS packages contains JAXRS Resoruce, one package name for each mountpoint. +#the listed package names will be loaded under the mountpoints specified, uncomment this line +#to mount the org.neo4j.examples.server.unmanaged.HelloWorldResource.java from neo4j-examples +#under /examples/unmanaged, resulting in a final URL of http://localhost:7474/examples/unmanaged/helloworld/{nodeId} +#org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged diff --git a/docker_alpine_neo4j/conf/neo4j-wrapper.conf b/docker_alpine_neo4j/conf/neo4j-wrapper.conf new file mode 100644 index 0000000..5d4b6ae --- /dev/null +++ b/docker_alpine_neo4j/conf/neo4j-wrapper.conf @@ -0,0 +1,26 @@ +#******************************************************************** +# JVM Parameters +#******************************************************************** + +wrapper.java.additional.1=-Dorg.neo4j.server.properties=/usr/local/neo4j-server/conf/neo4j-server.properties +wrapper.java.additional.2=-Djava.util.logging.config.file=/usr/local/neo4j-server/conf/logging.properties + +# Initial Java Heap Size (in MB) +wrapper.java.initmemory=32 + +# Maximum Java Heap Size (in MB) +wrapper.java.maxmemory=512 + +#******************************************************************** +# Wrapper settings +#******************************************************************** +# Override default pidfile and lockfile +wrapper.pidfile=/var/run/neo4j-server.pid +wrapper.lockfile=/var/run/neo4j-server.lock + +# Name of the service +wrapper.name=neo4j + +# User account to be used for linux installs. Will default to current +# user if not set. +wrapper.user=neo4j diff --git a/docker_alpine_neo4j/conf/neo4j.conf b/docker_alpine_neo4j/conf/neo4j.conf new file mode 100644 index 0000000..0c68906 --- /dev/null +++ b/docker_alpine_neo4j/conf/neo4j.conf @@ -0,0 +1,2 @@ +neo4j - nofile 48000 +neo4j - memlock unlimited diff --git a/docker_alpine_neo4j/conf/neo4j.properties b/docker_alpine_neo4j/conf/neo4j.properties new file mode 100644 index 0000000..2ec1f39 --- /dev/null +++ b/docker_alpine_neo4j/conf/neo4j.properties @@ -0,0 +1,35 @@ +# Default values for the low-level graph engine +#neostore.nodestore.db.mapped_memory=25M +#neostore.relationshipstore.db.mapped_memory=50M +#neostore.propertystore.db.mapped_memory=90M +#neostore.propertystore.db.strings.mapped_memory=130M +#neostore.propertystore.db.arrays.mapped_memory=130M + +# Enable this to be able to upgrade a store from 1.4 -> 1.5 or 1.4 -> 1.6 +#allow_store_upgrade=true + +# Enable this to specify a parser other than the default one. 1.5, 1.6, 1.7 are available +#cypher_parser_version=1.6 + +# Keep logical logs, helps debugging but uses more disk space, enabled for +# legacy reasons To limit space needed to store historical logs use values such +# as: "7 days" or "100M size" instead of "true" +keep_logical_logs=true + +# Autoindexing + +# Enable auto-indexing for nodes, default is false +node_auto_indexing=true + +# The node property keys to be auto-indexed, if enabled +#node_keys_indexable= + +# Enable auto-indexing for relationships, default is false +#relationship_auto_indexing=true + +# The relationship property keys to be auto-indexed, if enabled +#relationship_keys_indexable=name,age + +# Remote Shell port +remote_shell_port=1337 + diff --git a/docker_alpine_neo4j/etc/init.d/neo4j b/docker_alpine_neo4j/etc/init.d/neo4j new file mode 100644 index 0000000..034094d --- /dev/null +++ b/docker_alpine_neo4j/etc/init.d/neo4j @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# +# neo4j +# +# chkconfig: - 58 48 +# description: neo4j +# processname: neo4j + +# Source networking configuration +if [ -f /etc/sysconfig/network ]; then source /etc/sysconfig/network; fi + +# Exit if networking is not up +[ "$NETWORKING" = "no" ] && exit + +start() { + # neo4j wrapper is smart enough to change user and do similar things. + /usr/local/bin/neo4j start + return $? +} + +stop() { + /usr/local/bin/neo4j stop + return $? +} + +restart() { + stop + start +} + +status() { + /usr/local/bin/neo4j status + return $? +} + + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + status) + status $2 + ;; + *) + echo $"Usage: $0 {start|stop|restart|status [-v]|}" + exit 1 +esac + +exit $?