├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── .gitignore ├── COPYRIGHT ├── DEVELOPMENT.md ├── LICENSE ├── Makefile ├── README.md ├── build-docker-image.sh ├── build-utils-common-functions.sh ├── devenv ├── devenv.local.template ├── docker-image-src ├── 5 │ ├── coredb │ │ ├── Dockerfile-debian │ │ ├── Dockerfile-ubi8 │ │ ├── Dockerfile-ubi9 │ │ ├── docker-entrypoint.sh │ │ ├── neo4j-admin-report.sh │ │ └── neo4j-plugins.json │ └── neo4j-admin │ │ ├── Dockerfile-debian │ │ ├── Dockerfile-ubi8 │ │ ├── Dockerfile-ubi9 │ │ └── docker-entrypoint.sh ├── 2.3 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 3.0 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 3.1 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 3.2 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 3.3 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 3.4 │ ├── Dockerfile │ └── docker-entrypoint.sh ├── 3.5 │ ├── coredb │ │ ├── Dockerfile │ │ ├── docker-entrypoint.sh │ │ └── neo4j-plugins.json │ └── neo4j-admin │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh ├── 4.0 │ ├── coredb │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh │ └── neo4j-admin │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh ├── 4.1 │ ├── coredb │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh │ └── neo4j-admin │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh ├── 4.2 │ ├── coredb │ │ ├── Dockerfile │ │ ├── docker-entrypoint.sh │ │ └── neo4j-plugins.json │ └── neo4j-admin │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh ├── 4.3 │ ├── coredb │ │ ├── Dockerfile │ │ ├── docker-entrypoint.sh │ │ └── neo4j-plugins.json │ └── neo4j-admin │ │ ├── Dockerfile │ │ └── docker-entrypoint.sh ├── 4.4 │ ├── coredb │ │ ├── Dockerfile-debian │ │ ├── Dockerfile-ubi9 │ │ ├── docker-entrypoint.sh │ │ ├── neo4j-admin-report.sh │ │ └── neo4j-plugins.json │ └── neo4j-admin │ │ ├── Dockerfile-debian │ │ ├── Dockerfile-ubi9 │ │ └── docker-entrypoint.sh ├── calver │ ├── coredb │ │ ├── Dockerfile-debian │ │ ├── Dockerfile-ubi9 │ │ ├── docker-entrypoint.sh │ │ ├── neo4j-admin-report.sh │ │ └── neo4j-plugins.json │ └── neo4j-admin │ │ ├── Dockerfile-debian │ │ ├── Dockerfile-ubi9 │ │ └── docker-entrypoint.sh └── common │ ├── semver.jq │ └── utilities.sh ├── generate-stub-plugin ├── Dockerfile ├── ExampleNeo4jPlugin.java ├── Makefile ├── README.md ├── build.gradle.kts └── settings.gradle.kts ├── pom.xml ├── publish-neo4j-admin-image.sh ├── publish-neo4j-admin-images.sh └── src ├── main └── resources │ └── log4j.properties └── test ├── java └── com │ └── neo4j │ └── docker │ ├── TestDeprecationWarning.java │ ├── TestDockerComposeSecrets.java │ ├── coredb │ ├── TestAdminReport.java │ ├── TestAuthentication.java │ ├── TestBasic.java │ ├── TestCausalCluster.java │ ├── TestMounting.java │ ├── TestUpgrade.java │ ├── configurations │ │ ├── Configuration.java │ │ ├── Setting.java │ │ ├── TestConfSettings.java │ │ ├── TestExtendedConf.java │ │ └── TestJVMAdditionalConfig.java │ └── plugins │ │ ├── Neo4jPluginEnv.java │ │ ├── StubPluginHelper.java │ │ ├── TestBundledPluginInstallation.java │ │ ├── TestPluginInstallation.java │ │ └── TestSemVerPluginMatching.java │ ├── neo4jadmin │ ├── TestAdminBasic.java │ ├── TestBackupRestore.java │ ├── TestBackupRestore44.java │ ├── TestDumpLoad.java │ ├── TestDumpLoad44.java │ └── TestReport.java │ └── utils │ ├── DatabaseIO.java │ ├── HostFileHttpHandler.java │ ├── HttpServerTestExtension.java │ ├── Neo4jVersion.java │ ├── Neo4jVersionTest.java │ ├── Network.java │ ├── SetContainerUser.java │ ├── TemporaryFolderManager.java │ ├── TemporaryFolderManagerTest.java │ ├── TestSettings.java │ └── WaitStrategies.java └── resources ├── causal-cluster-compose.yml ├── confs ├── ConfsNotOverridden.conf ├── ConfsReplaced.conf ├── EnterpriseOnlyNotOverwritten.conf ├── EnvVarsOverride.conf ├── ExtendedConf.conf ├── InvalidExtendedConf.conf ├── JvmAdditionalNotOverridden.conf ├── NoNewline.conf ├── ReadConf.conf └── before50 │ ├── ConfsNotOverridden.conf │ ├── ConfsReplaced.conf │ ├── EnterpriseOnlyNotOverwritten.conf │ ├── EnvVarsOverride.conf │ ├── ExtendedConf.conf │ ├── InvalidExtendedConf.conf │ ├── JvmAdditionalNotOverridden.conf │ ├── NoNewline.conf │ └── ReadConf.conf ├── dockersecrets ├── container-compose-with-incorrect-secrets.yml ├── container-compose-with-secrets-override.yml ├── container-compose-with-secrets.yml ├── simple-container-compose-with-external-file-var.yml └── simple-container-compose.yml ├── ha-cluster-compose.yml └── stubplugin └── myPlugin.jar /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: jennyowen 7 | 8 | --- 9 | 10 | ## Guidelines 11 | 12 | Please note that GitHub issues are only meant for bug reports/feature requests. 13 | If you have questions on how to use Neo4j, please ask on [Neo4j Community](https://community.neo4j.com/) or [StackOverflow](http://stackoverflow.com/questions/tagged/neo4j) instead of creating an issue here. 14 | 15 | To help us understand your issue, please specify important details, primarily: 16 | 17 | - **Steps to reproduce**. *Not including reproduction steps will mean your bug will take considerably longer to investigate and fix. Please don't skip this*. 18 | - Expected behaviour 19 | - Actual behaviour 20 | - Neo4j image tag being used, eg `neo4j:latest`, `neo4j:enterprise-3.5` etc 21 | - The output of the `docker version` command 22 | - Operating system: (for example Windows 95/Ubuntu 16.04) 23 | 24 | Additionally, include (as appropriate) error messages, log-files, stacktraces, and other debug output. 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .java-version 3 | *.iml 4 | /tmp/ 5 | /out/ 6 | /in/ 7 | /devenv.local 8 | /local-mounts/ 9 | /target/ 10 | /build/ 11 | .DS_Store 12 | # simlinks to dev scripts in https://github.com/neo-technology/teamcity-witchcraft 13 | download_tool.py 14 | docker_tests_get_installers.py 15 | __pycache__/ 16 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2015 Neo Technology, Inc. 2 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL := bash 2 | .ONESHELL: 3 | .SHELLFLAGS := -eu -o pipefail -c 4 | .DELETE_ON_ERROR: 5 | .SECONDEXPANSION: 6 | .SECONDARY: 7 | 8 | ifeq ($(origin .RECIPEPREFIX), undefined) 9 | $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) 10 | endif 11 | .RECIPEPREFIX = > 12 | 13 | ifndef NEO4JVERSION 14 | $(error NEO4JVERSION is not set) 15 | endif 16 | 17 | # Use make test TESTS='' to run specific tests 18 | # e.g. `make test TESTS='TestCausalCluster'` or `make test TESTS='*Cluster*'` 19 | # the value of variable is passed to the maven test property. For more info see https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html 20 | # by default this is empty which means all tests will be run 21 | TESTS?="" 22 | 23 | clean: 24 | > rm -rf ./build/ 25 | > rm -rf ./out 26 | .PHONY: clean 27 | 28 | test-%-enterprise: build-%-enterprise 29 | > mvn test -Dimage=$$(cat build/${*}/coredb/.image-id-enterprise) -Dadminimage=$$(cat build/${*}/neo4j-admin/.image-id-enterprise) -Dedition=enterprise -Dbaseos=${*} -Dversion=$(NEO4JVERSION) -Dtest=$(TESTS) 30 | .PHONY: test-%-enterprise 31 | 32 | test-%-community: build-%-community 33 | > mvn test -Dimage=$$(cat build/${*}/coredb/.image-id-community) -Dadminimage=$$(cat build/${*}/neo4j-admin/.image-id-community) -Dedition=community -Dbaseos=${*} -Dversion=$(NEO4JVERSION) -Dtest=$(TESTS) 34 | .PHONY: test-%-community 35 | 36 | ## building 37 | 38 | build: build-debian build-ubi9 39 | .PHONY: build 40 | 41 | build-debian: build-debian-community build-debian-enterprise 42 | .PHONY: build-debian 43 | build-debian-community: build/debian/coredb/community/.sentinel 44 | .PHONY: build-debian-community 45 | build-debian-enterprise: build/debian/coredb/enterprise/.sentinel 46 | .PHONY: build-debian-enterprise 47 | 48 | build/debian/coredb/%/.sentinel:: 49 | > ./build-docker-image.sh $(NEO4JVERSION) "${*}" "debian" 50 | > touch $@ 51 | 52 | build-ubi9: build-ubi9-community build-ubi9-enterprise 53 | .PHONY: build-ubi9 54 | build-ubi9-community: build/ubi9/coredb/community/.sentinel 55 | .PHONY: build-ubi9-community 56 | build-ubi9-enterprise: build/ubi9/coredb/enterprise/.sentinel 57 | .PHONY: build-ubi9-enterprise 58 | 59 | build/ubi9/coredb/%/.sentinel:: 60 | > ./build-docker-image.sh $(NEO4JVERSION) "${*}" "ubi9" 61 | > touch $@ 62 | 63 | build-ubi8: build-ubi8-community build-ubi8-enterprise 64 | .PHONY: build-ubi8 65 | build-ubi8-community: build/ubi8/coredb/community/.sentinel 66 | .PHONY: build-ubi8-community 67 | build-ubi8-enterprise: build/ubi8/coredb/enterprise/.sentinel 68 | .PHONY: build-ubi8-enterprise 69 | 70 | build/ubi8/coredb/%/.sentinel:: 71 | > ./build-docker-image.sh $(NEO4JVERSION) "${*}" "ubi8" 72 | > touch $@ 73 | 74 | ## tagging 75 | 76 | tag: tag-debian tag-ubi9 77 | .PHONY: tag 78 | 79 | tag-debian: tag-debian-community tag-debian-enterprise 80 | .PHONY: tag-debian 81 | tag-ubi9: tag-ubi9-community tag-ubi9-enterprise 82 | .PHONY: tag-ubi9 83 | tag-ubi8: tag-ubi8-community tag-ubi8-enterprise 84 | .PHONY: tag-ubi8 85 | 86 | tag-%-community: build-%-community 87 | > docker tag $$(cat ./build/${*}/coredb/.image-id-community) neo4j:$(NEO4JVERSION)-${*} 88 | > docker tag $$(cat ./build/${*}/neo4j-admin/.image-id-community) neo4j/neo4j-admin:$(NEO4JVERSION)-${*} 89 | .PHONY: tag-%-community 90 | 91 | tag-%-enterprise: build-%-enterprise 92 | > docker tag $$(cat ./build/${*}/coredb/.image-id-enterprise) neo4j:$(NEO4JVERSION)-enterprise-${*} 93 | > docker tag $$(cat ./build/${*}/neo4j-admin/.image-id-enterprise) neo4j/neo4j-admin:$(NEO4JVERSION)-enterprise-${*} 94 | .PHONY: tag-%-enterprise 95 | 96 | ## packaging and release 97 | 98 | # create release images and loadable images 99 | package: package-debian package-ubi9 100 | .PHONY: package 101 | 102 | package-debian: package-debian-community package-debian-enterprise package-debian-release-artifacts 103 | .PHONY: package-debian 104 | 105 | package-ubi9: package-ubi9-community package-ubi9-enterprise package-ubi9-release-artifacts 106 | .PHONY: package-ubi9 107 | 108 | package-ubi8: package-ubi8-community package-ubi8-enterprise package-ubi8-release-artifacts 109 | .PHONY: package-ubi8 110 | 111 | package-%-community: tag-%-community 112 | > mkdir -p out 113 | > docker save neo4j:$(NEO4JVERSION)-${*} > out/neo4j-community-$(NEO4JVERSION)-${*}-docker-loadable.tar 114 | > docker save neo4j/neo4j-admin:$(NEO4JVERSION)-${*} > out/neo4j-admin-community-$(NEO4JVERSION)-${*}-docker-loadable.tar 115 | 116 | package-%-enterprise: tag-%-enterprise 117 | > mkdir -p out 118 | > docker save neo4j:$(NEO4JVERSION)-enterprise-${*} > out/neo4j-enterprise-$(NEO4JVERSION)-${*}-docker-loadable.tar 119 | > docker save neo4j/neo4j-admin:$(NEO4JVERSION)-enterprise-${*} > out/neo4j-admin-enterprise-$(NEO4JVERSION)-${*}-docker-loadable.tar 120 | 121 | package-%-release-artifacts: build-%-community build-%-enterprise 122 | > mkdir -p out 123 | > cp --recursive --force build/${*} out/ 124 | > find out/${*} -name "neo4j-*.tar.gz" -delete 125 | > find out/${*} -name ".image-id-*" -delete 126 | > find out/${*} -name ".sentinel" -delete -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *NOTE:* Supported images are available in the [official image library](https://hub.docker.com/_/neo4j/) on Docker Hub. 2 | Please use those in production. 3 | 4 | # Using the Neo4j Docker Image 5 | 6 | Documentation for the Neo4j image can be found [here](https://neo4j.com/docs/operations-manual/current/deployment/single-instance/docker/). 7 | 8 | You can start a Neo4j container like this: 9 | 10 | ``` 11 | docker run \ 12 | --publish=7474:7474 --publish=7687:7687 \ 13 | --volume=$HOME/neo4j/data:/data \ 14 | --volume=$HOME/neo4j/logs:/logs \ 15 | neo4j:latest 16 | ``` 17 | 18 | To start a Neo4j Enterprise Edition container, you can run: 19 | 20 | ``` 21 | docker run \ 22 | --publish=7474:7474 --publish=7687:7687 \ 23 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes \ 24 | --volume=$HOME/neo4j/data:/data \ 25 | --volume=$HOME/neo4j/logs:/logs \ 26 | neo4j:enterprise 27 | ``` 28 | 29 | Mounting the `/data` and `/logs` folder is optional, 30 | but it means that data can persist between closing and reopening Neo4j containers. 31 | 32 | # Neo4j images for ARM64 33 | 34 | From 4.4.0 and onwards, Neo4j images have been available for ARM64 architectures through [Docker Hub](https://hub.docker.com/_/neo4j/). 35 | 36 | For earlier versions, we provide unsupported and untested builds of ARM64 Neo4j community edition from 4.0.0 to 4.3.23. 37 | These are unsuitable for production use, but may be useful for experimentation or hobbyists. 38 | 39 | They are available on Docker hub at: 40 | 41 | https://hub.docker.com/r/neo4j/neo4j-arm64-experimental 42 | 43 | 44 | The images take the name format `neo4j/neo4j-arm64-experimental:-arm64`. 45 | Example usage: 46 | 47 | ```shell script 48 | docker run \ 49 | --publish=7474:7474 --publish=7687:7687 \ 50 | --volume=$HOME/neo4j/data:/data \ 51 | --volume=$HOME/neo4j/logs:/logs \ 52 | neo4j/neo4j-arm64-experimental:4.1.0-arm64 53 | ``` 54 | 55 | 56 | # Building and Developing the Neo4j Docker Image 57 | 58 | See [DEVELOPMENT.md](DEVELOPMENT.md) 59 | 60 | # Getting support and contributing 61 | 62 | For bug reports and feature requests, please create issues and pull requests against this Github repository. 63 | 64 | If you need guidance with using Neo4j you can ask questions here: https://community.neo4j.com/ 65 | -------------------------------------------------------------------------------- /build-utils-common-functions.sh: -------------------------------------------------------------------------------- 1 | # Common functions used by build-docker-image.sh and publish-neo4j-admin-image.sh 2 | 3 | function contains_element 4 | { 5 | local e match="$1" 6 | shift 7 | for e; do [[ "$e" == "$match" ]] && return 0; done 8 | return 1 9 | } 10 | 11 | function get_branch_from_version 12 | { 13 | local version=$1 14 | local major=$(echo "${version}" | sed -E 's/^([0-9]+)\.([0-9]+)\..*/\1/') 15 | local minor=$(echo "${version}" | sed -E 's/^([0-9]+)\.([0-9]+)\..*/\2/') 16 | case ${major} in 17 | 1|2|3|4) 18 | echo "${major}.${minor}" 19 | return 20 | ;; 21 | 5) 22 | echo "${major}" 23 | return 24 | ;; 25 | *) 26 | echo "calver" 27 | return 28 | esac 29 | } 30 | 31 | function get_major_from_version 32 | { 33 | echo "$1" | sed -E 's/^([0-9]+)\.([0-9]+)\..*/\1/' 34 | } 35 | 36 | function get_compatible_dockerfile_for_os_or_error 37 | { 38 | local branch=${1} 39 | local requested_os=${2} 40 | 41 | case ${branch} in 42 | calver | 5 | 4.4 ) 43 | local SUPPORTED_IMAGE_OS=("debian" "ubi9") 44 | if contains_element "${requested_os}" "${SUPPORTED_IMAGE_OS[@]}"; then 45 | echo "Dockerfile-${requested_os}" 46 | return 0 47 | fi 48 | ;; 49 | *) 50 | local SUPPORTED_IMAGE_OS=("debian") 51 | if contains_element "${requested_os}" "${SUPPORTED_IMAGE_OS[@]}"; then 52 | echo "Dockerfile" 53 | return 0 54 | else 55 | echo >&2 "${requested_os} is not a supported operating system for ${branch}." 56 | return 1 57 | fi 58 | ;; 59 | esac 60 | } 61 | 62 | function tarball_name 63 | { 64 | local version=${1} 65 | local edition=${2} 66 | echo "neo4j-${2}-${1}-unix.tar.gz" 67 | } 68 | 69 | function cached_tarball 70 | { 71 | local version=${1} 72 | local edition=${2} 73 | echo "${TAR_CACHE}/$(tarball_name ${version} ${edition})" 74 | } 75 | 76 | function fetch_tarball 77 | { 78 | local version=${1} 79 | local edition=${2} 80 | local tar_name=$(tarball_name "${version}" "${edition}") 81 | mkdir -p ${TAR_CACHE} 82 | if [[ ! -f $(cached_tarball "${version}" "${edition}") ]]; then 83 | echo "Downloading ${tar_name} from ${DISTRIBUTION_SITE} to $(cached_tarball ${version} ${edition})" 84 | wget ${DISTRIBUTION_SITE}/${tar_name} -O "$(cached_tarball ${version} ${edition})" 85 | fi 86 | } -------------------------------------------------------------------------------- /devenv: -------------------------------------------------------------------------------- 1 | # -*- mode: shell-script -*- 2 | 3 | PATH="./build:${PATH}" 4 | 5 | # MacOS specific checks 6 | if [ "$(uname)" == "Darwin" ] ; then 7 | 8 | # We use temporary directories during testing that need to be 9 | # accessible to the Docker daemon. By default on Macs, $TMPDIR 10 | # (which mktemp responds to) is set to a user-specific location that 11 | # the Docker daemon cannot read from. 12 | # 13 | # In some environments, such as TeamCity, $TMPDIR is intentionally 14 | # pointed elsewhere, so we only want to override the default 15 | # value. (We don't currently run these builds on Macs, but you never 16 | # know.) This default seems to be in /private/var/folders on some 17 | # Macs and /var/folders on others, so we accommodate both. 18 | if [[ "${TMPDIR}" == */var/folders* ]]; then 19 | export TMPDIR=/tmp 20 | fi 21 | 22 | echo "Setting PATH with MacOS specific locations" 23 | export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" 24 | export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" 25 | export PATH="/usr/local/opt/make/libexec/gnubin:$PATH" 26 | 27 | if ! grep --version 2>/dev/null | grep -q "GNU grep" ; then 28 | cat >&2 </dev/null | grep -q "GNU sed" ; then 37 | cat >&2 </dev/null | grep -q "GNU coreutils" ; then 46 | cat >&2 </dev/null 2>/dev/null || cat >&2 </dev/null; then 65 | if which apt-get >/dev/null; then 66 | sudo apt-get install make 67 | else 68 | echo "Please install GNU Make 4.0 or later" 69 | fi 70 | fi 71 | 72 | if [[ -f devenv.local ]]; then 73 | source devenv.local 74 | # to be consistent with the rest of neo4j we should use NEO4JVERSION exclusively but unfortunately both with and without underscore are used in this repo 75 | export NEO4JVERSION 76 | NEO4J_VERSION="${NEO4JVERSION}" 77 | export NEO4J_VERSION 78 | else 79 | echo >&2 "Error: cannot find devenv.local" 80 | fi 81 | -------------------------------------------------------------------------------- /devenv.local.template: -------------------------------------------------------------------------------- 1 | # -*- mode: shell-script -*- 2 | 3 | NEO4JVERSION= -------------------------------------------------------------------------------- /docker-image-src/2.3/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre 2 | 3 | RUN apt-get update --quiet --quiet \ 4 | && apt-get install --quiet --quiet --no-install-recommends lsof \ 5 | && rm -rf /var/lib/apt/lists/* 6 | 7 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 8 | NEO4J_TARBALL=%%NEO4J_TARBALL%% 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | COPY ./local-package/* /tmp/ 12 | 13 | RUN curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 14 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum --check --quiet - \ 15 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 16 | && mv /var/lib/neo4j-* /var/lib/neo4j \ 17 | && rm ${NEO4J_TARBALL} 18 | 19 | ENV PATH /var/lib/neo4j/bin:$PATH 20 | 21 | WORKDIR /var/lib/neo4j 22 | 23 | RUN mv data /data \ 24 | && ln --symbolic /data 25 | 26 | VOLUME /data 27 | 28 | COPY docker-entrypoint.sh /docker-entrypoint.sh 29 | 30 | EXPOSE 7474 7473 31 | 32 | ENTRYPOINT ["/docker-entrypoint.sh"] 33 | CMD ["neo4j"] 34 | -------------------------------------------------------------------------------- /docker-image-src/2.3/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | setting() { 4 | setting="${1}" 5 | value="${2}" 6 | file="${3}" 7 | 8 | if [ -n "${value}" ]; then 9 | if grep --quiet --fixed-strings "${setting}=" "${NEO4J_HOME}/conf/${file}"; then 10 | sed --in-place "s|.*${setting}=.*|${setting}=${value}|" "${NEO4J_HOME}/conf/${file}" 11 | else 12 | echo "${setting}=${value}" >>"${NEO4J_HOME}/conf/${file}" 13 | fi 14 | fi 15 | } 16 | 17 | if [ "$1" == "neo4j" ]; then 18 | setting "keep_logical_logs" "${NEO4J_KEEP_LOGICAL_LOGS:-100M size}" neo4j.properties 19 | setting "dbms.pagecache.memory" "${NEO4J_CACHE_MEMORY:-512M}" neo4j.properties 20 | setting "wrapper.java.additional=-Dneo4j.ext.udc.source" "${NEO4J_UDC_SOURCE:-docker}" neo4j-wrapper.conf 21 | setting "wrapper.java.initmemory" "${NEO4J_HEAP_MEMORY:-512}" neo4j-wrapper.conf 22 | setting "wrapper.java.maxmemory" "${NEO4J_HEAP_MEMORY:-512}" neo4j-wrapper.conf 23 | setting "org.neo4j.server.thirdparty_jaxrs_classes" "${NEO4J_THIRDPARTY_JAXRS_CLASSES:-}" neo4j-server.properties 24 | setting "allow_store_upgrade" "${NEO4J_ALLOW_STORE_UPGRADE:-}" neo4j.properties 25 | 26 | if [ "${NEO4J_AUTH:-}" == "none" ]; then 27 | setting "dbms.security.auth_enabled" "false" neo4j-server.properties 28 | elif [[ "${NEO4J_AUTH:-}" == neo4j/* ]]; then 29 | password="${NEO4J_AUTH#neo4j/}" 30 | setting "org.neo4j.server.webserver.address" "127.0.0.1" neo4j-server.properties 31 | bin/neo4j start || \ 32 | (cat data/log/console.log && echo "Neo4j failed to start" && exit 1) 33 | if ! curl --fail --silent --user "neo4j:${password}" http://localhost:7474/db/data/ >/dev/null ; then 34 | curl --fail --silent --show-error --user neo4j:neo4j \ 35 | --data '{"password": "'"${password}"'"}' \ 36 | --header 'Content-Type: application/json' \ 37 | http://localhost:7474/user/neo4j/password 38 | fi 39 | bin/neo4j stop 40 | elif [ -n "${NEO4J_AUTH:-}" ]; then 41 | echo "Invalid value for NEO4J_AUTH: '${NEO4J_AUTH}'" 42 | exit 1 43 | fi 44 | 45 | setting "org.neo4j.server.webserver.address" "0.0.0.0" neo4j-server.properties 46 | setting "org.neo4j.server.database.mode" "${NEO4J_DATABASE_MODE:-}" neo4j-server.properties 47 | setting "ha.server_id" "${NEO4J_SERVER_ID:-}" neo4j.properties 48 | setting "ha.server" "${NEO4J_HA_ADDRESS:-}:6001" neo4j.properties 49 | setting "ha.cluster_server" "${NEO4J_HA_ADDRESS:-}:5001" neo4j.properties 50 | setting "ha.initial_hosts" "${NEO4J_INITIAL_HOSTS:-}" neo4j.properties 51 | 52 | [ -f "${EXTENSION_SCRIPT:-}" ] && . ${EXTENSION_SCRIPT} 53 | 54 | if [ -d /conf ]; then 55 | find /conf -type f -exec cp {} "${NEO4J_HOME}/conf" \; 56 | fi 57 | 58 | if [ -d /ssl ]; then 59 | num_certs=$(ls /ssl/*.cert 2>/dev/null | wc -l) 60 | num_keys=$(ls /ssl/*.key 2>/dev/null | wc -l) 61 | if [ $num_certs == "1" -a $num_keys == "1" ]; then 62 | cert=$(ls /ssl/*.cert) 63 | key=$(ls /ssl/*.key) 64 | setting "dbms.security.tls_certificate_file" $cert neo4j-server.properties 65 | setting "dbms.security.tls_key_file" $key neo4j-server.properties 66 | else 67 | echo "You must provide exactly one *.cert and exactly one *.key in /ssl." 68 | exit 1 69 | fi 70 | fi 71 | 72 | if [ -d /plugins ]; then 73 | find /plugins -type f -exec cp {} plugins \; 74 | fi 75 | 76 | exec bin/neo4j console 77 | elif [ "$1" == "dump-config" ]; then 78 | if [ -d "${NEO4J_HOME}/conf" ]; then 79 | cp --recursive "${NEO4J_HOME}"/conf/* /conf 80 | else 81 | echo >&2 "You must provide a /conf volume" 82 | exit 1 83 | fi 84 | else 85 | exec "$@" 86 | fi 87 | -------------------------------------------------------------------------------- /docker-image-src/3.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre 2 | 3 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 4 | NEO4J_TARBALL=%%NEO4J_TARBALL%% 5 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 6 | 7 | COPY ./local-package/* /tmp/ 8 | 9 | RUN curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 10 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum --check --quiet - \ 11 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 12 | && mv /var/lib/neo4j-* /var/lib/neo4j \ 13 | && rm ${NEO4J_TARBALL} 14 | 15 | ENV PATH /var/lib/neo4j/bin:$PATH 16 | 17 | WORKDIR /var/lib/neo4j 18 | 19 | RUN mv data /data \ 20 | && ln --symbolic /data 21 | 22 | VOLUME /data 23 | 24 | COPY docker-entrypoint.sh /docker-entrypoint.sh 25 | 26 | EXPOSE 7474 7473 7687 27 | 28 | ENTRYPOINT ["/docker-entrypoint.sh"] 29 | CMD ["neo4j"] 30 | -------------------------------------------------------------------------------- /docker-image-src/3.0/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | setting() { 4 | setting="${1}" 5 | value="${2}" 6 | file="${3:-neo4j.conf}" 7 | 8 | if [ ! -f "conf/${file}" ]; then 9 | if [ -f "conf/neo4j.conf" ]; then 10 | file="neo4j.conf" 11 | fi 12 | fi 13 | 14 | # Don't allow settings with no value or settings that start with a number (neo4j converts settings to env variables and you cannot have an env variable that starts with a number) 15 | if [[ -n ${value} ]]; then 16 | if [[ ! "${setting}" =~ ^[0-9]+.*$ ]]; then 17 | if grep --quiet --fixed-strings "${setting}=" conf/"${file}"; then 18 | sed --in-place "s|.*${setting}=.*|${setting}=${value}|" conf/"${file}" 19 | else 20 | echo "${setting}=${value}" >>conf/"${file}" 21 | fi 22 | else 23 | echo >&2 "WARNING: ${setting} not written to conf file because settings that start with a number are not permitted" 24 | fi 25 | fi 26 | } 27 | 28 | cmd="$1" 29 | 30 | if [ "${cmd}" == "dump-config" ]; then 31 | if [ -d /conf ]; then 32 | cp --recursive conf/* /conf 33 | exit 0 34 | else 35 | echo >&2 "You must provide a /conf volume" 36 | exit 1 37 | fi 38 | fi 39 | 40 | # Env variable naming convention: 41 | # - prefix NEO4J_ 42 | # - double underscore char '__' instead of single underscore '_' char in the setting name 43 | # - underscore char '_' instead of dot '.' char in the setting name 44 | # Example: 45 | # NEO4J_dbms_tx__log_rotation_retention__policy env variable to set 46 | # dbms.tx_log.rotation.retention_policy setting 47 | 48 | # Backward compatibility - map old hardcoded env variables into new naming convention (if they aren't set already) 49 | # Set some to default values if unset 50 | : ${NEO4J_dbms_tx__log_rotation_retention__policy:=${NEO4J_dbms_txLog_rotation_retentionPolicy:-"100M size"}} 51 | : ${NEO4J_wrapper_java_additional:=${NEO4J_UDC_SOURCE:-"-Dneo4j.ext.udc.source=docker"}} 52 | : ${NEO4J_dbms_memory_heap_initial__size:=${NEO4J_dbms_memory_heap_maxSize:-"512"}} 53 | : ${NEO4J_dbms_memory_heap_max__size:=${NEO4J_dbms_memory_heap_maxSize:-"512"}} 54 | : ${NEO4J_dbms_unmanaged__extension__classes:=${NEO4J_dbms_unmanagedExtensionClasses:-}} 55 | : ${NEO4J_dbms_allow__format__migration:=${NEO4J_dbms_allowFormatMigration:-}} 56 | : ${NEO4J_ha_server__id:=${NEO4J_ha_serverId:-}} 57 | : ${NEO4J_ha_initial__hosts:=${NEO4J_ha_initialHosts:-}} 58 | 59 | : ${NEO4J_dbms_connector_http_address:="0.0.0.0:7474"} 60 | : ${NEO4J_dbms_connector_https_address:="0.0.0.0:7473"} 61 | : ${NEO4J_dbms_connector_bolt_address:="0.0.0.0:7687"} 62 | : ${NEO4J_ha_host_coordination:="$(hostname):5001"} 63 | : ${NEO4J_ha_host_data:="$(hostname):6001"} 64 | 65 | # unset old hardcoded unsupported env variables 66 | unset NEO4J_dbms_txLog_rotation_retentionPolicy NEO4J_UDC_SOURCE \ 67 | NEO4J_dbms_memory_heap_maxSize NEO4J_dbms_memory_heap_maxSize \ 68 | NEO4J_dbms_unmanagedExtensionClasses NEO4J_dbms_allowFormatMigration \ 69 | NEO4J_ha_initialHosts 70 | 71 | if [ -d /conf ]; then 72 | find /conf -type f -exec cp {} conf \; 73 | fi 74 | 75 | if [ -d /ssl ]; then 76 | NEO4J_dbms_directories_certificates="/ssl" 77 | fi 78 | 79 | if [ -d /plugins ]; then 80 | NEO4J_dbms_directories_plugins="/plugins" 81 | fi 82 | 83 | if [ -d /logs ]; then 84 | NEO4J_dbms_directories_logs="/logs" 85 | fi 86 | 87 | if [ -d /import ]; then 88 | NEO4J_dbms_directories_import="/import" 89 | fi 90 | 91 | if [ -d /metrics ]; then 92 | NEO4J_dbms_directories_metrics="/metrics" 93 | fi 94 | 95 | if [ "${cmd}" == "neo4j" ] ; then 96 | if [ "${NEO4J_AUTH:-}" == "none" ]; then 97 | NEO4J_dbms_security_auth__enabled=false 98 | elif [[ "${NEO4J_AUTH:-}" == neo4j/* ]]; then 99 | password="${NEO4J_AUTH#neo4j/}" 100 | if [ "${password}" == "neo4j" ]; then 101 | echo "Invalid value for password. It cannot be 'neo4j', which is the default." 102 | exit 1 103 | fi 104 | 105 | setting "dbms.connector.http.address" "127.0.0.1:7474" 106 | setting "dbms.connector.https.address" "127.0.0.1:7473" 107 | setting "dbms.connector.bolt.address" "127.0.0.1:7687" 108 | bin/neo4j start || \ 109 | (cat logs/neo4j.log && echo "Neo4j failed to start for password change" && exit 1) 110 | 111 | end="$((SECONDS+100))" 112 | while true; do 113 | http_code="$(curl --silent --write-out %{http_code} --user "neo4j:${password}" --output /dev/null http://localhost:7474/db/data/ || true)" 114 | 115 | if [[ "${http_code}" = "200" ]]; then 116 | break; 117 | fi 118 | 119 | if [[ "${http_code}" = "401" ]]; then 120 | curl --fail --silent --show-error --user neo4j:neo4j \ 121 | --data '{"password": "'"${password}"'"}' \ 122 | --header 'Content-Type: application/json' \ 123 | http://localhost:7474/user/neo4j/password 124 | break; 125 | fi 126 | 127 | if [[ "${SECONDS}" -ge "${end}" ]]; then 128 | (cat logs/neo4j.log && echo "Neo4j failed to start" && exit 1) 129 | fi 130 | 131 | sleep 1 132 | done 133 | 134 | bin/neo4j stop 135 | elif [ -n "${NEO4J_AUTH:-}" ]; then 136 | echo "Invalid value for NEO4J_AUTH: '${NEO4J_AUTH}'" 137 | exit 1 138 | fi 139 | fi 140 | 141 | # list env variables with prefix NEO4J_ and create settings from them 142 | unset NEO4J_AUTH NEO4J_SHA256 NEO4J_TARBALL 143 | for i in $( set | grep ^NEO4J_ | awk -F'=' '{print $1}' | sort -rn ); do 144 | setting=$(echo ${i} | sed 's|^NEO4J_||' | sed 's|_|.|g' | sed 's|\.\.|_|g') 145 | value=$(echo ${!i}) 146 | if [[ -n ${value} ]]; then 147 | if [[ ! "${setting}" =~ ^[0-9]+.*$ ]]; then 148 | if grep -q -F "${setting}=" conf/neo4j.conf; then 149 | # Remove any lines containing the setting already 150 | sed --in-place "/^${setting}=.*/d" conf/neo4j.conf 151 | fi 152 | # Then always append setting to file 153 | echo "${setting}=${value}" >> conf/neo4j.conf 154 | else 155 | echo >&2 "WARNING: ${setting} not written to conf file because settings that start with a number are not permitted" 156 | fi 157 | fi 158 | done 159 | 160 | [ -f "${EXTENSION_SCRIPT:-}" ] && . ${EXTENSION_SCRIPT} 161 | 162 | if [ "${cmd}" == "neo4j" ] ; then 163 | exec bin/neo4j console 164 | else 165 | exec "$@" 166 | fi 167 | -------------------------------------------------------------------------------- /docker-image-src/3.1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk/openjdk8:alpine-jre 2 | 3 | RUN addgroup -S neo4j && adduser -S -H -h /var/lib/neo4j -G neo4j neo4j 4 | 5 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_HOME="/var/lib/neo4j" 8 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 9 | 10 | COPY ./local-package/* /tmp/ 11 | 12 | RUN apk add --no-cache --quiet \ 13 | bash \ 14 | curl \ 15 | tini \ 16 | su-exec \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -csw - \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && chown -R neo4j:neo4j /data \ 24 | && chmod -R 777 /data \ 25 | && mv "${NEO4J_HOME}"/logs /logs \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && apk del curl 33 | 34 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 35 | 36 | WORKDIR "${NEO4J_HOME}" 37 | 38 | VOLUME /data /logs 39 | 40 | COPY docker-entrypoint.sh /docker-entrypoint.sh 41 | 42 | EXPOSE 7474 7473 7687 43 | 44 | ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] 45 | CMD ["neo4j"] 46 | -------------------------------------------------------------------------------- /docker-image-src/3.2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM adoptopenjdk/openjdk8:alpine-jre 2 | 3 | RUN addgroup -S neo4j && adduser -S -H -h /var/lib/neo4j -G neo4j neo4j 4 | 5 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_HOME="/var/lib/neo4j" 8 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 9 | 10 | COPY ./local-package/* /tmp/ 11 | 12 | RUN apk add --no-cache --quiet \ 13 | bash \ 14 | curl \ 15 | tini \ 16 | su-exec \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -csw - \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && chown -R neo4j:neo4j /data \ 24 | && chmod -R 777 /data \ 25 | && mv "${NEO4J_HOME}"/logs /logs \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && apk del curl 33 | 34 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 35 | 36 | WORKDIR "${NEO4J_HOME}" 37 | 38 | VOLUME /data /logs 39 | 40 | COPY docker-entrypoint.sh /docker-entrypoint.sh 41 | 42 | EXPOSE 7474 7473 7687 43 | 44 | ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] 45 | CMD ["neo4j"] 46 | -------------------------------------------------------------------------------- /docker-image-src/3.3/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | 3 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 4 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 5 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 6 | NEO4J_HOME="/var/lib/neo4j" \ 7 | TINI_VERSION="v0.18.0" \ 8 | TINI_SHA256="12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --system neo4j && adduser --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /tmp/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl gosu jq \ 17 | && curl -L --fail --silent --show-error "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" > /sbin/tini \ 18 | && echo "${TINI_SHA256} /sbin/tini" | sha256sum -c --strict --quiet \ 19 | && chmod +x /sbin/tini \ 20 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 21 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 22 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 23 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 24 | && rm ${NEO4J_TARBALL} \ 25 | && mv "${NEO4J_HOME}"/data /data \ 26 | && mv "${NEO4J_HOME}"/logs /logs \ 27 | && chown -R neo4j:neo4j /data \ 28 | && chmod -R 777 /data \ 29 | && chown -R neo4j:neo4j /logs \ 30 | && chmod -R 777 /logs \ 31 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 32 | && chmod -R 777 "${NEO4J_HOME}" \ 33 | && ln -s /data "${NEO4J_HOME}"/data \ 34 | && ln -s /logs "${NEO4J_HOME}"/logs \ 35 | && mv /tmp/neo4j-plugins.json /neo4j-plugins.json \ 36 | && rm -rf /tmp/* \ 37 | && rm -rf /var/lib/apt/lists/* 38 | 39 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 40 | 41 | WORKDIR "${NEO4J_HOME}" 42 | 43 | VOLUME /data /logs 44 | 45 | COPY docker-entrypoint.sh /docker-entrypoint.sh 46 | 47 | EXPOSE 7474 7473 7687 48 | 49 | ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] 50 | CMD ["neo4j"] 51 | -------------------------------------------------------------------------------- /docker-image-src/3.4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre-slim 2 | 3 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 4 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 5 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 6 | NEO4J_HOME="/var/lib/neo4j" \ 7 | TINI_VERSION="v0.18.0" \ 8 | TINI_SHA256="12d20136605531b09a2c2dac02ccee85e1b874eb322ef6baf7561cd93f93c855" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --system neo4j && adduser --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /tmp/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl wget gosu jq \ 17 | && curl -L --fail --silent --show-error "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" > /sbin/tini \ 18 | && echo "${TINI_SHA256} /sbin/tini" | sha256sum -c --strict --quiet \ 19 | && chmod +x /sbin/tini \ 20 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 21 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 22 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 23 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 24 | && rm ${NEO4J_TARBALL} \ 25 | && mv "${NEO4J_HOME}"/data /data \ 26 | && mv "${NEO4J_HOME}"/logs /logs \ 27 | && chown -R neo4j:neo4j /data \ 28 | && chmod -R 777 /data \ 29 | && chown -R neo4j:neo4j /logs \ 30 | && chmod -R 777 /logs \ 31 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 32 | && chmod -R 777 "${NEO4J_HOME}" \ 33 | && ln -s /data "${NEO4J_HOME}"/data \ 34 | && ln -s /logs "${NEO4J_HOME}"/logs \ 35 | && mv /tmp/neo4j-plugins.json /neo4j-plugins.json \ 36 | && rm -rf /tmp/* \ 37 | && rm -rf /var/lib/apt/lists/* \ 38 | && apt-get -y purge --auto-remove curl 39 | 40 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 41 | 42 | WORKDIR "${NEO4J_HOME}" 43 | 44 | VOLUME /data /logs 45 | 46 | COPY docker-entrypoint.sh /docker-entrypoint.sh 47 | 48 | EXPOSE 7474 7473 7687 49 | 50 | ENTRYPOINT ["/sbin/tini", "-g", "--", "/docker-entrypoint.sh"] 51 | CMD ["neo4j"] 52 | -------------------------------------------------------------------------------- /docker-image-src/3.5/coredb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:8 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --system neo4j && adduser --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl gosu jq tini wget \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && mv "${NEO4J_HOME}"/logs /logs \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && apt-get -y purge --auto-remove curl \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | 37 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 38 | 39 | WORKDIR "${NEO4J_HOME}" 40 | 41 | VOLUME /data /logs 42 | 43 | EXPOSE 7474 7473 7687 44 | 45 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 46 | CMD ["neo4j"] 47 | -------------------------------------------------------------------------------- /docker-image-src/3.5/coredb/neo4j-plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "apoc": { 3 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 4 | "properties": { 5 | "dbms.security.procedures.unrestricted": "apoc.*" 6 | } 7 | }, 8 | "apoc-core": { 9 | "location": "/var/lib/neo4j/labs/apoc-*-core.jar", 10 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 11 | "properties": { 12 | "dbms.security.procedures.unrestricted": "apoc.*" 13 | } 14 | }, 15 | "bloom": { 16 | "location": "/var/lib/neo4j/products/bloom-plugin-*.jar", 17 | "versions": "https://bloom-plugins.s3.eu-west-2.amazonaws.com/versions.json", 18 | "properties": { 19 | "dbms.unmanaged_extension_classes": "com.neo4j.bloom.server=/browser/bloom", 20 | "dbms.security.procedures.unrestricted": "bloom.*", 21 | "neo4j.bloom.license_file": "/licenses/bloom.license" 22 | } 23 | }, 24 | "streams": { 25 | "versions": "https://neo4j-contrib.github.io/neo4j-streams/versions.json", 26 | "properties": {} 27 | }, 28 | "graphql": { 29 | "versions": "https://neo4j-graphql.github.io/neo4j-graphql/versions.json", 30 | "properties": { 31 | "dbms.unmanaged_extension_classes": "org.neo4j.graphql=/graphql", 32 | "dbms.security.procedures.unrestricted": "graphql.*" 33 | } 34 | }, 35 | "graph-algorithms": { 36 | "versions": "https://neo4j-contrib.github.io/neo4j-graph-algorithms/versions.json", 37 | "properties": { 38 | "dbms.security.procedures.unrestricted": "algo.*" 39 | } 40 | }, 41 | "graph-data-science": { 42 | "versions": "https://graphdatascience.ninja/versions.json", 43 | "location": "/var/lib/neo4j/products/neo4j-graph-data-science-*.jar", 44 | "properties": { 45 | "dbms.security.procedures.unrestricted": "gds.*" 46 | } 47 | }, 48 | "n10s": { 49 | "versions": "https://neo4j-labs.github.io/neosemantics/versions.json", 50 | "properties": { 51 | "dbms.security.procedures.unrestricted":"semantics.*" 52 | } 53 | }, 54 | "_testing": { 55 | "versions": "http://host.testcontainers.internal:3000/versions.json", 56 | "properties": { 57 | "dbms.security.procedures.unrestricted": "com.neo4j.docker.neo4jserver.plugins.*" 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /docker-image-src/3.5/neo4j-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:8 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl procps \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && rm ${NEO4J_HOME}/bin/neo4j \ 23 | && mv "${NEO4J_HOME}"/data /data \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && mkdir -p /backups \ 27 | && chown -R neo4j:neo4j /backups \ 28 | && chmod -R 777 /backups \ 29 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 30 | && chmod -R 777 "${NEO4J_HOME}" \ 31 | && ln -s /data "${NEO4J_HOME}"/data \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && rm -rf /tmp/* \ 34 | && rm -rf /var/lib/apt/lists/* \ 35 | && apt-get -y purge --auto-remove curl 36 | 37 | 38 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 39 | VOLUME /data /backups 40 | WORKDIR "${NEO4J_HOME}" 41 | 42 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 43 | 44 | CMD ["neo4j-admin"] 45 | -------------------------------------------------------------------------------- /docker-image-src/3.5/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | function running_as_root 4 | { 5 | test "$(id -u)" = "0" 6 | } 7 | 8 | function is_writable 9 | { 10 | ${exec_cmd} test -w "${1}" 11 | } 12 | 13 | function print_permissions_advice_and_fail 14 | { 15 | local _directory=${1} 16 | echo >&2 " 17 | Folder ${_directory} is not accessible for user: ${userid} or group ${groupid} or groups ${groups[@]}, this is commonly a file permissions issue on the mounted folder. 18 | 19 | Hints to solve the issue: 20 | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder. 21 | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user. 22 | If the folder is owned by the current user, this can be done by adding this flag to your docker run command: 23 | --user=\$(id -u):\$(id -g) 24 | " 25 | exit 1 26 | } 27 | 28 | 29 | function check_mounted_folder_writable_with_chown 30 | { 31 | local mountFolder=${1} 32 | if running_as_root; then 33 | # check folder permissions 34 | if ! is_writable "${mountFolder}" ; then 35 | # warn that we're about to chown the folder and then chown it 36 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 37 | chown -R "${userid}":"${groupid}" "${mountFolder}" 38 | # check permissions on files in the folder 39 | elif [ $(${exec_cmd} find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 40 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 41 | chown -R "${userid}":"${groupid}" "${mountFolder}" 42 | fi 43 | else 44 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 45 | print_permissions_advice_and_fail "${mountFolder}" 46 | fi 47 | fi 48 | } 49 | 50 | # ==== SETUP WHICH USER TO RUN AS ==== 51 | 52 | if running_as_root; then 53 | userid="neo4j" 54 | groupid="neo4j" 55 | groups=($(id -G neo4j)) 56 | exec_cmd="runuser -p -u neo4j -g neo4j --" 57 | else 58 | userid="$(id -u)" 59 | groupid="$(id -g)" 60 | groups=($(id -G)) 61 | exec_cmd="exec" 62 | fi 63 | 64 | 65 | # ==== CHECK LICENSE AGREEMENT ==== 66 | 67 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 68 | if [ "${NEO4J_ACCEPT_LICENSE_AGREEMENT:=no}" != "yes" ]; then 69 | echo >&2 " 70 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 71 | 72 | (c) Neo4j Sweden AB. 2022. All Rights Reserved. 73 | Use of this Software without a proper commercial license with Neo4j, 74 | Inc. or its affiliates is prohibited. 75 | 76 | Email inquiries can be directed to: licensing@neo4j.com 77 | 78 | More information is also available at: https://neo4j.com/licensing/ 79 | 80 | 81 | To accept the license agreement set the environment variable 82 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 83 | 84 | To do this you can use the following docker argument: 85 | 86 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 87 | " 88 | exit 1 89 | fi 90 | fi 91 | 92 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 93 | 94 | if [ -d /data ]; then 95 | check_mounted_folder_writable_with_chown "/data" 96 | if [ -d /data/databases ]; then 97 | check_mounted_folder_writable_with_chown "/data/databases" 98 | fi 99 | if [ -d /data/dbms ]; then 100 | check_mounted_folder_writable_with_chown "/data/dbms" 101 | fi 102 | fi 103 | if [ -d /backups ]; then 104 | check_mounted_folder_writable_with_chown "/backups" 105 | fi 106 | 107 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 108 | 109 | if [[ "${1}" == "neo4j" ]]; then 110 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 111 | echo >&2 " 112 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 113 | If you wish to start a Neo4j database, use: 114 | 115 | docker run ${correct_image} 116 | " 117 | exit 1 118 | fi 119 | 120 | # ==== START NEO4J-ADMIN COMMAND ==== 121 | 122 | ${exec_cmd} "${@}" 123 | -------------------------------------------------------------------------------- /docker-image-src/4.0/coredb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /tmp/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl wget gosu jq tini \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && mv "${NEO4J_HOME}"/logs /logs \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && mv /tmp/neo4j-plugins.json /neo4j-plugins.json \ 33 | && rm -rf /tmp/* \ 34 | && rm -rf /var/lib/apt/lists/* \ 35 | && apt-get -y purge --auto-remove curl 36 | 37 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 38 | 39 | WORKDIR "${NEO4J_HOME}" 40 | 41 | VOLUME /data /logs 42 | 43 | COPY docker-entrypoint.sh /docker-entrypoint.sh 44 | 45 | EXPOSE 7474 7473 7687 46 | 47 | ENTRYPOINT ["tini", "-g", "--", "/docker-entrypoint.sh"] 48 | CMD ["neo4j"] 49 | -------------------------------------------------------------------------------- /docker-image-src/4.0/neo4j-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM %%NEO4J_BASE_IMAGE%% 2 | 3 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 4 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 5 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 6 | NEO4J_HOME="/var/lib/neo4j" 7 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 8 | 9 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 10 | 11 | COPY ./local-package/* /tmp/ 12 | 13 | RUN apt update \ 14 | && apt install -y curl gosu procps \ 15 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 16 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 17 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 18 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 19 | && rm ${NEO4J_TARBALL} \ 20 | && mv "${NEO4J_HOME}"/data /data \ 21 | && chown -R neo4j:neo4j /data \ 22 | && chmod -R 777 /data \ 23 | && mkdir -p /backups \ 24 | && chown -R neo4j:neo4j /backups \ 25 | && chmod -R 777 /backups \ 26 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 27 | && chmod -R 777 "${NEO4J_HOME}" \ 28 | && ln -s /data "${NEO4J_HOME}"/data \ 29 | && rm -rf /tmp/* \ 30 | && rm -rf /var/lib/apt/lists/* \ 31 | && apt-get -y purge --auto-remove curl 32 | 33 | 34 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 35 | VOLUME /data /backups 36 | WORKDIR "${NEO4J_HOME}" 37 | 38 | COPY docker-entrypoint.sh /docker-entrypoint.sh 39 | 40 | ENTRYPOINT ["/docker-entrypoint.sh"] 41 | 42 | CMD ["neo4j-admin"] 43 | -------------------------------------------------------------------------------- /docker-image-src/4.0/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | function running_as_root 4 | { 5 | test "$(id -u)" = "0" 6 | } 7 | 8 | function is_writable 9 | { 10 | gosu "${userid}":"${groupid}" test -w "${1}" 11 | } 12 | 13 | function print_permissions_advice_and_fail 14 | { 15 | local _directory=${1} 16 | echo >&2 " 17 | Folder ${_directory} is not accessible for user: ${userid} or group ${groupid} or groups ${groups[@]}, this is commonly a file permissions issue on the mounted folder. 18 | 19 | Hints to solve the issue: 20 | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder. 21 | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user. 22 | If the folder is owned by the current user, this can be done by adding this flag to your docker run command: 23 | --user=\$(id -u):\$(id -g) 24 | " 25 | exit 1 26 | } 27 | 28 | 29 | function check_mounted_folder_writable_with_chown 30 | { 31 | local mountFolder=${1} 32 | if running_as_root; then 33 | # check folder permissions 34 | if ! is_writable "${mountFolder}" ; then 35 | # warn that we're about to chown the folder and then chown it 36 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 37 | chown -R "${userid}":"${groupid}" "${mountFolder}" 38 | # check permissions on files in the folder 39 | elif [ $(gosu "${userid}":"${groupid}" find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 40 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 41 | chown -R "${userid}":"${groupid}" "${mountFolder}" 42 | fi 43 | else 44 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 45 | print_permissions_advice_and_fail "${mountFolder}" 46 | fi 47 | fi 48 | } 49 | 50 | # ==== SETUP WHICH USER TO RUN AS ==== 51 | 52 | if running_as_root; then 53 | userid="neo4j" 54 | groupid="neo4j" 55 | groups=($(id -G neo4j)) 56 | exec_cmd="exec gosu neo4j:neo4j" 57 | else 58 | userid="$(id -u)" 59 | groupid="$(id -g)" 60 | groups=($(id -G)) 61 | exec_cmd="exec" 62 | fi 63 | 64 | 65 | # ==== CHECK LICENSE AGREEMENT ==== 66 | 67 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 68 | if [ "${NEO4J_ACCEPT_LICENSE_AGREEMENT:=no}" != "yes" ]; then 69 | echo >&2 " 70 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 71 | 72 | (c) Neo4j Sweden AB. 2021. All Rights Reserved. 73 | Use of this Software without a proper commercial license with Neo4j, 74 | Inc. or its affiliates is prohibited. 75 | 76 | Email inquiries can be directed to: licensing@neo4j.com 77 | 78 | More information is also available at: https://neo4j.com/licensing/ 79 | 80 | 81 | To accept the license agreement set the environment variable 82 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 83 | 84 | To do this you can use the following docker argument: 85 | 86 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 87 | " 88 | exit 1 89 | fi 90 | fi 91 | 92 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 93 | 94 | if [ -d /data ]; then 95 | check_mounted_folder_writable_with_chown "/data" 96 | if [ -d /data/databases ]; then 97 | check_mounted_folder_writable_with_chown "/data/databases" 98 | fi 99 | if [ -d /data/dbms ]; then 100 | check_mounted_folder_writable_with_chown "/data/dbms" 101 | fi 102 | if [ -d /data/transactions ]; then 103 | check_mounted_folder_writable_with_chown "/data/transactions" 104 | fi 105 | fi 106 | if [ -d /backups ]; then 107 | check_mounted_folder_writable_with_chown "/backups" 108 | fi 109 | 110 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 111 | 112 | rm ${NEO4J_HOME}/bin/neo4j 113 | 114 | if [[ "${1}" == "neo4j" ]]; then 115 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 116 | echo >&2 " 117 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 118 | If you wish to start a Neo4j database, use: 119 | 120 | docker run ${correct_image} 121 | " 122 | exit 1 123 | fi 124 | 125 | # ==== START NEO4J-ADMIN COMMAND ==== 126 | 127 | ${exec_cmd} "${@}" 128 | -------------------------------------------------------------------------------- /docker-image-src/4.1/coredb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl wget gosu jq tini \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && mv "${NEO4J_HOME}"/logs /logs \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && apt-get -y purge --auto-remove curl \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | 37 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 38 | 39 | WORKDIR "${NEO4J_HOME}" 40 | 41 | VOLUME /data /logs 42 | 43 | EXPOSE 7474 7473 7687 44 | 45 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 46 | CMD ["neo4j"] 47 | -------------------------------------------------------------------------------- /docker-image-src/4.1/neo4j-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM %%NEO4J_BASE_IMAGE%% 2 | 3 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 4 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 5 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 6 | NEO4J_HOME="/var/lib/neo4j" 7 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 8 | 9 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 10 | 11 | COPY ./local-package/* /startup/ 12 | 13 | RUN apt update \ 14 | && apt install -y curl gosu procps \ 15 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 16 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 17 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 18 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 19 | && rm ${NEO4J_TARBALL} \ 20 | && mv "${NEO4J_HOME}"/data /data \ 21 | && chown -R neo4j:neo4j /data \ 22 | && chmod -R 777 /data \ 23 | && mkdir -p /backups \ 24 | && chown -R neo4j:neo4j /backups \ 25 | && chmod -R 777 /backups \ 26 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 27 | && chmod -R 777 "${NEO4J_HOME}" \ 28 | && ln -s /data "${NEO4J_HOME}"/data \ 29 | && rm -rf /tmp/* \ 30 | && rm -rf /var/lib/apt/lists/* \ 31 | && apt-get -y purge --auto-remove curl 32 | 33 | 34 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 35 | VOLUME /data /backups 36 | WORKDIR "${NEO4J_HOME}" 37 | 38 | COPY docker-entrypoint.sh /docker-entrypoint.sh 39 | 40 | ENTRYPOINT ["/docker-entrypoint.sh"] 41 | 42 | CMD ["neo4j-admin"] 43 | -------------------------------------------------------------------------------- /docker-image-src/4.1/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | function running_as_root 4 | { 5 | test "$(id -u)" = "0" 6 | } 7 | 8 | function is_writable 9 | { 10 | gosu "${userid}":"${groupid}" test -w "${1}" 11 | } 12 | 13 | function print_permissions_advice_and_fail 14 | { 15 | local _directory=${1} 16 | echo >&2 " 17 | Folder ${_directory} is not accessible for user: ${userid} or group ${groupid} or groups ${groups[@]}, this is commonly a file permissions issue on the mounted folder. 18 | 19 | Hints to solve the issue: 20 | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder. 21 | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user. 22 | If the folder is owned by the current user, this can be done by adding this flag to your docker run command: 23 | --user=\$(id -u):\$(id -g) 24 | " 25 | exit 1 26 | } 27 | 28 | 29 | function check_mounted_folder_writable_with_chown 30 | { 31 | local mountFolder=${1} 32 | if running_as_root; then 33 | # check folder permissions 34 | if ! is_writable "${mountFolder}" ; then 35 | # warn that we're about to chown the folder and then chown it 36 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 37 | chown -R "${userid}":"${groupid}" "${mountFolder}" 38 | # check permissions on files in the folder 39 | elif [ $(gosu "${userid}":"${groupid}" find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 40 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 41 | chown -R "${userid}":"${groupid}" "${mountFolder}" 42 | fi 43 | else 44 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 45 | print_permissions_advice_and_fail "${mountFolder}" 46 | fi 47 | fi 48 | } 49 | 50 | # ==== SETUP WHICH USER TO RUN AS ==== 51 | 52 | if running_as_root; then 53 | userid="neo4j" 54 | groupid="neo4j" 55 | groups=($(id -G neo4j)) 56 | exec_cmd="exec gosu neo4j:neo4j" 57 | else 58 | userid="$(id -u)" 59 | groupid="$(id -g)" 60 | groups=($(id -G)) 61 | exec_cmd="exec" 62 | fi 63 | 64 | 65 | # ==== CHECK LICENSE AGREEMENT ==== 66 | 67 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 68 | if [ "${NEO4J_ACCEPT_LICENSE_AGREEMENT:=no}" != "yes" ]; then 69 | echo >&2 " 70 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 71 | 72 | (c) Neo4j Sweden AB. 2021. All Rights Reserved. 73 | Use of this Software without a proper commercial license with Neo4j, 74 | Inc. or its affiliates is prohibited. 75 | 76 | Email inquiries can be directed to: licensing@neo4j.com 77 | 78 | More information is also available at: https://neo4j.com/licensing/ 79 | 80 | 81 | To accept the license agreement set the environment variable 82 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 83 | 84 | To do this you can use the following docker argument: 85 | 86 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 87 | " 88 | exit 1 89 | fi 90 | fi 91 | 92 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 93 | 94 | if [ -d /data ]; then 95 | check_mounted_folder_writable_with_chown "/data" 96 | if [ -d /data/databases ]; then 97 | check_mounted_folder_writable_with_chown "/data/databases" 98 | fi 99 | if [ -d /data/dbms ]; then 100 | check_mounted_folder_writable_with_chown "/data/dbms" 101 | fi 102 | if [ -d /data/transactions ]; then 103 | check_mounted_folder_writable_with_chown "/data/transactions" 104 | fi 105 | fi 106 | if [ -d /backups ]; then 107 | check_mounted_folder_writable_with_chown "/backups" 108 | fi 109 | 110 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 111 | 112 | rm ${NEO4J_HOME}/bin/neo4j 113 | 114 | if [[ "${1}" == "neo4j" ]]; then 115 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 116 | echo >&2 " 117 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 118 | If you wish to start a Neo4j database, use: 119 | 120 | docker run ${correct_image} 121 | " 122 | exit 1 123 | fi 124 | 125 | # ==== START NEO4J-ADMIN COMMAND ==== 126 | 127 | ${exec_cmd} "${@}" 128 | -------------------------------------------------------------------------------- /docker-image-src/4.2/coredb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl wget gosu jq tini \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && mv "${NEO4J_HOME}"/logs /logs \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && apt-get -y purge --auto-remove curl \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | 37 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 38 | 39 | WORKDIR "${NEO4J_HOME}" 40 | 41 | VOLUME /data /logs 42 | 43 | EXPOSE 7474 7473 7687 44 | 45 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 46 | CMD ["neo4j"] 47 | -------------------------------------------------------------------------------- /docker-image-src/4.2/coredb/neo4j-plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "apoc": { 3 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 4 | "properties": { 5 | "dbms.security.procedures.unrestricted": "apoc.*" 6 | } 7 | }, 8 | "apoc-core": { 9 | "location": "/var/lib/neo4j/labs/apoc-*-core.jar", 10 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 11 | "properties": { 12 | "dbms.security.procedures.unrestricted": "apoc.*" 13 | } 14 | }, 15 | "bloom": { 16 | "location": "/var/lib/neo4j/products/bloom-plugin-*.jar", 17 | "versions": "https://bloom-plugins.s3.eu-west-2.amazonaws.com/versions.json", 18 | "properties": { 19 | "dbms.unmanaged_extension_classes": "com.neo4j.bloom.server=/browser/bloom", 20 | "dbms.security.procedures.unrestricted": "bloom.*", 21 | "neo4j.bloom.license_file": "/licenses/bloom.license" 22 | } 23 | }, 24 | "streams": { 25 | "versions": "https://neo4j-contrib.github.io/neo4j-streams/versions.json", 26 | "properties": {} 27 | }, 28 | "graphql": { 29 | "versions": "https://neo4j-graphql.github.io/neo4j-graphql/versions.json", 30 | "properties": { 31 | "dbms.unmanaged_extension_classes": "org.neo4j.graphql=/graphql", 32 | "dbms.security.procedures.unrestricted": "graphql.*" 33 | } 34 | }, 35 | "graph-algorithms": { 36 | "versions": "https://neo4j-contrib.github.io/neo4j-graph-algorithms/versions.json", 37 | "properties": { 38 | "dbms.security.procedures.unrestricted": "algo.*" 39 | } 40 | }, 41 | "graph-data-science": { 42 | "versions": "https://graphdatascience.ninja/versions.json", 43 | "location": "/var/lib/neo4j/products/neo4j-graph-data-science-*.jar", 44 | "properties": { 45 | "dbms.security.procedures.unrestricted": "gds.*" 46 | } 47 | }, 48 | "n10s": { 49 | "versions": "https://neo4j-labs.github.io/neosemantics/versions.json", 50 | "properties": { 51 | "dbms.security.procedures.unrestricted":"semantics.*" 52 | } 53 | }, 54 | "_testing": { 55 | "versions": "http://host.testcontainers.internal:3000/versions.json", 56 | "properties": { 57 | "dbms.security.procedures.unrestricted": "com.neo4j.docker.neo4jserver.plugins.*" 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /docker-image-src/4.2/neo4j-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl procps \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && rm ${NEO4J_HOME}/bin/neo4j \ 23 | && mv "${NEO4J_HOME}"/data /data \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && mkdir -p /backups \ 27 | && chown -R neo4j:neo4j /backups \ 28 | && chmod -R 777 /backups \ 29 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 30 | && chmod -R 777 "${NEO4J_HOME}" \ 31 | && ln -s /data "${NEO4J_HOME}"/data \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && rm -rf /tmp/* \ 34 | && rm -rf /var/lib/apt/lists/* \ 35 | && apt-get -y purge --auto-remove curl 36 | 37 | 38 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 39 | VOLUME /data /backups 40 | WORKDIR "${NEO4J_HOME}" 41 | 42 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 43 | 44 | CMD ["neo4j-admin"] 45 | -------------------------------------------------------------------------------- /docker-image-src/4.2/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | function running_as_root 4 | { 5 | test "$(id -u)" = "0" 6 | } 7 | 8 | function is_writable 9 | { 10 | gosu "${userid}":"${groupid}" test -w "${1}" 11 | } 12 | 13 | function print_permissions_advice_and_fail 14 | { 15 | local _directory=${1} 16 | echo >&2 " 17 | Folder ${_directory} is not accessible for user: ${userid} or group ${groupid} or groups ${groups[@]}, this is commonly a file permissions issue on the mounted folder. 18 | 19 | Hints to solve the issue: 20 | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder. 21 | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user. 22 | If the folder is owned by the current user, this can be done by adding this flag to your docker run command: 23 | --user=\$(id -u):\$(id -g) 24 | " 25 | exit 1 26 | } 27 | 28 | 29 | function check_mounted_folder_writable_with_chown 30 | { 31 | local mountFolder=${1} 32 | if running_as_root; then 33 | # check folder permissions 34 | if ! is_writable "${mountFolder}" ; then 35 | # warn that we're about to chown the folder and then chown it 36 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 37 | chown -R "${userid}":"${groupid}" "${mountFolder}" 38 | # check permissions on files in the folder 39 | elif [ $(gosu "${userid}":"${groupid}" find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 40 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 41 | chown -R "${userid}":"${groupid}" "${mountFolder}" 42 | fi 43 | else 44 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 45 | print_permissions_advice_and_fail "${mountFolder}" 46 | fi 47 | fi 48 | } 49 | 50 | # ==== SETUP WHICH USER TO RUN AS ==== 51 | 52 | if running_as_root; then 53 | userid="neo4j" 54 | groupid="neo4j" 55 | groups=($(id -G neo4j)) 56 | exec_cmd="exec gosu neo4j:neo4j" 57 | else 58 | userid="$(id -u)" 59 | groupid="$(id -g)" 60 | groups=($(id -G)) 61 | exec_cmd="exec" 62 | fi 63 | 64 | 65 | # ==== CHECK LICENSE AGREEMENT ==== 66 | 67 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 68 | if [ "${NEO4J_ACCEPT_LICENSE_AGREEMENT:=no}" != "yes" ]; then 69 | echo >&2 " 70 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 71 | 72 | (c) Neo4j Sweden AB. 2021. All Rights Reserved. 73 | Use of this Software without a proper commercial license with Neo4j, 74 | Inc. or its affiliates is prohibited. 75 | 76 | Email inquiries can be directed to: licensing@neo4j.com 77 | 78 | More information is also available at: https://neo4j.com/licensing/ 79 | 80 | 81 | To accept the license agreement set the environment variable 82 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 83 | 84 | To do this you can use the following docker argument: 85 | 86 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 87 | " 88 | exit 1 89 | fi 90 | fi 91 | 92 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 93 | 94 | if [ -d /data ]; then 95 | check_mounted_folder_writable_with_chown "/data" 96 | if [ -d /data/databases ]; then 97 | check_mounted_folder_writable_with_chown "/data/databases" 98 | fi 99 | if [ -d /data/dbms ]; then 100 | check_mounted_folder_writable_with_chown "/data/dbms" 101 | fi 102 | if [ -d /data/transactions ]; then 103 | check_mounted_folder_writable_with_chown "/data/transactions" 104 | fi 105 | fi 106 | if [ -d /backups ]; then 107 | check_mounted_folder_writable_with_chown "/backups" 108 | fi 109 | 110 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 111 | 112 | rm ${NEO4J_HOME}/bin/neo4j 113 | 114 | if [[ "${1}" == "neo4j" ]]; then 115 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 116 | echo >&2 " 117 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 118 | If you wish to start a Neo4j database, use: 119 | 120 | docker run ${correct_image} 121 | " 122 | exit 1 123 | fi 124 | 125 | # ==== START NEO4J-ADMIN COMMAND ==== 126 | 127 | ${exec_cmd} "${@}" 128 | -------------------------------------------------------------------------------- /docker-image-src/4.3/coredb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl gosu jq procps tini wget \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && mv "${NEO4J_HOME}"/data /data \ 23 | && mv "${NEO4J_HOME}"/logs /logs \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && chown -R neo4j:neo4j /logs \ 27 | && chmod -R 777 /logs \ 28 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 29 | && chmod -R 777 "${NEO4J_HOME}" \ 30 | && ln -s /data "${NEO4J_HOME}"/data \ 31 | && ln -s /logs "${NEO4J_HOME}"/logs \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && apt-get -y purge --auto-remove curl \ 34 | && rm -rf /var/lib/apt/lists/* 35 | 36 | 37 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 38 | 39 | WORKDIR "${NEO4J_HOME}" 40 | 41 | VOLUME /data /logs 42 | 43 | EXPOSE 7474 7473 7687 44 | 45 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 46 | CMD ["neo4j"] 47 | -------------------------------------------------------------------------------- /docker-image-src/4.3/coredb/neo4j-plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "apoc": { 3 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 4 | "properties": { 5 | "dbms.security.procedures.unrestricted": "apoc.*" 6 | } 7 | }, 8 | "apoc-core": { 9 | "location": "/var/lib/neo4j/labs/apoc-*-core.jar", 10 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 11 | "properties": { 12 | "dbms.security.procedures.unrestricted": "apoc.*" 13 | } 14 | }, 15 | "bloom": { 16 | "location": "/var/lib/neo4j/products/bloom-plugin-*.jar", 17 | "versions": "https://bloom-plugins.s3.eu-west-2.amazonaws.com/versions.json", 18 | "properties": { 19 | "dbms.unmanaged_extension_classes": "com.neo4j.bloom.server=/browser/bloom", 20 | "dbms.security.procedures.unrestricted": "bloom.*", 21 | "neo4j.bloom.license_file": "/licenses/bloom.license" 22 | } 23 | }, 24 | "streams": { 25 | "versions": "https://neo4j-contrib.github.io/neo4j-streams/versions.json", 26 | "properties": {} 27 | }, 28 | "graphql": { 29 | "versions": "https://neo4j-graphql.github.io/neo4j-graphql/versions.json", 30 | "properties": { 31 | "dbms.unmanaged_extension_classes": "org.neo4j.graphql=/graphql", 32 | "dbms.security.procedures.unrestricted": "graphql.*" 33 | } 34 | }, 35 | "graph-algorithms": { 36 | "versions": "https://neo4j-contrib.github.io/neo4j-graph-algorithms/versions.json", 37 | "properties": { 38 | "dbms.security.procedures.unrestricted": "algo.*" 39 | } 40 | }, 41 | "graph-data-science": { 42 | "versions": "https://graphdatascience.ninja/versions.json", 43 | "location": "/var/lib/neo4j/products/neo4j-graph-data-science-*.jar", 44 | "properties": { 45 | "dbms.security.procedures.unrestricted": "gds.*" 46 | } 47 | }, 48 | "n10s": { 49 | "versions": "https://neo4j-labs.github.io/neosemantics/versions.json", 50 | "properties": { 51 | "dbms.security.procedures.unrestricted":"semantics.*" 52 | } 53 | }, 54 | "_testing": { 55 | "versions": "http://host.testcontainers.internal:3000/versions.json", 56 | "properties": { 57 | "dbms.security.procedures.unrestricted": "com.neo4j.docker.neo4jserver.plugins.*" 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /docker-image-src/4.3/neo4j-admin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" 9 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 10 | 11 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 12 | 13 | COPY ./local-package/* /startup/ 14 | 15 | RUN apt update \ 16 | && apt install -y curl procps \ 17 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 18 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 19 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 20 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 21 | && rm ${NEO4J_TARBALL} \ 22 | && rm ${NEO4J_HOME}/bin/neo4j \ 23 | && mv "${NEO4J_HOME}"/data /data \ 24 | && chown -R neo4j:neo4j /data \ 25 | && chmod -R 777 /data \ 26 | && mkdir -p /backups \ 27 | && chown -R neo4j:neo4j /backups \ 28 | && chmod -R 777 /backups \ 29 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 30 | && chmod -R 777 "${NEO4J_HOME}" \ 31 | && ln -s /data "${NEO4J_HOME}"/data \ 32 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 33 | && rm -rf /tmp/* \ 34 | && rm -rf /var/lib/apt/lists/* \ 35 | && apt-get -y purge --auto-remove curl 36 | 37 | 38 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 39 | VOLUME /data /backups 40 | WORKDIR "${NEO4J_HOME}" 41 | 42 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 43 | 44 | CMD ["neo4j-admin"] 45 | -------------------------------------------------------------------------------- /docker-image-src/4.3/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | function running_as_root 4 | { 5 | test "$(id -u)" = "0" 6 | } 7 | 8 | function is_writable 9 | { 10 | ${exec_cmd} test -w "${1}" 11 | } 12 | 13 | function print_permissions_advice_and_fail 14 | { 15 | local _directory=${1} 16 | echo >&2 " 17 | Folder ${_directory} is not accessible for user: ${userid} or group ${groupid} or groups ${groups[@]}, this is commonly a file permissions issue on the mounted folder. 18 | 19 | Hints to solve the issue: 20 | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder. 21 | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user. 22 | If the folder is owned by the current user, this can be done by adding this flag to your docker run command: 23 | --user=\$(id -u):\$(id -g) 24 | " 25 | exit 1 26 | } 27 | 28 | 29 | function check_mounted_folder_writable_with_chown 30 | { 31 | local mountFolder=${1} 32 | if running_as_root; then 33 | # check folder permissions 34 | if ! is_writable "${mountFolder}" ; then 35 | # warn that we're about to chown the folder and then chown it 36 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 37 | chown -R "${userid}":"${groupid}" "${mountFolder}" 38 | # check permissions on files in the folder 39 | elif [ $(${exec_cmd} find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 40 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 41 | chown -R "${userid}":"${groupid}" "${mountFolder}" 42 | fi 43 | else 44 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 45 | print_permissions_advice_and_fail "${mountFolder}" 46 | fi 47 | fi 48 | } 49 | 50 | # ==== SETUP WHICH USER TO RUN AS ==== 51 | 52 | if running_as_root; then 53 | userid="neo4j" 54 | groupid="neo4j" 55 | groups=($(id -G neo4j)) 56 | exec_cmd="runuser -p -u neo4j -g neo4j --" 57 | else 58 | userid="$(id -u)" 59 | groupid="$(id -g)" 60 | groups=($(id -G)) 61 | exec_cmd="exec" 62 | fi 63 | 64 | 65 | # ==== CHECK LICENSE AGREEMENT ==== 66 | 67 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 68 | if [ "${NEO4J_ACCEPT_LICENSE_AGREEMENT:=no}" != "yes" ]; then 69 | echo >&2 " 70 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 71 | 72 | (c) Neo4j Sweden AB. 2022. All Rights Reserved. 73 | Use of this Software without a proper commercial license with Neo4j, 74 | Inc. or its affiliates is prohibited. 75 | 76 | Email inquiries can be directed to: licensing@neo4j.com 77 | 78 | More information is also available at: https://neo4j.com/licensing/ 79 | 80 | 81 | To accept the license agreement set the environment variable 82 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 83 | 84 | To do this you can use the following docker argument: 85 | 86 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 87 | " 88 | exit 1 89 | fi 90 | fi 91 | 92 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 93 | 94 | if [ -d /data ]; then 95 | check_mounted_folder_writable_with_chown "/data" 96 | if [ -d /data/databases ]; then 97 | check_mounted_folder_writable_with_chown "/data/databases" 98 | fi 99 | if [ -d /data/dbms ]; then 100 | check_mounted_folder_writable_with_chown "/data/dbms" 101 | fi 102 | if [ -d /data/transactions ]; then 103 | check_mounted_folder_writable_with_chown "/data/transactions" 104 | fi 105 | fi 106 | if [ -d /backups ]; then 107 | check_mounted_folder_writable_with_chown "/backups" 108 | fi 109 | 110 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 111 | 112 | if [[ "${1}" == "neo4j" ]]; then 113 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 114 | echo >&2 " 115 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 116 | If you wish to start a Neo4j database, use: 117 | 118 | docker run ${correct_image} 119 | " 120 | exit 1 121 | fi 122 | 123 | # ==== START NEO4J-ADMIN COMMAND ==== 124 | 125 | ${exec_cmd} "${@}" 126 | -------------------------------------------------------------------------------- /docker-image-src/4.4/coredb/Dockerfile-debian: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" \ 9 | LANG=C.UTF-8 10 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 11 | 12 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 13 | 14 | COPY ./local-package/* /startup/ 15 | 16 | RUN apt-get update \ 17 | && apt-get install --no-install-recommends -o Acquire::Retries=10 -y \ 18 | curl ca-certificates gcc libc-dev git jq make procps tini wget \ 19 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 20 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 21 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 22 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 23 | && rm ${NEO4J_TARBALL} \ 24 | && mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report \ 25 | && mv "${NEO4J_HOME}"/data /data \ 26 | && mv "${NEO4J_HOME}"/logs /logs \ 27 | && chown -R neo4j:neo4j /data \ 28 | && chmod -R 777 /data \ 29 | && chown -R neo4j:neo4j /logs \ 30 | && chmod -R 777 /logs \ 31 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 32 | && chmod -R 777 "${NEO4J_HOME}" \ 33 | && chmod -R 755 "${NEO4J_HOME}/bin" \ 34 | && ln -s /data "${NEO4J_HOME}"/data \ 35 | && ln -s /logs "${NEO4J_HOME}"/logs \ 36 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 37 | && git clone https://github.com/ncopa/su-exec.git \ 38 | && cd su-exec \ 39 | && git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af \ 40 | && echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c \ 41 | && echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c \ 42 | && make \ 43 | && mv /su-exec/su-exec /usr/bin/su-exec \ 44 | && apt-get -y purge --auto-remove curl gcc git make libc-dev \ 45 | && rm -rf /var/lib/apt/lists/* /su-exec 46 | 47 | 48 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 49 | 50 | WORKDIR "${NEO4J_HOME}" 51 | 52 | VOLUME /data /logs 53 | 54 | EXPOSE 7474 7473 7687 55 | 56 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 57 | CMD ["neo4j"] 58 | -------------------------------------------------------------------------------- /docker-image-src/4.4/coredb/Dockerfile-ubi9: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi9-minimal:latest 2 | ENV JAVA_HOME=/usr 3 | 4 | # gather pre-requisite packages 5 | RUN set -eux; \ 6 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 7 | case "${arch}" in \ 8 | 'x86_64') \ 9 | tini_url="https://github.com/krallin/tini/releases/download/v0.19.0/tini"; \ 10 | tini_sha="93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c"; \ 11 | ;; \ 12 | 'aarch64') \ 13 | tini_url="https://github.com/krallin/tini/releases/download/v0.19.0/tini-arm64"; \ 14 | tini_sha="07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81"; \ 15 | ;; \ 16 | *) echo >&2 "Neo4j does not currently have a docker image for architecture $arch"; exit 1 ;; \ 17 | esac; \ 18 | microdnf install -y dnf; \ 19 | dnf install -y \ 20 | findutils \ 21 | gcc \ 22 | git \ 23 | gzip \ 24 | hostname \ 25 | java-11-openjdk-headless \ 26 | jq \ 27 | make \ 28 | procps \ 29 | shadow-utils \ 30 | tar \ 31 | wget \ 32 | which; \ 33 | # download tini and openssl 34 | wget -q ${tini_url} -O /usr/bin/tini; \ 35 | wget -q ${tini_url}.asc -O tini.asc; \ 36 | echo "${tini_sha}" /usr/bin/tini | sha256sum -c --strict --quiet; \ 37 | chmod a+x /usr/bin/tini; \ 38 | export GNUPGHOME="$(mktemp -d)"; \ 39 | gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys \ 40 | 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ 41 | B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 42 | gpg --batch --verify tini.asc /usr/bin/tini; \ 43 | git clone https://github.com/ncopa/su-exec.git; \ 44 | cd su-exec; \ 45 | git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af; \ 46 | echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c; \ 47 | echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c; \ 48 | make; \ 49 | mv /su-exec/su-exec /usr/bin/su-exec; \ 50 | gpgconf --kill all; \ 51 | rm -rf "$GNUPGHOME" tini.asc /su-exec; \ 52 | dnf remove -y gcc git make; \ 53 | dnf autoremove; \ 54 | dnf clean all 55 | 56 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 57 | NEO4J_SHA256=%%NEO4J_SHA%% \ 58 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 59 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 60 | NEO4J_HOME="/var/lib/neo4j" \ 61 | LANG=C.UTF-8 62 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 63 | 64 | COPY ./local-package/* /startup/ 65 | 66 | RUN set -eux; \ 67 | groupadd --gid 7474 --system neo4j && useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 68 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 69 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 70 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 71 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 72 | rm ${NEO4J_TARBALL}; \ 73 | mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report; \ 74 | mv "${NEO4J_HOME}"/data /data; \ 75 | mv "${NEO4J_HOME}"/logs /logs; \ 76 | chown -R neo4j:neo4j /data; \ 77 | chmod -R 777 /data; \ 78 | chown -R neo4j:neo4j /logs; \ 79 | chmod -R 777 /logs; \ 80 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 81 | chmod -R 777 "${NEO4J_HOME}"; \ 82 | chmod -R 755 "${NEO4J_HOME}/bin"; \ 83 | ln -s /data "${NEO4J_HOME}"/data; \ 84 | ln -s /logs "${NEO4J_HOME}"/logs; \ 85 | ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh 86 | 87 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 88 | 89 | WORKDIR "${NEO4J_HOME}" 90 | 91 | VOLUME /data /logs 92 | 93 | EXPOSE 7474 7473 7687 94 | 95 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 96 | CMD ["neo4j"] 97 | -------------------------------------------------------------------------------- /docker-image-src/4.4/coredb/neo4j-admin-report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # load useful utility functions 4 | . /startup/utilities.sh 5 | 6 | function find_report_destination 7 | { 8 | local to_flag="--to" 9 | 10 | while [[ $# -gt 0 ]]; do 11 | case $1 in 12 | # for arg in "$@"; do 13 | # case $arg in 14 | "${to_flag}"=*) 15 | echo ${1#*=} 16 | return 17 | ;; 18 | "${to_flag}") 19 | echo ${2} 20 | return 21 | ;; 22 | *) 23 | shift 24 | ;; 25 | esac 26 | done 27 | mkdir -p /tmp/reports 28 | echo "/tmp/reports" 29 | } 30 | 31 | report_cmd=("neo4j-admin" "report") 32 | 33 | # note, these debug messages are unlikely to work in a docker exec, since environment isn't preserved. 34 | debug_msg "Called ${0}" 35 | debug_msg "neo4j-admin report command is:" "${report_cmd[@]}" "$@" 36 | 37 | # find report destination. This could be specified by argument to neo4j-admin or it could be the default location. 38 | report_destination=$(find_report_destination "$@") 39 | debug_msg "report_destination will be ${report_destination}" 40 | 41 | debug_msg "Determining which user to run neo4j-admin as." 42 | if running_as_root; then 43 | debug_msg "running neo4j-admin report as root" 44 | if [[ ! $(su-exec neo4j:neo4j test -w "${report_destination}") ]]; then 45 | debug_msg "reowning ${report_destination} to neo4j:neo4j" 46 | chown neo4j:neo4j "${report_destination}" 47 | fi 48 | debug_msg su-exec neo4j:neo4j "${report_cmd[@]}" "$@" 49 | su-exec neo4j:neo4j "${report_cmd[@]}" "$@" 50 | else 51 | debug_msg "running neo4j-admin report as user defined by --user flag" 52 | if [[ ! -w "${report_destination}" ]]; then 53 | print_permissions_advice_and_fail "${report_destination}" "$(id -u)" "$(id -g)" 54 | fi 55 | debug_msg "${report_cmd[@]}" "$@" 56 | "${report_cmd[@]}" "$@" 57 | fi -------------------------------------------------------------------------------- /docker-image-src/4.4/coredb/neo4j-plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "apoc": { 3 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 4 | "properties": { 5 | "dbms.security.procedures.unrestricted": "apoc.*" 6 | } 7 | }, 8 | "apoc-core": { 9 | "location": "/var/lib/neo4j/labs/apoc-*-core.jar", 10 | "versions": "https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/refs/heads/master/versions.json", 11 | "properties": { 12 | "dbms.security.procedures.unrestricted": "apoc.*" 13 | } 14 | }, 15 | "bloom": { 16 | "location": "/var/lib/neo4j/products/bloom-plugin-*.jar", 17 | "versions": "https://bloom-plugins.s3.eu-west-2.amazonaws.com/versions.json", 18 | "properties": { 19 | "dbms.unmanaged_extension_classes": "com.neo4j.bloom.server=/browser/bloom", 20 | "dbms.security.procedures.unrestricted": "bloom.*", 21 | "neo4j.bloom.license_file": "/licenses/bloom.license" 22 | } 23 | }, 24 | "streams": { 25 | "versions": "https://neo4j-contrib.github.io/neo4j-streams/versions.json", 26 | "properties": {} 27 | }, 28 | "graphql": { 29 | "versions": "https://neo4j-graphql.github.io/neo4j-graphql/versions.json", 30 | "properties": { 31 | "dbms.unmanaged_extension_classes": "org.neo4j.graphql=/graphql", 32 | "dbms.security.procedures.unrestricted": "graphql.*" 33 | } 34 | }, 35 | "graph-algorithms": { 36 | "versions": "https://neo4j-contrib.github.io/neo4j-graph-algorithms/versions.json", 37 | "properties": { 38 | "dbms.security.procedures.unrestricted": "algo.*" 39 | } 40 | }, 41 | "graph-data-science": { 42 | "versions": "https://graphdatascience.ninja/versions.json", 43 | "location": "/var/lib/neo4j/products/neo4j-graph-data-science-*.jar", 44 | "properties": { 45 | "dbms.security.procedures.unrestricted": "gds.*" 46 | } 47 | }, 48 | "n10s": { 49 | "versions": "https://neo4j-labs.github.io/neosemantics/versions.json", 50 | "properties": { 51 | "dbms.security.procedures.unrestricted":"semantics.*" 52 | } 53 | }, 54 | "_testing": { 55 | "versions": "http://host.testcontainers.internal:3000/versions.json", 56 | "properties": { 57 | "dbms.security.procedures.unrestricted": "com.neo4j.docker.neo4jserver.plugins.*" 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /docker-image-src/4.4/neo4j-admin/Dockerfile-debian: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" \ 9 | LANG=C.UTF-8 10 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 11 | 12 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 13 | 14 | COPY ./local-package/* /startup/ 15 | 16 | RUN apt-get update \ 17 | && apt-get install --no-install-recommends -o Acquire::Retries=10 -y \ 18 | curl ca-certificates procps \ 19 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 20 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 21 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 22 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 23 | && rm ${NEO4J_TARBALL} \ 24 | && rm ${NEO4J_HOME}/bin/neo4j \ 25 | && mv "${NEO4J_HOME}"/data /data \ 26 | && chown -R neo4j:neo4j /data \ 27 | && chmod -R 777 /data \ 28 | && mkdir -p /backups \ 29 | && chown -R neo4j:neo4j /backups \ 30 | && chmod -R 777 /backups \ 31 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 32 | && chmod -R 777 "${NEO4J_HOME}" \ 33 | && chmod -R 755 "${NEO4J_HOME}/bin" \ 34 | && ln -s /data "${NEO4J_HOME}"/data \ 35 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 36 | && rm -rf /tmp/* \ 37 | && rm -rf /var/lib/apt/lists/* \ 38 | && apt-get -y purge --auto-remove curl 39 | 40 | 41 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 42 | VOLUME /data /backups 43 | WORKDIR "${NEO4J_HOME}" 44 | 45 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 46 | 47 | CMD ["neo4j-admin"] 48 | -------------------------------------------------------------------------------- /docker-image-src/4.4/neo4j-admin/Dockerfile-ubi9: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi9-minimal:latest 2 | ENV JAVA_HOME=/usr 3 | 4 | # gather pre-requisite packages 5 | RUN microdnf install -y gzip java-11 procps shadow-utils tar util-linux && \ 6 | microdnf clean all 7 | 8 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 9 | NEO4J_SHA256=%%NEO4J_SHA%% \ 10 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 11 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 12 | NEO4J_HOME="/var/lib/neo4j" \ 13 | LANG=C.UTF-8 14 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 15 | 16 | COPY ./local-package/* /startup/ 17 | 18 | RUN set -eux; \ 19 | groupadd --gid 7474 --system neo4j; \ 20 | useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 21 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 22 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 23 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 24 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 25 | rm ${NEO4J_TARBALL}; \ 26 | rm ${NEO4J_HOME}/bin/neo4j; \ 27 | mv "${NEO4J_HOME}"/data /data; \ 28 | chown -R neo4j:neo4j /data; \ 29 | chmod -R 777 /data; \ 30 | mkdir -p /backups; \ 31 | chown -R neo4j:neo4j /backups; \ 32 | chmod -R 777 /backups; \ 33 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 34 | chmod -R 777 "${NEO4J_HOME}"; \ 35 | chmod -R 755 "${NEO4J_HOME}/bin"; \ 36 | ln -s /data "${NEO4J_HOME}"/data; \ 37 | ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh 38 | 39 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 40 | VOLUME /data /backups 41 | WORKDIR "${NEO4J_HOME}" 42 | 43 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 44 | CMD ["neo4j-admin"] 45 | -------------------------------------------------------------------------------- /docker-image-src/4.4/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | # load useful utility functions 4 | . /startup/utilities.sh 5 | 6 | function check_mounted_folder_writable_with_chown 7 | { 8 | local mountFolder=${1} 9 | debug_msg "checking ${mountFolder} is writable" 10 | if running_as_root; then 11 | # check folder permissions 12 | if ! is_writable "${mountFolder}" ; then 13 | # warn that we're about to chown the folder and then chown it 14 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 15 | chown -R "${userid}":"${groupid}" "${mountFolder}" 16 | # check permissions on files in the folder 17 | elif [ $(${exec_cmd} find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 18 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 19 | chown -R "${userid}":"${groupid}" "${mountFolder}" 20 | fi 21 | else 22 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 23 | print_permissions_advice_and_fail "${mountFolder}" 24 | fi 25 | fi 26 | } 27 | 28 | # ==== SETUP WHICH USER TO RUN AS ==== 29 | debug_msg "DEBUGGING ENABLED" 30 | 31 | if running_as_root; then 32 | userid="neo4j" 33 | groupid="neo4j" 34 | groups=($(id -G neo4j)) 35 | exec_cmd="runuser -p -u neo4j -g neo4j --" 36 | debug_msg "Running as root user inside neo4j-admin image" 37 | else 38 | userid="$(id -u)" 39 | groupid="$(id -g)" 40 | groups=($(id -G)) 41 | exec_cmd="exec" 42 | debug_msg "Running as user ${userid} inside neo4j-admin image" 43 | fi 44 | 45 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 46 | debug_msg "checking neo4j was not requested" 47 | if [[ "${1}" == "neo4j" ]]; then 48 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 49 | echo >&2 " 50 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 51 | If you wish to start a Neo4j database, use: 52 | 53 | docker run ${correct_image} 54 | " 55 | exit 1 56 | fi 57 | 58 | # ==== MAKE SURE NEO4J-ADMIN REPORT CANNOT BE RUN FROM THIS CONTAINER ==== 59 | debug_msg "checking neo4j-admin report was not requested" 60 | # maybe make sure the command is neo4j-admin server report rather than just anything mentioning reports? 61 | if containsElement "report" "${@}"; then 62 | echo >&2 \ 63 | "neo4j-admin report must be run in the same container as neo4j 64 | otherwise the report tool cannot access relevant files and processes required for generating the report. 65 | 66 | To run the report tool inside a neo4j container, do: 67 | 68 | docker exec neo4j-admin-report 69 | 70 | " 71 | exit 1 72 | fi 73 | 74 | 75 | # ==== CHECK LICENSE AGREEMENT ==== 76 | 77 | debug_msg "checking license" 78 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 79 | if [ "${NEO4J_ACCEPT_LICENSE_AGREEMENT:=no}" != "yes" ]; then 80 | echo >&2 " 81 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 82 | 83 | The license agreement is available at https://neo4j.com/terms/licensing/ 84 | If you have a support contract the following terms apply https://neo4j.com/terms/support-terms/ 85 | 86 | (c) Neo4j Sweden AB. All Rights Reserved. 87 | Use of this Software without a proper commercial license 88 | with Neo4j, Inc. or its affiliates is prohibited. 89 | Neo4j has the right to terminate your usage if you are not compliant. 90 | 91 | More information is also available at: https://neo4j.com/licensing/ 92 | If you have further inquiries about licensing, please contact us via https://neo4j.com/contact-us/ 93 | 94 | To accept the commercial license agreement set the environment variable 95 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 96 | 97 | To do this you can use the following docker argument: 98 | 99 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 100 | " 101 | exit 1 102 | fi 103 | fi 104 | 105 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 106 | debug_msg "Checking for mounted folder writability" 107 | 108 | if [ -d /data ]; then 109 | check_mounted_folder_writable_with_chown "/data" 110 | if [ -d /data/databases ]; then 111 | check_mounted_folder_writable_with_chown "/data/databases" 112 | fi 113 | if [ -d /data/dbms ]; then 114 | check_mounted_folder_writable_with_chown "/data/dbms" 115 | fi 116 | if [ -d /data/transactions ]; then 117 | check_mounted_folder_writable_with_chown "/data/transactions" 118 | fi 119 | fi 120 | if [ -d /backups ]; then 121 | check_mounted_folder_writable_with_chown "/backups" 122 | fi 123 | 124 | # ==== START NEO4J-ADMIN COMMAND ==== 125 | if debugging_enabled; then 126 | echo ${exec_cmd} "${@}" --verbose 127 | ${exec_cmd} "${@}" --verbose 128 | else 129 | ${exec_cmd} "${@}" 130 | fi 131 | -------------------------------------------------------------------------------- /docker-image-src/5/coredb/Dockerfile-debian: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" \ 9 | LANG=C.UTF-8 10 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 11 | 12 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 13 | 14 | COPY ./local-package/* /startup/ 15 | 16 | RUN apt-get update \ 17 | && apt-get install --no-install-recommends -o Acquire::Retries=10 -y \ 18 | curl ca-certificates gcc libc-dev git jq make procps tini wget \ 19 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 20 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 21 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 22 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 23 | && rm ${NEO4J_TARBALL} \ 24 | && sed -i 's/Package Type:.*/Package Type: docker bullseye/' $NEO4J_HOME/packaging_info \ 25 | && mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report \ 26 | && mv "${NEO4J_HOME}"/data /data \ 27 | && mv "${NEO4J_HOME}"/logs /logs \ 28 | && chown -R neo4j:neo4j /data \ 29 | && chmod -R 777 /data \ 30 | && chown -R neo4j:neo4j /logs \ 31 | && chmod -R 777 /logs \ 32 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 33 | && chmod -R 777 "${NEO4J_HOME}" \ 34 | && chmod -R 755 "${NEO4J_HOME}/bin" \ 35 | && ln -s /data "${NEO4J_HOME}"/data \ 36 | && ln -s /logs "${NEO4J_HOME}"/logs \ 37 | && git clone https://github.com/ncopa/su-exec.git \ 38 | && cd su-exec \ 39 | && git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af \ 40 | && echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c \ 41 | && echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c \ 42 | && make \ 43 | && mv /su-exec/su-exec /usr/bin/su-exec \ 44 | && apt-get -y purge --auto-remove curl gcc git make libc-dev \ 45 | && rm -rf /var/lib/apt/lists/* /su-exec 46 | 47 | 48 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 49 | 50 | WORKDIR "${NEO4J_HOME}" 51 | 52 | VOLUME /data /logs 53 | 54 | EXPOSE 7474 7473 7687 55 | 56 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 57 | CMD ["neo4j"] 58 | -------------------------------------------------------------------------------- /docker-image-src/5/coredb/Dockerfile-ubi8: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi8-minimal:latest 2 | ENV JAVA_HOME=/usr 3 | 4 | # gather pre-requisite packages 5 | RUN set -eux; \ 6 | arch="$(uname -m)"; \ 7 | case "${arch}" in \ 8 | 'x86_64') \ 9 | tiniurl="https://github.com/krallin/tini/releases/download/v0.19.0/tini"; \ 10 | tinisha="93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c"; \ 11 | ;; \ 12 | 'aarch64') \ 13 | tiniurl="https://github.com/krallin/tini/releases/download/v0.19.0/tini-arm64"; \ 14 | tinisha="07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81"; \ 15 | ;; \ 16 | *) echo >&2 "Neo4j does not currently have a docker image for architecture $arch"; exit 1 ;; \ 17 | esac; \ 18 | microdnf install -y dnf; \ 19 | dnf install -y \ 20 | findutils \ 21 | gcc \ 22 | git \ 23 | gzip \ 24 | hostname \ 25 | java-17 \ 26 | jq \ 27 | make \ 28 | procps \ 29 | shadow-utils \ 30 | tar \ 31 | wget \ 32 | which; \ 33 | wget -q ${tiniurl} -O /usr/bin/tini; \ 34 | wget -q ${tiniurl}.asc -O tini.asc; \ 35 | echo "${tinisha}" /usr/bin/tini | sha256sum -c --strict --quiet; \ 36 | chmod a+x /usr/bin/tini; \ 37 | export GNUPGHOME="$(mktemp -d)"; \ 38 | gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys \ 39 | 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ 40 | B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 41 | gpg --batch --verify tini.asc /usr/bin/tini; \ 42 | git clone https://github.com/ncopa/su-exec.git; \ 43 | cd su-exec; \ 44 | git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af; \ 45 | echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c; \ 46 | echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c; \ 47 | make; \ 48 | mv /su-exec/su-exec /usr/bin/su-exec; \ 49 | gpgconf --kill all; \ 50 | rm -rf "$GNUPGHOME" tini.asc /su-exec; \ 51 | dnf remove -y gcc git make; \ 52 | dnf autoremove; \ 53 | dnf clean all 54 | 55 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 56 | NEO4J_SHA256=%%NEO4J_SHA%% \ 57 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 58 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 59 | NEO4J_HOME="/var/lib/neo4j" 60 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 61 | 62 | COPY ./local-package/* /startup/ 63 | 64 | RUN set -eux; \ 65 | groupadd --gid 7474 --system neo4j && useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 66 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 67 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 68 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 69 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 70 | rm ${NEO4J_TARBALL}; \ 71 | sed -i 's/Package Type:.*/Package Type: docker ubi8/' $NEO4J_HOME/packaging_info; \ 72 | mv "${NEO4J_HOME}"/data /data; \ 73 | mv "${NEO4J_HOME}"/logs /logs; \ 74 | chown -R neo4j:neo4j /data; \ 75 | chmod -R 777 /data; \ 76 | chown -R neo4j:neo4j /logs; \ 77 | chmod -R 777 /logs; \ 78 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 79 | chmod -R 777 "${NEO4J_HOME}"; \ 80 | ln -s /data "${NEO4J_HOME}"/data; \ 81 | ln -s /logs "${NEO4J_HOME}"/logs; \ 82 | mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report 83 | 84 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 85 | 86 | WORKDIR "${NEO4J_HOME}" 87 | 88 | VOLUME /data /logs 89 | 90 | EXPOSE 7474 7473 7687 91 | 92 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 93 | CMD ["neo4j"] 94 | -------------------------------------------------------------------------------- /docker-image-src/5/coredb/Dockerfile-ubi9: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi9-minimal:latest 2 | 3 | # gather pre-requisite packages 4 | RUN set -eux; \ 5 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 6 | case "${arch}" in \ 7 | 'x86_64') \ 8 | tini_url="https://github.com/krallin/tini/releases/download/v0.19.0/tini"; \ 9 | tini_sha="93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c"; \ 10 | ;; \ 11 | 'aarch64') \ 12 | tini_url="https://github.com/krallin/tini/releases/download/v0.19.0/tini-arm64"; \ 13 | tini_sha="07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81"; \ 14 | ;; \ 15 | *) echo >&2 "Neo4j does not currently have a docker image for architecture $arch"; exit 1 ;; \ 16 | esac; \ 17 | microdnf install -y --nodocs \ 18 | findutils \ 19 | gcc \ 20 | git \ 21 | gzip \ 22 | hostname \ 23 | java-17-openjdk-headless \ 24 | jq \ 25 | make \ 26 | procps \ 27 | shadow-utils \ 28 | tar \ 29 | wget \ 30 | which; \ 31 | # download tini and openssl 32 | wget -q ${tini_url} -O /usr/bin/tini; \ 33 | wget -q ${tini_url}.asc -O tini.asc; \ 34 | echo "${tini_sha}" /usr/bin/tini | sha256sum -c --strict --quiet; \ 35 | chmod a+x /usr/bin/tini; \ 36 | export GNUPGHOME="$(mktemp -d)"; \ 37 | gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys \ 38 | 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ 39 | B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 40 | gpg --batch --verify tini.asc /usr/bin/tini; \ 41 | git clone https://github.com/ncopa/su-exec.git; \ 42 | cd su-exec; \ 43 | git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af; \ 44 | echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c; \ 45 | echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c; \ 46 | make; \ 47 | mv /su-exec/su-exec /usr/bin/su-exec; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /tini.asc /su-exec; \ 50 | microdnf remove -y git* perl* make gcc glibc-headers glibc-devel libxcrypt-devel; \ 51 | microdnf clean all 52 | 53 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 54 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 55 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 56 | NEO4J_HOME="/var/lib/neo4j" \ 57 | LANG=C.UTF-8 58 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 59 | 60 | COPY ./local-package/* /startup/ 61 | 62 | RUN set -eux; \ 63 | groupadd --gid 7474 --system neo4j && useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 64 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 65 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 66 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 67 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 68 | rm ${NEO4J_TARBALL}; \ 69 | sed -i 's/Package Type:.*/Package Type: docker ubi9/' $NEO4J_HOME/packaging_info; \ 70 | mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report; \ 71 | mv "${NEO4J_HOME}"/data /data; \ 72 | mv "${NEO4J_HOME}"/logs /logs; \ 73 | chown -R neo4j:neo4j /data; \ 74 | chmod -R 777 /data; \ 75 | chown -R neo4j:neo4j /logs; \ 76 | chmod -R 777 /logs; \ 77 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 78 | chmod -R 777 "${NEO4J_HOME}"; \ 79 | chmod -R 755 "${NEO4J_HOME}/bin"; \ 80 | ln -s /data "${NEO4J_HOME}"/data; \ 81 | ln -s /logs "${NEO4J_HOME}"/logs 82 | 83 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 84 | 85 | WORKDIR "${NEO4J_HOME}" 86 | 87 | VOLUME /data /logs 88 | 89 | EXPOSE 7474 7473 7687 90 | 91 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 92 | CMD ["neo4j"] 93 | -------------------------------------------------------------------------------- /docker-image-src/5/coredb/neo4j-admin-report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # load useful utility functions 4 | . /startup/utilities.sh 5 | 6 | function find_report_destination 7 | { 8 | local to_flag="--to-path" 9 | 10 | while [[ $# -gt 0 ]]; do 11 | case $1 in 12 | # for arg in "$@"; do 13 | # case $arg in 14 | "${to_flag}"=*) 15 | echo ${1#*=} 16 | return 17 | ;; 18 | "${to_flag}") 19 | echo ${2} 20 | return 21 | ;; 22 | *) 23 | shift 24 | ;; 25 | esac 26 | done 27 | mkdir -p /tmp/reports 28 | echo "/tmp/reports" 29 | } 30 | 31 | report_cmd=("neo4j-admin" "server" "report") 32 | 33 | # note, these debug messages are unlikely to work in a docker exec, since environment isn't preserved. 34 | debug_msg "Called ${0}" 35 | debug_msg "neo4j-admin report command is:" "${report_cmd[@]}" "$@" 36 | 37 | # find report destination. This could be specified by argument to neo4j-admin or it could be the default location. 38 | report_destination=$(find_report_destination "$@") 39 | debug_msg "report_destination will be ${report_destination}" 40 | 41 | debug_msg "Determining which user to run neo4j-admin as." 42 | if running_as_root; then 43 | debug_msg "running neo4j-admin report as root" 44 | if [[ ! $(su-exec neo4j:neo4j test -w "${report_destination}") ]]; then 45 | debug_msg "reowning ${report_destination} to neo4j:neo4j" 46 | chown neo4j:neo4j "${report_destination}" 47 | fi 48 | debug_msg su-exec neo4j:neo4j "${report_cmd[@]}" "$@" 49 | su-exec neo4j:neo4j "${report_cmd[@]}" "$@" 50 | else 51 | debug_msg "running neo4j-admin report as user defined by --user flag" 52 | if [[ ! -w "${report_destination}" ]]; then 53 | print_permissions_advice_and_fail "${report_destination}" "$(id -u)" "$(id -g)" 54 | fi 55 | debug_msg "${report_cmd[@]}" "$@" 56 | "${report_cmd[@]}" "$@" 57 | fi -------------------------------------------------------------------------------- /docker-image-src/5/coredb/neo4j-plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "apoc-extended": { 3 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 4 | "properties": { 5 | "dbms.security.procedures.unrestricted": "apoc.*" 6 | } 7 | }, 8 | "apoc": { 9 | "location": "/var/lib/neo4j/labs/apoc-*-core.jar", 10 | "versions": "https://neo4j.github.io/apoc/versions.json", 11 | "properties": { 12 | "dbms.security.procedures.unrestricted": "apoc.*" 13 | } 14 | }, 15 | "bloom": { 16 | "location": "/var/lib/neo4j/products/bloom-plugin-*.jar", 17 | "versions": "https://bloom-plugins.s3.eu-west-2.amazonaws.com/versions.json", 18 | "properties": { 19 | "server.unmanaged_extension_classes": "com.neo4j.bloom.server=/browser/bloom", 20 | "dbms.security.procedures.unrestricted": "bloom.*", 21 | "dbms.bloom.license_file": "/licenses/bloom.license" 22 | } 23 | }, 24 | "graph-data-science": { 25 | "versions": "https://graphdatascience.ninja/versions.json", 26 | "location": "/var/lib/neo4j/products/neo4j-graph-data-science-*.jar", 27 | "properties": { 28 | "dbms.security.procedures.unrestricted": "gds.*" 29 | } 30 | }, 31 | "n10s": { 32 | "versions": "https://neo4j-labs.github.io/neosemantics/versions.json", 33 | "properties": { 34 | "dbms.security.procedures.unrestricted":"semantics.*" 35 | } 36 | }, 37 | "genai": { 38 | "location": "/var/lib/neo4j/products/neo4j-genai-plugin-*.jar", 39 | "properties": { 40 | "dbms.security.procedures.unrestricted": "genai.*" 41 | } 42 | }, 43 | "_testing": { 44 | "versions": "http://host.testcontainers.internal:3000/versions.json", 45 | "properties": { 46 | "dbms.security.procedures.unrestricted": "com.neo4j.docker.neo4jserver.plugins.*" 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /docker-image-src/5/neo4j-admin/Dockerfile-debian: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" \ 9 | LANG=C.UTF-8 10 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 11 | 12 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 13 | 14 | COPY ./local-package/* /startup/ 15 | 16 | RUN apt-get update \ 17 | && apt-get install --no-install-recommends -o Acquire::Retries=10 -y \ 18 | curl ca-certificates procps \ 19 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 20 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 21 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 22 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 23 | && rm ${NEO4J_TARBALL} \ 24 | && rm ${NEO4J_HOME}/bin/neo4j \ 25 | && mv "${NEO4J_HOME}"/data /data \ 26 | && chown -R neo4j:neo4j /data \ 27 | && chmod -R 777 /data \ 28 | && mkdir -p /backups \ 29 | && chown -R neo4j:neo4j /backups \ 30 | && chmod -R 777 /backups \ 31 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 32 | && chmod -R 777 "${NEO4J_HOME}" \ 33 | && chmod -R 755 "${NEO4J_HOME}/bin" \ 34 | && ln -s /data "${NEO4J_HOME}"/data \ 35 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 36 | && rm -rf /tmp/* \ 37 | && rm -rf /var/lib/apt/lists/* \ 38 | && apt-get -y purge --auto-remove curl 39 | 40 | 41 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 42 | VOLUME /data /backups 43 | WORKDIR "${NEO4J_HOME}" 44 | 45 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 46 | 47 | CMD ["neo4j-admin"] 48 | -------------------------------------------------------------------------------- /docker-image-src/5/neo4j-admin/Dockerfile-ubi8: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi8-minimal:latest 2 | ENV JAVA_HOME=/usr 3 | 4 | # gather pre-requisite packages 5 | RUN microdnf install -y gzip java-17 procps shadow-utils tar util-linux && \ 6 | microdnf clean all 7 | 8 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 9 | NEO4J_SHA256=%%NEO4J_SHA%% \ 10 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 11 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 12 | NEO4J_HOME="/var/lib/neo4j" 13 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 14 | 15 | COPY ./local-package/* /startup/ 16 | 17 | RUN set -eux; \ 18 | groupadd --gid 7474 --system neo4j; \ 19 | useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 20 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 21 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 22 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 23 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 24 | rm ${NEO4J_TARBALL}; \ 25 | rm ${NEO4J_HOME}/bin/neo4j; \ 26 | mv "${NEO4J_HOME}"/data /data; \ 27 | chown -R neo4j:neo4j /data; \ 28 | chmod -R 777 /data; \ 29 | mkdir -p /backups; \ 30 | chown -R neo4j:neo4j /backups; \ 31 | chmod -R 777 /backups; \ 32 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 33 | chmod -R 777 "${NEO4J_HOME}"; \ 34 | ln -s /data "${NEO4J_HOME}"/data; \ 35 | ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh 36 | 37 | ENV PATH "${NEO4J_HOME}"/bin:$PATH 38 | VOLUME /data /backups 39 | WORKDIR "${NEO4J_HOME}" 40 | 41 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 42 | CMD ["neo4j-admin"] 43 | -------------------------------------------------------------------------------- /docker-image-src/5/neo4j-admin/Dockerfile-ubi9: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi9-minimal:latest 2 | ENV JAVA_HOME=/usr 3 | 4 | # gather pre-requisite packages 5 | RUN microdnf install -y --nodocs gzip java-17 procps shadow-utils tar util-linux && \ 6 | microdnf clean all 7 | 8 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 9 | NEO4J_SHA256=%%NEO4J_SHA%% \ 10 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 11 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 12 | NEO4J_HOME="/var/lib/neo4j" \ 13 | LANG=C.UTF-8 14 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 15 | 16 | COPY ./local-package/* /startup/ 17 | 18 | RUN set -eux; \ 19 | groupadd --gid 7474 --system neo4j; \ 20 | useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 21 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 22 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 23 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 24 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 25 | rm ${NEO4J_TARBALL}; \ 26 | rm ${NEO4J_HOME}/bin/neo4j; \ 27 | mv "${NEO4J_HOME}"/data /data; \ 28 | chown -R neo4j:neo4j /data; \ 29 | chmod -R 777 /data; \ 30 | mkdir -p /backups; \ 31 | chown -R neo4j:neo4j /backups; \ 32 | chmod -R 777 /backups; \ 33 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 34 | chmod -R 777 "${NEO4J_HOME}"; \ 35 | chmod -R 755 "${NEO4J_HOME}/bin"; \ 36 | ln -s /data "${NEO4J_HOME}"/data; \ 37 | ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh 38 | 39 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 40 | VOLUME /data /backups 41 | WORKDIR "${NEO4J_HOME}" 42 | 43 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 44 | CMD ["neo4j-admin"] 45 | -------------------------------------------------------------------------------- /docker-image-src/5/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | # load useful utility functions 4 | . /startup/utilities.sh 5 | 6 | function check_mounted_folder_writable_with_chown 7 | { 8 | local mountFolder=${1} 9 | debug_msg "checking ${mountFolder} is writable" 10 | if running_as_root; then 11 | # check folder permissions 12 | if ! is_writable "${mountFolder}" ; then 13 | # warn that we're about to chown the folder and then chown it 14 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 15 | chown -R "${userid}":"${groupid}" "${mountFolder}" 16 | # check permissions on files in the folder 17 | elif [ $(${exec_cmd} find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 18 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 19 | chown -R "${userid}":"${groupid}" "${mountFolder}" 20 | fi 21 | else 22 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 23 | print_permissions_advice_and_fail "${mountFolder}" "${userid}" "${groupid}" 24 | fi 25 | fi 26 | } 27 | 28 | # ==== SETUP WHICH USER TO RUN AS ==== 29 | debug_msg "DEBUGGING ENABLED" 30 | 31 | if running_as_root; then 32 | userid="neo4j" 33 | groupid="neo4j" 34 | groups=($(id -G neo4j)) 35 | exec_cmd="runuser -p -u neo4j -g neo4j --" 36 | debug_msg "Running as root user inside neo4j-admin image" 37 | else 38 | userid="$(id -u)" 39 | groupid="$(id -g)" 40 | groups=($(id -G)) 41 | exec_cmd="exec" 42 | debug_msg "Running as user ${userid} inside neo4j-admin image" 43 | fi 44 | 45 | #%%DEPRECATION_WARNING_PLACEHOLDER%% 46 | 47 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 48 | debug_msg "checking neo4j was not requested" 49 | if [[ "${1}" == "neo4j" ]]; then 50 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 51 | echo >&2 " 52 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 53 | If you wish to start a Neo4j database, use: 54 | 55 | docker run ${correct_image} 56 | " 57 | exit 1 58 | fi 59 | 60 | # ==== MAKE SURE NEO4J-ADMIN REPORT CANNOT BE RUN FROM THIS CONTAINER ==== 61 | debug_msg "checking neo4j-admin report was not requested" 62 | # maybe make sure the command is neo4j-admin server report rather than just anything mentioning reports? 63 | if containsElement "report" "${@}"; then 64 | echo >&2 \ 65 | "neo4j-admin report must be run in the same container as neo4j 66 | otherwise the report tool cannot access relevant files and processes required for generating the report. 67 | 68 | To run the report tool inside a neo4j container, do: 69 | 70 | docker exec neo4j-admin-report 71 | 72 | " 73 | exit 1 74 | fi 75 | 76 | 77 | # ==== CHECK LICENSE AGREEMENT ==== 78 | 79 | debug_msg "checking license" 80 | # Only prompt for license agreement if command contains "neo4j" in it 81 | if [[ "${1}" == *"neo4j"* ]]; then 82 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 83 | : ${NEO4J_ACCEPT_LICENSE_AGREEMENT:="not accepted"} 84 | if [[ "$NEO4J_ACCEPT_LICENSE_AGREEMENT" != "yes" && "$NEO4J_ACCEPT_LICENSE_AGREEMENT" != "eval" ]]; then 85 | echo >&2 " 86 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 87 | 88 | The license agreement is available at https://neo4j.com/terms/licensing/ 89 | If you have a support contract the following terms apply https://neo4j.com/terms/support-terms/ 90 | 91 | If you do not have a commercial license and want to evaluate the Software 92 | please read the terms of the evaluation agreement before you accept. 93 | https://neo4j.com/terms/enterprise_us/ 94 | 95 | (c) Neo4j Sweden AB. All Rights Reserved. 96 | Use of this Software without a proper commercial license, or evaluation license 97 | with Neo4j, Inc. or its affiliates is prohibited. 98 | Neo4j has the right to terminate your usage if you are not compliant. 99 | 100 | More information is also available at: https://neo4j.com/licensing/ 101 | If you have further inquiries about licensing, please contact us via https://neo4j.com/contact-us/ 102 | 103 | To accept the commercial license agreement set the environment variable 104 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 105 | 106 | To accept the terms of the evaluation agreement set the environment variable 107 | NEO4J_ACCEPT_LICENSE_AGREEMENT=eval 108 | 109 | To do this you can use the following docker argument: 110 | 111 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT= 112 | " 113 | exit 1 114 | fi 115 | fi 116 | fi 117 | 118 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 119 | debug_msg "Checking for mounted folder writability" 120 | 121 | if [ -d /data ]; then 122 | check_mounted_folder_writable_with_chown "/data" 123 | if [ -d /data/databases ]; then 124 | check_mounted_folder_writable_with_chown "/data/databases" 125 | fi 126 | if [ -d /data/dbms ]; then 127 | check_mounted_folder_writable_with_chown "/data/dbms" 128 | fi 129 | if [ -d /data/transactions ]; then 130 | check_mounted_folder_writable_with_chown "/data/transactions" 131 | fi 132 | fi 133 | if [ -d /backups ]; then 134 | check_mounted_folder_writable_with_chown "/backups" 135 | fi 136 | 137 | # ==== START NEO4J-ADMIN COMMAND ==== 138 | if debugging_enabled; then 139 | echo ${exec_cmd} "${@}" --verbose 140 | ${exec_cmd} "${@}" --verbose 141 | else 142 | ${exec_cmd} "${@}" 143 | fi 144 | -------------------------------------------------------------------------------- /docker-image-src/calver/coredb/Dockerfile-debian: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" \ 9 | LANG=C.UTF-8 10 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 11 | 12 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 13 | 14 | COPY ./local-package/* /startup/ 15 | 16 | RUN apt-get update \ 17 | && apt-get install --no-install-recommends -o Acquire::Retries=10 -y \ 18 | curl ca-certificates gcc libc-dev git jq make procps tini wget \ 19 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 20 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 21 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 22 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 23 | && rm ${NEO4J_TARBALL} \ 24 | && sed -i 's/Package Type:.*/Package Type: docker bullseye/' $NEO4J_HOME/packaging_info \ 25 | && mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report \ 26 | && mv "${NEO4J_HOME}"/data /data \ 27 | && mv "${NEO4J_HOME}"/logs /logs \ 28 | && chown -R neo4j:neo4j /data \ 29 | && chmod -R 777 /data \ 30 | && chown -R neo4j:neo4j /logs \ 31 | && chmod -R 777 /logs \ 32 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 33 | && chmod -R 777 "${NEO4J_HOME}" \ 34 | && chmod -R 755 "${NEO4J_HOME}/bin" \ 35 | && ln -s /data "${NEO4J_HOME}"/data \ 36 | && ln -s /logs "${NEO4J_HOME}"/logs \ 37 | && git clone https://github.com/ncopa/su-exec.git \ 38 | && cd su-exec \ 39 | && git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af \ 40 | && echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c \ 41 | && echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c \ 42 | && make \ 43 | && mv /su-exec/su-exec /usr/bin/su-exec \ 44 | && apt-get -y purge --auto-remove curl gcc git make libc-dev \ 45 | && rm -rf /var/lib/apt/lists/* /su-exec 46 | 47 | 48 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 49 | 50 | WORKDIR "${NEO4J_HOME}" 51 | 52 | VOLUME /data /logs 53 | 54 | EXPOSE 7474 7473 7687 55 | 56 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 57 | CMD ["neo4j"] 58 | -------------------------------------------------------------------------------- /docker-image-src/calver/coredb/Dockerfile-ubi9: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi9-minimal:latest 2 | 3 | # gather pre-requisite packages 4 | RUN set -eux; \ 5 | arch="$(rpm --query --queryformat='%{ARCH}' rpm)"; \ 6 | case "${arch}" in \ 7 | 'x86_64') \ 8 | tini_url="https://github.com/krallin/tini/releases/download/v0.19.0/tini"; \ 9 | tini_sha="93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c"; \ 10 | ;; \ 11 | 'aarch64') \ 12 | tini_url="https://github.com/krallin/tini/releases/download/v0.19.0/tini-arm64"; \ 13 | tini_sha="07952557df20bfd2a95f9bef198b445e006171969499a1d361bd9e6f8e5e0e81"; \ 14 | ;; \ 15 | *) echo >&2 "Neo4j does not currently have a docker image for architecture $arch"; exit 1 ;; \ 16 | esac; \ 17 | microdnf install -y --nodocs \ 18 | findutils \ 19 | gcc \ 20 | git \ 21 | gzip \ 22 | hostname \ 23 | java-21-openjdk-headless \ 24 | jq \ 25 | make \ 26 | procps \ 27 | shadow-utils \ 28 | tar \ 29 | wget \ 30 | which; \ 31 | # download tini and openssl 32 | wget -q ${tini_url} -O /usr/bin/tini; \ 33 | wget -q ${tini_url}.asc -O tini.asc; \ 34 | echo "${tini_sha}" /usr/bin/tini | sha256sum -c --strict --quiet; \ 35 | chmod a+x /usr/bin/tini; \ 36 | export GNUPGHOME="$(mktemp -d)"; \ 37 | gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys \ 38 | 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ 39 | B42F6819007F00F88E364FD4036A9C25BF357DD4; \ 40 | gpg --batch --verify tini.asc /usr/bin/tini; \ 41 | git clone https://github.com/ncopa/su-exec.git; \ 42 | cd su-exec; \ 43 | git checkout 4c3bb42b093f14da70d8ab924b487ccfbb1397af; \ 44 | echo d6c40440609a23483f12eb6295b5191e94baf08298a856bab6e15b10c3b82891 su-exec.c | sha256sum -c; \ 45 | echo 2a87af245eb125aca9305a0b1025525ac80825590800f047419dc57bba36b334 Makefile | sha256sum -c; \ 46 | make; \ 47 | mv /su-exec/su-exec /usr/bin/su-exec; \ 48 | gpgconf --kill all; \ 49 | rm -rf "$GNUPGHOME" /tini.asc /su-exec; \ 50 | microdnf remove -y git* perl* make gcc glibc-headers glibc-devel libxcrypt-devel; \ 51 | microdnf clean all 52 | 53 | ENV NEO4J_SHA256=%%NEO4J_SHA%% \ 54 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 55 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 56 | NEO4J_HOME="/var/lib/neo4j" \ 57 | LANG=C.UTF-8 58 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 59 | 60 | COPY ./local-package/* /startup/ 61 | 62 | RUN set -eux; \ 63 | groupadd --gid 7474 --system neo4j && useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 64 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 65 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 66 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 67 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 68 | rm ${NEO4J_TARBALL}; \ 69 | sed -i 's/Package Type:.*/Package Type: docker ubi9/' $NEO4J_HOME/packaging_info; \ 70 | mv /startup/neo4j-admin-report.sh "${NEO4J_HOME}"/bin/neo4j-admin-report; \ 71 | mv "${NEO4J_HOME}"/data /data; \ 72 | mv "${NEO4J_HOME}"/logs /logs; \ 73 | chown -R neo4j:neo4j /data; \ 74 | chmod -R 777 /data; \ 75 | chown -R neo4j:neo4j /logs; \ 76 | chmod -R 777 /logs; \ 77 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 78 | chmod -R 777 "${NEO4J_HOME}"; \ 79 | chmod -R 755 "${NEO4J_HOME}/bin"; \ 80 | ln -s /data "${NEO4J_HOME}"/data; \ 81 | ln -s /logs "${NEO4J_HOME}"/logs 82 | 83 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 84 | 85 | WORKDIR "${NEO4J_HOME}" 86 | 87 | VOLUME /data /logs 88 | 89 | EXPOSE 7474 7473 7687 90 | 91 | ENTRYPOINT ["tini", "-g", "--", "/startup/docker-entrypoint.sh"] 92 | CMD ["neo4j"] 93 | -------------------------------------------------------------------------------- /docker-image-src/calver/coredb/neo4j-admin-report.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # load useful utility functions 4 | . /startup/utilities.sh 5 | 6 | function find_report_destination 7 | { 8 | local to_flag="--to-path" 9 | 10 | while [[ $# -gt 0 ]]; do 11 | case $1 in 12 | # for arg in "$@"; do 13 | # case $arg in 14 | "${to_flag}"=*) 15 | echo ${1#*=} 16 | return 17 | ;; 18 | "${to_flag}") 19 | echo ${2} 20 | return 21 | ;; 22 | *) 23 | shift 24 | ;; 25 | esac 26 | done 27 | mkdir -p /tmp/reports 28 | echo "/tmp/reports" 29 | } 30 | 31 | report_cmd=("neo4j-admin" "server" "report") 32 | 33 | # note, these debug messages are unlikely to work in a docker exec, since environment isn't preserved. 34 | debug_msg "Called ${0}" 35 | debug_msg "neo4j-admin report command is:" "${report_cmd[@]}" "$@" 36 | 37 | # find report destination. This could be specified by argument to neo4j-admin or it could be the default location. 38 | report_destination=$(find_report_destination "$@") 39 | debug_msg "report_destination will be ${report_destination}" 40 | 41 | debug_msg "Determining which user to run neo4j-admin as." 42 | if running_as_root; then 43 | debug_msg "running neo4j-admin report as root" 44 | if [[ ! $(su-exec neo4j:neo4j test -w "${report_destination}") ]]; then 45 | debug_msg "reowning ${report_destination} to neo4j:neo4j" 46 | chown neo4j:neo4j "${report_destination}" 47 | fi 48 | debug_msg su-exec neo4j:neo4j "${report_cmd[@]}" "$@" 49 | su-exec neo4j:neo4j "${report_cmd[@]}" "$@" 50 | else 51 | debug_msg "running neo4j-admin report as user defined by --user flag" 52 | if [[ ! -w "${report_destination}" ]]; then 53 | print_permissions_advice_and_fail "${report_destination}" "$(id -u)" "$(id -g)" 54 | fi 55 | debug_msg "${report_cmd[@]}" "$@" 56 | "${report_cmd[@]}" "$@" 57 | fi -------------------------------------------------------------------------------- /docker-image-src/calver/coredb/neo4j-plugins.json: -------------------------------------------------------------------------------- 1 | { 2 | "apoc-extended": { 3 | "versions": "https://neo4j-contrib.github.io/neo4j-apoc-procedures/versions.json", 4 | "properties": { 5 | "dbms.security.procedures.unrestricted": "apoc.*" 6 | } 7 | }, 8 | "apoc": { 9 | "location": "/var/lib/neo4j/labs/apoc-*-core.jar", 10 | "versions": "https://neo4j.github.io/apoc/versions.json", 11 | "properties": { 12 | "dbms.security.procedures.unrestricted": "apoc.*" 13 | } 14 | }, 15 | "bloom": { 16 | "location": "/var/lib/neo4j/products/bloom-plugin-*.jar", 17 | "versions": "https://bloom-plugins.s3.eu-west-2.amazonaws.com/versions.json", 18 | "properties": { 19 | "server.unmanaged_extension_classes": "com.neo4j.bloom.server=/browser/bloom", 20 | "dbms.security.procedures.unrestricted": "bloom.*", 21 | "dbms.bloom.license_file": "/licenses/bloom.license" 22 | } 23 | }, 24 | "graph-data-science": { 25 | "versions": "https://graphdatascience.ninja/versions.json", 26 | "location": "/var/lib/neo4j/products/neo4j-graph-data-science-*.jar", 27 | "properties": { 28 | "dbms.security.procedures.unrestricted": "gds.*" 29 | } 30 | }, 31 | "genai": { 32 | "location": "/var/lib/neo4j/products/neo4j-genai-plugin-*.jar", 33 | "properties": { 34 | "dbms.security.procedures.unrestricted": "genai.*" 35 | } 36 | }, 37 | "_testing": { 38 | "versions": "http://host.testcontainers.internal:3000/versions.json", 39 | "properties": { 40 | "dbms.security.procedures.unrestricted": "com.neo4j.docker.neo4jserver.plugins.*" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /docker-image-src/calver/neo4j-admin/Dockerfile-debian: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye-slim 2 | ENV JAVA_HOME=/opt/java/openjdk 3 | COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME 4 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 5 | NEO4J_SHA256=%%NEO4J_SHA%% \ 6 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 7 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 8 | NEO4J_HOME="/var/lib/neo4j" \ 9 | LANG=C.UTF-8 10 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 11 | 12 | RUN addgroup --gid 7474 --system neo4j && adduser --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --ingroup neo4j neo4j 13 | 14 | COPY ./local-package/* /startup/ 15 | 16 | RUN apt-get update \ 17 | && apt-get install --no-install-recommends -o Acquire::Retries=10 -y \ 18 | curl ca-certificates procps \ 19 | && curl --fail --silent --show-error --location --remote-name ${NEO4J_URI} \ 20 | && echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet \ 21 | && tar --extract --file ${NEO4J_TARBALL} --directory /var/lib \ 22 | && mv /var/lib/neo4j-* "${NEO4J_HOME}" \ 23 | && rm ${NEO4J_TARBALL} \ 24 | && rm ${NEO4J_HOME}/bin/neo4j \ 25 | && mv "${NEO4J_HOME}"/data /data \ 26 | && chown -R neo4j:neo4j /data \ 27 | && chmod -R 777 /data \ 28 | && mkdir -p /backups \ 29 | && chown -R neo4j:neo4j /backups \ 30 | && chmod -R 777 /backups \ 31 | && chown -R neo4j:neo4j "${NEO4J_HOME}" \ 32 | && chmod -R 777 "${NEO4J_HOME}" \ 33 | && chmod -R 755 "${NEO4J_HOME}/bin" \ 34 | && ln -s /data "${NEO4J_HOME}"/data \ 35 | && ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh \ 36 | && rm -rf /tmp/* \ 37 | && rm -rf /var/lib/apt/lists/* \ 38 | && apt-get -y purge --auto-remove curl 39 | 40 | 41 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 42 | VOLUME /data /backups 43 | WORKDIR "${NEO4J_HOME}" 44 | 45 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 46 | 47 | CMD ["neo4j-admin"] 48 | -------------------------------------------------------------------------------- /docker-image-src/calver/neo4j-admin/Dockerfile-ubi9: -------------------------------------------------------------------------------- 1 | FROM redhat/ubi9-minimal:latest 2 | ENV JAVA_HOME=/usr 3 | 4 | # gather pre-requisite packages 5 | RUN microdnf install -y --nodocs gzip java-21 procps shadow-utils tar util-linux && \ 6 | microdnf clean all 7 | 8 | ENV PATH="${JAVA_HOME}/bin:${PATH}" \ 9 | NEO4J_SHA256=%%NEO4J_SHA%% \ 10 | NEO4J_TARBALL=%%NEO4J_TARBALL%% \ 11 | NEO4J_EDITION=%%NEO4J_EDITION%% \ 12 | NEO4J_HOME="/var/lib/neo4j" \ 13 | LANG=C.UTF-8 14 | ARG NEO4J_URI=%%NEO4J_DIST_SITE%%/%%NEO4J_TARBALL%% 15 | 16 | COPY ./local-package/* /startup/ 17 | 18 | RUN set -eux; \ 19 | groupadd --gid 7474 --system neo4j; \ 20 | useradd --uid 7474 --system --no-create-home --home "${NEO4J_HOME}" --gid neo4j neo4j; \ 21 | curl --fail --silent --show-error --location --remote-name ${NEO4J_URI}; \ 22 | echo "${NEO4J_SHA256} ${NEO4J_TARBALL}" | sha256sum -c --strict --quiet; \ 23 | tar --extract --file ${NEO4J_TARBALL} --directory /var/lib; \ 24 | mv /var/lib/neo4j-* "${NEO4J_HOME}"; \ 25 | rm ${NEO4J_TARBALL}; \ 26 | rm ${NEO4J_HOME}/bin/neo4j; \ 27 | mv "${NEO4J_HOME}"/data /data; \ 28 | chown -R neo4j:neo4j /data; \ 29 | chmod -R 777 /data; \ 30 | mkdir -p /backups; \ 31 | chown -R neo4j:neo4j /backups; \ 32 | chmod -R 777 /backups; \ 33 | chown -R neo4j:neo4j "${NEO4J_HOME}"; \ 34 | chmod -R 777 "${NEO4J_HOME}"; \ 35 | chmod -R 755 "${NEO4J_HOME}/bin"; \ 36 | ln -s /data "${NEO4J_HOME}"/data; \ 37 | ln -s /startup/docker-entrypoint.sh /docker-entrypoint.sh 38 | 39 | ENV PATH="${NEO4J_HOME}"/bin:$PATH 40 | VOLUME /data /backups 41 | WORKDIR "${NEO4J_HOME}" 42 | 43 | ENTRYPOINT ["/startup/docker-entrypoint.sh"] 44 | CMD ["neo4j-admin"] 45 | -------------------------------------------------------------------------------- /docker-image-src/calver/neo4j-admin/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | # load useful utility functions 4 | . /startup/utilities.sh 5 | 6 | function check_mounted_folder_writable_with_chown 7 | { 8 | local mountFolder=${1} 9 | debug_msg "checking ${mountFolder} is writable" 10 | if running_as_root; then 11 | # check folder permissions 12 | if ! is_writable "${mountFolder}" ; then 13 | # warn that we're about to chown the folder and then chown it 14 | echo "Warning: Folder mounted to \"${mountFolder}\" is not writable from inside container. Changing folder owner to ${userid}." 15 | chown -R "${userid}":"${groupid}" "${mountFolder}" 16 | # check permissions on files in the folder 17 | elif [ $(${exec_cmd} find "${mountFolder}" -not -writable | wc -l) -gt 0 ]; then 18 | echo "Warning: Some files inside \"${mountFolder}\" are not writable from inside container. Changing folder owner to ${userid}." 19 | chown -R "${userid}":"${groupid}" "${mountFolder}" 20 | fi 21 | else 22 | if [[ ! -w "${mountFolder}" ]] && [[ "$(stat -c %U ${mountFolder})" != "neo4j" ]]; then 23 | print_permissions_advice_and_fail "${mountFolder}" "${userid}" "${groupid}" 24 | fi 25 | fi 26 | } 27 | 28 | # ==== SETUP WHICH USER TO RUN AS ==== 29 | debug_msg "DEBUGGING ENABLED" 30 | 31 | if running_as_root; then 32 | userid="neo4j" 33 | groupid="neo4j" 34 | groups=($(id -G neo4j)) 35 | exec_cmd="runuser -p -u neo4j -g neo4j --" 36 | debug_msg "Running as root user inside neo4j-admin image" 37 | else 38 | userid="$(id -u)" 39 | groupid="$(id -g)" 40 | groups=($(id -G)) 41 | exec_cmd="exec" 42 | debug_msg "Running as user ${userid} inside neo4j-admin image" 43 | fi 44 | 45 | #%%DEPRECATION_WARNING_PLACEHOLDER%% 46 | 47 | # ==== MAKE SURE NEO4J CANNOT BE RUN FROM THIS CONTAINER ==== 48 | debug_msg "checking neo4j was not requested" 49 | if [[ "${1}" == "neo4j" ]]; then 50 | correct_image="neo4j:"$(neo4j-admin --version)"-${NEO4J_EDITION}" 51 | echo >&2 " 52 | This is a neo4j-admin only image, and usage of Neo4j server is not supported from here. 53 | If you wish to start a Neo4j database, use: 54 | 55 | docker run ${correct_image} 56 | " 57 | exit 1 58 | fi 59 | 60 | # ==== MAKE SURE NEO4J-ADMIN REPORT CANNOT BE RUN FROM THIS CONTAINER ==== 61 | debug_msg "checking neo4j-admin report was not requested" 62 | # maybe make sure the command is neo4j-admin server report rather than just anything mentioning reports? 63 | if containsElement "report" "${@}"; then 64 | echo >&2 \ 65 | "neo4j-admin report must be run in the same container as neo4j 66 | otherwise the report tool cannot access relevant files and processes required for generating the report. 67 | 68 | To run the report tool inside a neo4j container, do: 69 | 70 | docker exec neo4j-admin-report 71 | 72 | " 73 | exit 1 74 | fi 75 | 76 | 77 | # ==== CHECK LICENSE AGREEMENT ==== 78 | 79 | debug_msg "checking license" 80 | # Only prompt for license agreement if command contains "neo4j" in it 81 | if [[ "${1}" == *"neo4j"* ]]; then 82 | if [ "${NEO4J_EDITION}" == "enterprise" ]; then 83 | : ${NEO4J_ACCEPT_LICENSE_AGREEMENT:="not accepted"} 84 | if [[ "$NEO4J_ACCEPT_LICENSE_AGREEMENT" != "yes" && "$NEO4J_ACCEPT_LICENSE_AGREEMENT" != "eval" ]]; then 85 | echo >&2 " 86 | In order to use Neo4j Enterprise Edition you must accept the license agreement. 87 | 88 | The license agreement is available at https://neo4j.com/terms/licensing/ 89 | If you have a support contract the following terms apply https://neo4j.com/terms/support-terms/ 90 | 91 | If you do not have a commercial license and want to evaluate the Software 92 | please read the terms of the evaluation agreement before you accept. 93 | https://neo4j.com/terms/enterprise_us/ 94 | 95 | (c) Neo4j Sweden AB. All Rights Reserved. 96 | Use of this Software without a proper commercial license, or evaluation license 97 | with Neo4j, Inc. or its affiliates is prohibited. 98 | Neo4j has the right to terminate your usage if you are not compliant. 99 | 100 | More information is also available at: https://neo4j.com/licensing/ 101 | If you have further inquiries about licensing, please contact us via https://neo4j.com/contact-us/ 102 | 103 | To accept the commercial license agreement set the environment variable 104 | NEO4J_ACCEPT_LICENSE_AGREEMENT=yes 105 | 106 | To accept the terms of the evaluation agreement set the environment variable 107 | NEO4J_ACCEPT_LICENSE_AGREEMENT=eval 108 | 109 | To do this you can use the following docker argument: 110 | 111 | --env=NEO4J_ACCEPT_LICENSE_AGREEMENT= 112 | " 113 | exit 1 114 | fi 115 | fi 116 | fi 117 | 118 | # ==== ENSURE MOUNT FOLDER READ/WRITABILITY ==== 119 | debug_msg "Checking for mounted folder writability" 120 | 121 | if [ -d /data ]; then 122 | check_mounted_folder_writable_with_chown "/data" 123 | if [ -d /data/databases ]; then 124 | check_mounted_folder_writable_with_chown "/data/databases" 125 | fi 126 | if [ -d /data/dbms ]; then 127 | check_mounted_folder_writable_with_chown "/data/dbms" 128 | fi 129 | if [ -d /data/transactions ]; then 130 | check_mounted_folder_writable_with_chown "/data/transactions" 131 | fi 132 | fi 133 | if [ -d /backups ]; then 134 | check_mounted_folder_writable_with_chown "/backups" 135 | fi 136 | 137 | # ==== START NEO4J-ADMIN COMMAND ==== 138 | if debugging_enabled; then 139 | echo ${exec_cmd} "${@}" --verbose 140 | ${exec_cmd} "${@}" --verbose 141 | else 142 | ${exec_cmd} "${@}" 143 | fi 144 | -------------------------------------------------------------------------------- /docker-image-src/common/semver.jq: -------------------------------------------------------------------------------- 1 | def _semver_obj2obj($req): 2 | if . == $req then true 3 | elif .major != $req.major and .major != "x" and .major != "*" then false 4 | elif .minor != $req.minor and .minor != "x" and .minor != "*" then false 5 | elif .patch != $req.patch and .patch != "x" and .patch != "*" then false 6 | elif $req.minor == null and ( .minor == "x" or .minor == "*" ) then false 7 | elif $req.patch == null and ( .patch == "x" or .patch == "*" ) then false 8 | elif $req.major == null and $req.minor == null and $req.patch == null then false 9 | else true end; 10 | 11 | def _ver2obj: 12 | if type == "object" then . 13 | elif type == "string" and test("(?[0-9x*]+)(\\.(?[0-9x*]+))?(\\.?(?[0-9x*]+))?") then capture("(?[0-9x*]+)(\\.(?[0-9x*]+))?(\\.?(?[0-9x*]+))?") 14 | elif type == "string" and . == "" then {major: null, minor:null, patch:null} 15 | elif type == "number" then {minor:floor,patch:(.-floor)} 16 | else {major: .} end; 17 | 18 | # Returns true if input version spec semantically matches the requested version 19 | def semver($req): 20 | if $req == null or $req == "" then false 21 | elif . == $req then true 22 | else _ver2obj|_semver_obj2obj($req|_ver2obj) end; 23 | -------------------------------------------------------------------------------- /docker-image-src/common/utilities.sh: -------------------------------------------------------------------------------- 1 | 2 | function running_as_root 3 | { 4 | test "$(id -u)" = "0" 5 | } 6 | 7 | function secure_mode_enabled 8 | { 9 | test "${SECURE_FILE_PERMISSIONS:=no}" = "yes" 10 | } 11 | 12 | function debugging_enabled 13 | { 14 | test "${NEO4J_DEBUG+yes}" = "yes" 15 | } 16 | 17 | function debug_msg 18 | { 19 | if debugging_enabled; then 20 | echo "$@" 21 | fi 22 | } 23 | 24 | function containsElement 25 | { 26 | local e match="$1" 27 | shift 28 | for e; do [[ "$e" == "$match" ]] && return 0; done 29 | return 1 30 | } 31 | 32 | function is_writable 33 | { 34 | ${exec_cmd} test -w "${1}" 35 | } 36 | 37 | function print_permissions_advice_and_fail 38 | { 39 | local _directory=${1} 40 | local _userid=${2} 41 | local _groupid=${3} 42 | echo >&2 " 43 | Folder ${_directory} is not accessible for user: ${_userid} or group ${_groupid}. This is commonly a file permissions issue on the mounted folder. 44 | 45 | Hints to solve the issue: 46 | 1) Make sure the folder exists before mounting it. Docker will create the folder using root permissions before starting the Neo4j container. The root permissions disallow Neo4j from writing to the mounted folder. 47 | 2) Pass the folder owner's user ID and group ID to docker run, so that docker runs as that user. 48 | If the folder is owned by the current user, this can be done by adding this flag to your docker run command: 49 | --user=\$(id -u):\$(id -g) 50 | " 51 | exit 1 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /generate-stub-plugin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gradle:7-jdk11 2 | WORKDIR /testplugin 3 | COPY ./*.kts ./ExampleNeo4jPlugin.java /testplugin/ 4 | RUN mkdir -p /testplugin/src/main/java/testplugins/ && \ 5 | mkdir -p /testplugin/build && \ 6 | ln -s -T /output /testplugin/build/libs && \ 7 | mv /testplugin/ExampleNeo4jPlugin.java /testplugin/src/main/java/testplugins/ && \ 8 | chmod a+rw -R /testplugin 9 | ENV NEO4JVERSION=4.4.38 10 | 11 | VOLUME /output 12 | CMD gradle jar -Pversion=$NEO4JVERSION 13 | -------------------------------------------------------------------------------- /generate-stub-plugin/ExampleNeo4jPlugin.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.test.myplugin; 2 | 3 | import java.util.stream.Stream; 4 | 5 | import org.neo4j.graphdb.GraphDatabaseService; 6 | import org.neo4j.logging.Log; 7 | import org.neo4j.procedure.Context; 8 | import org.neo4j.procedure.Name; 9 | import org.neo4j.procedure.Procedure; 10 | 11 | /* 12 | This class is a basic Neo4J plugin that defines a procedure which can be called via Cypher. 13 | */ 14 | public class ExampleNeo4jPlugin 15 | { 16 | // Output data class containing primitive types 17 | public static class PrimitiveOutput 18 | { 19 | public String string; 20 | public long integer; 21 | public double aFloat; 22 | public boolean aBoolean; 23 | 24 | public PrimitiveOutput( String string, long integer, double aFloat, boolean aBoolean ) 25 | { 26 | this.string = string; 27 | this.integer = integer; 28 | this.aFloat = aFloat; 29 | this.aBoolean = aBoolean; 30 | } 31 | } 32 | // @ServiceProvider 33 | // public static class ExampleConfigurationSetting implements SettingsDeclaration 34 | // { 35 | // public static final String CONF_NAME = "com.neo4j.docker.neo4jserver.plugins.loaded_verison"; 36 | // 37 | // @Description("Unique setting to identify which semver field was matched") 38 | // public static final Setting loadedVersionValue = SettingImpl.newBuilder( 39 | // CONF_NAME, 40 | // SettingValueParsers.STRING, 41 | // "unset" 42 | // ).build(); 43 | // } 44 | 45 | @Context 46 | public GraphDatabaseService db; 47 | 48 | @Context 49 | public Log log; 50 | 51 | // A Neo4j procedure that always returns fixed values 52 | @Procedure 53 | public Stream defaultValues( @Name( value = "string", defaultValue = "a string" ) String string, 54 | @Name( value = "integer", defaultValue = "42" ) long integer, 55 | @Name( value = "float", defaultValue = "3.14" ) double aFloat, 56 | @Name( value = "boolean", defaultValue = "true" ) boolean aBoolean ) 57 | { 58 | return Stream.of( new PrimitiveOutput( string, integer, aFloat, aBoolean ) ); 59 | } 60 | } -------------------------------------------------------------------------------- /generate-stub-plugin/Makefile: -------------------------------------------------------------------------------- 1 | SHELL := bash 2 | .ONESHELL: 3 | .SHELLFLAGS := -eu -o pipefail -c 4 | .DELETE_ON_ERROR: 5 | .SECONDEXPANSION: 6 | .SECONDARY: 7 | 8 | ifeq ($(origin .RECIPEPREFIX), undefined) 9 | $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later) 10 | endif 11 | .RECIPEPREFIX = > 12 | 13 | ifndef NEO4JVERSION 14 | $(error NEO4JVERSION is not set) 15 | endif 16 | 17 | clean: ./Dockerfile 18 | > rm $( workdir=$(realpath $( docker build $${workdir} -t stubplugin:latest 24 | > docker run -it --rm \ 25 | -e NEO4JVERSION \ 26 | -v $${workdir}/../src/test/resources/stubplugin:/output \ 27 | --user="$$(id -u):$$(id -g)" \ 28 | stubplugin:latest 29 | > mv $${workdir}/../src/test/resources/stubplugin/myPlugin-$${NEO4JVERSION}.jar $${workdir}/../src/test/resources/stubplugin/myPlugin.jar 30 | .PHONY: plugin 31 | -------------------------------------------------------------------------------- /generate-stub-plugin/README.md: -------------------------------------------------------------------------------- 1 | # What is this? 2 | 3 | This code is purely for generating the [myPlugin.jar test artifact](../src/test/resources/testplugin/myPlugin.jar). 4 | It is a test artifact used for verifying that the `NEO4J_PLUGINS` feature works correctly. *It has nothing to do with Neo4j database or even the Neo4j docker image source code.* 5 | 6 | # Do I need to run this code at all? 7 | 8 | Short answer: **No.** 9 | 10 | A pre-generated `myPlugin.jar` is already included in the test resources. 11 | 12 | The only situation where you would need to even look at this is if you are actively developing the Neo4j docker image and for some reason the plugin tests are not loading `myPlugin.jar` any more. 13 | 14 | 15 | ## How to generate new test plugin 16 | 17 | The Makefile will do all the work for you, all you need to do is pick which version of Neo4j to use: 18 | 19 | ```shell 20 | NEO4JVERSION=4.4.11 make clean plugin 21 | ``` 22 | 23 | The Dockerfile is currently set to use java 11. If that needs to change then just change the base image that the Dockerfile uses. 24 | 25 | Don't forget to commit the newly generated `myPlugin.jar` back to git when you've finished. 26 | -------------------------------------------------------------------------------- /generate-stub-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Java library project to get you started. 5 | * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle 6 | * User Manual available at https://docs.gradle.org/7.6/userguide/building_java_projects.html 7 | */ 8 | 9 | //version = "4.3.0" 10 | 11 | plugins { 12 | // Apply the java-library plugin for API and implementation separation. 13 | `java-library` 14 | } 15 | 16 | repositories { 17 | // Use Maven Central for resolving dependencies. 18 | mavenCentral() 19 | } 20 | 21 | dependencies { 22 | api("org.neo4j:neo4j:$version") 23 | } 24 | -------------------------------------------------------------------------------- /generate-stub-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/7.6/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = "myPlugin" 11 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.neo4j 8 | docker-neo4j-tests 9 | 1.0-SNAPSHOT 10 | jar 11 | 12 | 13 | 17 14 | 5.11.0 15 | 5.24.0 16 | 3.1.2 17 | 1.20.1 18 | 19 | 20 | 21 | 22 | 23 | default 24 | 25 | true 26 | 27 | 28 | 29 | BundleTest 30 | 31 | 32 | 33 | bundle 34 | 35 | BundleTest 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.apache.maven.plugins 44 | maven-compiler-plugin 45 | 3.7.0 46 | 47 | ${java.version} 48 | ${java.version} 49 | 50 | 51 | 52 | org.apache.maven.plugins 53 | maven-surefire-plugin 54 | ${surefire.version} 55 | 56 | ${profile.include} 57 | ${profile.exclude} 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | org.slf4j 67 | slf4j-api 68 | 1.7.32 69 | 70 | 71 | org.slf4j 72 | slf4j-log4j12 73 | 1.7.32 74 | 75 | 76 | org.junit.jupiter 77 | junit-jupiter-api 78 | ${junit.version} 79 | test 80 | 81 | 82 | org.junit.jupiter 83 | junit-jupiter-engine 84 | ${junit.version} 85 | test 86 | 87 | 88 | org.junit.jupiter 89 | junit-jupiter-params 90 | ${junit.version} 91 | test 92 | 93 | 94 | org.testcontainers 95 | junit-jupiter 96 | ${testcontainers.version} 97 | test 98 | 99 | 100 | org.testcontainers 101 | testcontainers 102 | ${testcontainers.version} 103 | test 104 | 105 | 106 | org.neo4j.driver 107 | neo4j-java-driver 108 | ${neo4j.driver.version} 109 | test 110 | 111 | 112 | 113 | com.google.code.gson 114 | gson 115 | 2.8.9 116 | test 117 | 118 | 119 | 120 | org.apache.commons 121 | commons-compress 122 | 1.24.0 123 | test 124 | 125 | 126 | commons-io 127 | commons-io 128 | 2.11.0 129 | test 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /publish-neo4j-admin-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu -o pipefail 3 | 4 | EDITIONS=("community" "enterprise") 5 | 6 | ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 7 | source "$ROOT_DIR/build-utils-common-functions.sh" 8 | BUILD_DIR=${ROOT_DIR}/build 9 | SRC_DIR=${ROOT_DIR}/docker-image-src 10 | # shellcheck disable=SC2034 # Used in docker-common-functions.sh 11 | TAR_CACHE=${ROOT_DIR}/in 12 | 13 | function usage 14 | { 15 | echo >&2 "USAGE: $0 16 | For example: 17 | $0 4.4.10 community debian neo/neo4j-admin 18 | $0 5.10.0 enterprise ubi9 neo/neo4j-admin 19 | Version and operating system can also be set in the environment. 20 | For example: 21 | NEO4JVERSION=4.4.10 NEO4JEDITION=community IMAGE_OS=debian REPOSITORY=neo/neo4j-admin $0 22 | NEO4JVERSION=5.10.0 NEO4JEDITION=enterprise IMAGE_OS=ubi9 REPOSITORY=neo/neo4j-admin $0 23 | " 24 | exit 1 25 | } 26 | 27 | ## ========================================== 28 | ## get and sanitise script inputs 29 | 30 | if [[ $# -eq 4 ]]; then 31 | NEO4JVERSION=${1} 32 | NEO4JEDITION=${2} 33 | IMAGE_OS=${3} 34 | REPOSITORY=${4} 35 | elif [[ -z ${NEO4JVERSION:-""} ]]; then 36 | echo >&2 "NEO4JVERSION is unset. Either set it in the environment or pass as argument to this script." 37 | usage 38 | elif [[ -z ${NEO4JEDITION:-""} ]]; then 39 | echo >&2 "NEO4JEDITION is unset. Either set it in the environment or pass as argument to this script." 40 | usage 41 | elif [[ -z ${IMAGE_OS:-""} ]]; then 42 | echo >&2 "IMAGE_OS is unset. Either set it in the environment or pass as argument to this script." 43 | usage 44 | elif [[ -z ${REPOSITORY:-""} ]]; then 45 | echo >&2 "REPOSITORY is unset. Either set it in the environment or pass as argument to this script." 46 | usage 47 | fi 48 | # verify edition 49 | if ! contains_element "${NEO4JEDITION}" "${EDITIONS[@]}"; then 50 | echo >&2 "${NEO4JEDITION} is not a supported edition." 51 | usage 52 | fi 53 | # verify compatible neo4j version 54 | if [[ ! "${NEO4JVERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then 55 | echo "\"${NEO4JVERSION}\" is not a valid version number." 56 | usage 57 | fi 58 | # get source files 59 | BRANCH=$(get_branch_from_version ${NEO4JVERSION}) 60 | DOCKERFILE_NAME=$(get_compatible_dockerfile_for_os_or_error "${BRANCH}" "${IMAGE_OS}") 61 | 62 | echo "Building local context for docker build" 63 | ADMIN_LOCALCXT_DIR=${BUILD_DIR}/${IMAGE_OS}/neo4j-admin/${NEO4JEDITION} 64 | mkdir -p ${ADMIN_LOCALCXT_DIR} 65 | 66 | # copy neo4j-admin sources 67 | mkdir -p ${ADMIN_LOCALCXT_DIR}/local-package 68 | cp ${SRC_DIR}/common/* ${ADMIN_LOCALCXT_DIR}/local-package 69 | cp "$(cached_tarball "${NEO4JVERSION}" "${NEO4JEDITION}")" ${ADMIN_LOCALCXT_DIR}/local-package/ 70 | cp ${SRC_DIR}/${BRANCH}/neo4j-admin/*.sh ${ADMIN_LOCALCXT_DIR}/local-package 71 | 72 | # create neo4j-admin Dockerfile 73 | cp "${SRC_DIR}/${BRANCH}/neo4j-admin/${DOCKERFILE_NAME}" "${ADMIN_LOCALCXT_DIR}/Dockerfile" 74 | coredb_sha=$(shasum --algorithm=256 "$(cached_tarball "${NEO4JVERSION}" "${NEO4JEDITION}")" | cut -d' ' -f1) 75 | sed -i -e "s|%%NEO4J_SHA%%|${coredb_sha}|" "${ADMIN_LOCALCXT_DIR}/Dockerfile" 76 | sed -i -e "s|%%NEO4J_TARBALL%%|$(tarball_name ${NEO4JVERSION} ${NEO4JEDITION})|" "${ADMIN_LOCALCXT_DIR}/Dockerfile" 77 | sed -i -e "s|%%NEO4J_EDITION%%|${NEO4JEDITION}|" "${ADMIN_LOCALCXT_DIR}/Dockerfile" 78 | 79 | # build and push neo4j-admin 80 | MAJOR=$(get_major_from_version "${NEO4JVERSION}") 81 | full_version_admin_image_tag="${REPOSITORY}:${NEO4JVERSION}-${NEO4JEDITION}-${IMAGE_OS}" 82 | major_minor_admin_image_tag="${REPOSITORY}:${NEO4JVERSION%.*}-${NEO4JEDITION}-${IMAGE_OS}" 83 | major_admin_image_tag="${REPOSITORY}:${MAJOR}-${NEO4JEDITION}-${IMAGE_OS}" 84 | echo "Building neo4j-admin docker image for neo4j-admin-${NEO4JVERSION} ${NEO4JEDITION} on ${IMAGE_OS}." 85 | echo "With tags: ${full_version_admin_image_tag},${major_minor_admin_image_tag},${major_admin_image_tag}" 86 | 87 | docker buildx build --tag="${full_version_admin_image_tag}" --tag="${major_minor_admin_image_tag}" --tag="${major_admin_image_tag}" \ 88 | --build-arg="NEO4J_URI=file:///startup/$(tarball_name "${NEO4JVERSION}" "${NEO4JEDITION}")" \ 89 | "${ADMIN_LOCALCXT_DIR}" --platform linux/amd64,linux/arm64 --push 90 | 91 | 92 | -------------------------------------------------------------------------------- /publish-neo4j-admin-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu -o pipefail 3 | 4 | ROOT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 5 | source "$ROOT_DIR/build-utils-common-functions.sh" 6 | 7 | if [[ $# -eq 2 ]]; then 8 | NEO4JVERSION=${1} 9 | REPOSITORY=${2} 10 | elif [[ -z ${NEO4JVERSION:-""} ]]; then 11 | echo >&2 "NEO4JVERSION is unset. Either set it in the environment or pass as argument to this script." 12 | exit 1 13 | elif [[ -z ${REPOSITORY:-""} ]]; then 14 | echo >&2 "REPOSITORY is unset. Either set it in the environment or pass as argument to this script." 15 | exit 1 16 | fi 17 | 18 | echo "Verifying access or failing fast, by re-tagging neo4j-admin:5, when successful it's a noop." 19 | docker buildx imagetools create "${REPOSITORY}":5-community \ 20 | --tag "${REPOSITORY}:5" 21 | 22 | echo "Publishing ${REPOSITORY}:${NEO4JVERSION}" 23 | "${ROOT_DIR}/publish-neo4j-admin-image.sh" "${NEO4JVERSION}" "enterprise" "ubi9" "${REPOSITORY}" 24 | "${ROOT_DIR}/publish-neo4j-admin-image.sh" "${NEO4JVERSION}" "community" "ubi9" "${REPOSITORY}" 25 | "${ROOT_DIR}/publish-neo4j-admin-image.sh" "${NEO4JVERSION}" "enterprise" "debian" "${REPOSITORY}" 26 | "${ROOT_DIR}/publish-neo4j-admin-image.sh" "${NEO4JVERSION}" "community" "debian" "${REPOSITORY}" 27 | 28 | echo "Adding extra tags..." 29 | 30 | MAJOR=$(get_major_from_version "${NEO4JVERSION}") 31 | 32 | if [[ "$MAJOR" == "5" ]]; then 33 | echo "Tagging ${MAJOR}..." 34 | docker buildx imagetools create "${REPOSITORY}:${NEO4JVERSION}-community-debian" \ 35 | --tag "${REPOSITORY}:5-community" \ 36 | --tag "${REPOSITORY}:5" 37 | 38 | docker buildx imagetools create "${REPOSITORY}:${NEO4JVERSION}-enterprise-debian" \ 39 | --tag "${REPOSITORY}:5-enterprise" 40 | 41 | elif [[ "$MAJOR" -gt 2024 ]]; then 42 | echo "Tagging calver ${MAJOR}..." 43 | docker buildx imagetools create "${REPOSITORY}:${NEO4JVERSION}-community-debian" \ 44 | --tag "${REPOSITORY}:${MAJOR}" \ 45 | --tag "${REPOSITORY}:${MAJOR}-community" \ 46 | --tag "${REPOSITORY}:community-debian" \ 47 | --tag "${REPOSITORY}:community" \ 48 | --tag "${REPOSITORY}:debian" \ 49 | --tag "${REPOSITORY}:latest" 50 | 51 | docker buildx imagetools create "${REPOSITORY}:${NEO4JVERSION}-community-ubi9" \ 52 | --tag "${REPOSITORY}:community-ubi9" \ 53 | --tag "${REPOSITORY}:ubi9" \ 54 | 55 | docker buildx imagetools create "${REPOSITORY}:${NEO4JVERSION}-enterprise-debian" \ 56 | --tag "${REPOSITORY}:${MAJOR}-enterprise" \ 57 | --tag "${REPOSITORY}:enterprise-debian" \ 58 | --tag "${REPOSITORY}:enterprise" 59 | 60 | docker buildx imagetools create "${REPOSITORY}:${NEO4JVERSION}-enterprise-ubi9" \ 61 | --tag "${REPOSITORY}:enterprise-ubi9" 62 | fi 63 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, console 2 | log4j.appender.console=org.apache.log4j.ConsoleAppender 3 | log4j.appender.console.layout=org.apache.log4j.PatternLayout -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/coredb/TestCausalCluster.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.coredb; 2 | 3 | import com.neo4j.docker.utils.SetContainerUser; 4 | import com.neo4j.docker.utils.TemporaryFolderManager; 5 | import com.neo4j.docker.utils.TestSettings; 6 | import org.junit.jupiter.api.Assertions; 7 | import org.junit.jupiter.api.Assumptions; 8 | import org.junit.jupiter.api.Disabled; 9 | import org.junit.jupiter.api.Test; 10 | import org.neo4j.driver.*; 11 | 12 | import org.junit.jupiter.api.extension.RegisterExtension; 13 | import org.testcontainers.containers.DockerComposeContainer; 14 | import org.testcontainers.containers.wait.strategy.*; 15 | 16 | import java.io.DataOutputStream; 17 | import java.io.File; 18 | import java.io.FileOutputStream; 19 | import java.io.InputStream; 20 | import java.nio.file.Files; 21 | import java.nio.file.Path; 22 | import java.nio.file.Paths; 23 | import java.time.Duration; 24 | 25 | @Disabled 26 | public class TestCausalCluster 27 | { 28 | private static final int DEFAULT_BOLT_PORT = 7687; 29 | @RegisterExtension 30 | public static TemporaryFolderManager temporaryFolderManager = new TemporaryFolderManager(); 31 | 32 | @Disabled 33 | @Test 34 | void testCausalClusteringBasic() throws Exception 35 | { 36 | Assumptions.assumeTrue(TestSettings.EDITION == TestSettings.Edition.ENTERPRISE, 37 | "No causal clustering for community edition"); 38 | 39 | Path tmpDir = temporaryFolderManager.createFolder( "CC_cluster_" ); 40 | 41 | File compose_file = new File(tmpDir.toString(), "causal-cluster-compose.yml"); 42 | Files.copy(getResource("causal-cluster-compose.yml"), Paths.get(compose_file.getPath())); 43 | 44 | Files.createDirectories( tmpDir.resolve( "core1" ) ); 45 | Files.createDirectories( tmpDir.resolve( "core2" ) ); 46 | Files.createDirectories( tmpDir.resolve( "core3" ) ); 47 | Files.createDirectories( tmpDir.resolve( "readreplica1" ) ); 48 | 49 | String content = new String(Files.readAllBytes(Paths.get(compose_file.getPath()))); 50 | String[] contentLines = content.split(System.getProperty("line.separator")); 51 | String[] editedLines = new String[contentLines.length]; 52 | int i = 0; 53 | 54 | for (String line : contentLines) { 55 | editedLines[i] = line.replaceAll("%%IMAGE%%", TestSettings.IMAGE_ID.asCanonicalNameString()); 56 | editedLines[i] = editedLines[i].replaceAll("%%LOGS_DIR%%", tmpDir.toAbsolutePath().toString()); 57 | editedLines[i] = editedLines[i].replaceAll("%%USERIDGROUPID%%", SetContainerUser.getNonRootUserString()); 58 | i++; 59 | } 60 | 61 | String editedContent = String.join("\n", editedLines); 62 | 63 | DataOutputStream outstream = new DataOutputStream(new FileOutputStream(compose_file,false)); 64 | outstream.write(editedContent.getBytes()); 65 | outstream.close(); 66 | System.out.println("logs: " + compose_file.getName() + " and " + tmpDir.toString()); 67 | 68 | DockerComposeContainer clusteringContainer = new DockerComposeContainer(compose_file) 69 | .withLocalCompose(true) 70 | .withExposedService("core1", DEFAULT_BOLT_PORT ) 71 | .withExposedService("core1", 7474, 72 | Wait.forHttp( "/" ) 73 | .forPort( 7474 ) 74 | .forStatusCode( 200 ) 75 | .withStartupTimeout( Duration.ofSeconds( 300 ) )) 76 | .withExposedService("readreplica1", DEFAULT_BOLT_PORT); 77 | 78 | clusteringContainer.start(); 79 | 80 | String core1Uri = "bolt://" + clusteringContainer.getServiceHost("core1", DEFAULT_BOLT_PORT) 81 | + ":" + 82 | clusteringContainer.getServicePort("core1", DEFAULT_BOLT_PORT); 83 | String rrUri = "bolt://" + clusteringContainer.getServiceHost("readreplica1", DEFAULT_BOLT_PORT) 84 | + ":" + 85 | clusteringContainer.getServicePort("readreplica1", DEFAULT_BOLT_PORT); 86 | 87 | try ( Driver coreDriver = GraphDatabase.driver( core1Uri, AuthTokens.basic( "neo4j", "neo"))) 88 | { 89 | Session session = coreDriver.session(); 90 | Result rs = session.run( "CREATE (arne:dog {name:'Arne'})-[:SNIFFS]->(bosse:dog {name:'Bosse'}) RETURN arne.name"); 91 | Assertions.assertEquals( "Arne", rs.single().get( 0 ).asString(), "did not receive expected result from cypher CREATE query" ); 92 | } 93 | catch (Exception e) 94 | { 95 | clusteringContainer.stop(); 96 | return; 97 | } 98 | 99 | try ( Driver rrDriver = GraphDatabase.driver(rrUri, AuthTokens.basic("neo4j", "neo"))) 100 | { 101 | Session session = rrDriver.session(); 102 | Result rs = session.run( "MATCH (a:dog)-[:SNIFFS]->(b:dog) RETURN a.name"); 103 | Assertions.assertEquals( "Arne", rs.single().get( 0 ).asString(), "did not receive expected result from cypher MATCH query" ); 104 | } 105 | catch (Exception e) 106 | { 107 | clusteringContainer.stop(); 108 | return; 109 | } 110 | 111 | clusteringContainer.stop(); 112 | 113 | } 114 | 115 | private InputStream getResource(String path) { 116 | InputStream resource = getClass().getClassLoader().getResourceAsStream(path); 117 | return resource; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/coredb/configurations/Configuration.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.coredb.configurations; 2 | 3 | import com.neo4j.docker.utils.Neo4jVersion; 4 | import com.neo4j.docker.utils.TestSettings; 5 | 6 | import java.nio.file.Path; 7 | import java.nio.file.Paths; 8 | import java.util.EnumMap; 9 | import java.util.Map; 10 | 11 | public class Configuration 12 | { 13 | private static Map CONFIGURATIONS_5X = new EnumMap( Setting.class ) {{ 14 | put( Setting.APOC_EXPORT_FILE_ENABLED, new Configuration( "apoc.export.file.enabled")); 15 | put( Setting.BACKUP_ENABLED, new Configuration("server.backup.enabled")); 16 | put( Setting.BACKUP_LISTEN_ADDRESS, new Configuration("server.backup.listen_address")); 17 | put( Setting.BROWSER_ALLOW_OUTGOING_CONNECTIONS, new Configuration("browser.allow_outgoing_connections")); 18 | put( Setting.CLUSTER_RAFT_ADDRESS, new Configuration("server.cluster.raft.advertised_address")); 19 | put( Setting.CLUSTER_ROUTING_ADDRESS, new Configuration("server.routing.advertised_address")); 20 | put( Setting.CLUSTER_TRANSACTION_ADDRESS, new Configuration("server.cluster.advertised_address")); 21 | put( Setting.DEFAULT_LISTEN_ADDRESS, new Configuration("server.default_listen_address")); 22 | put( Setting.DIRECTORIES_DATA, new Configuration("server.directories.data")); 23 | put( Setting.DIRECTORIES_LOGS, new Configuration("server.directories.logs")); 24 | put( Setting.DIRECTORIES_METRICS, new Configuration("server.directories.metrics")); 25 | put( Setting.JVM_ADDITIONAL, new Configuration("server.jvm.additional")); 26 | put( Setting.LOGS_GC_ROTATION_KEEPNUMBER, new Configuration( "server.logs.gc.rotation.keep_number")); 27 | put( Setting.MEMORY_HEAP_INITIALSIZE, new Configuration("server.memory.heap.initial_size")); 28 | put( Setting.MEMORY_HEAP_MAXSIZE, new Configuration( "server.memory.heap.max_size")); 29 | put( Setting.MEMORY_PAGECACHE_SIZE, new Configuration("server.memory.pagecache.size")); 30 | put( Setting.MINIMUM_PASSWORD_LENGTH, new Configuration("dbms.security.auth_minimum_password_length")); 31 | put( Setting.SECURITY_PROCEDURES_UNRESTRICTED, new Configuration("dbms.security.procedures.unrestricted")); 32 | put( Setting.TXLOG_RETENTION_POLICY, new Configuration("db.tx_log.rotation.retention_policy")); 33 | }}; 34 | 35 | private static Map CONFIGURATIONS_4X = new EnumMap( Setting.class ) {{ 36 | put( Setting.APOC_EXPORT_FILE_ENABLED, new Configuration( "apoc.export.file.enabled")); 37 | put( Setting.BACKUP_ENABLED, new Configuration("dbms.backup.enabled")); 38 | put( Setting.BACKUP_LISTEN_ADDRESS, new Configuration("dbms.backup.listen_address")); 39 | put( Setting.BROWSER_ALLOW_OUTGOING_CONNECTIONS, new Configuration("browser.allow_outgoing_connections")); 40 | put( Setting.CLUSTER_DISCOVERY_ADDRESS, new Configuration("causal_clustering.discovery_advertised_address")); 41 | put( Setting.CLUSTER_RAFT_ADDRESS, new Configuration("causal_clustering.raft_advertised_address")); 42 | put( Setting.CLUSTER_ROUTING_ADDRESS, new Configuration("dbms.routing.advertised_address")); 43 | put( Setting.CLUSTER_TRANSACTION_ADDRESS, new Configuration("causal_clustering.transaction_advertised_address")); 44 | put( Setting.DEFAULT_LISTEN_ADDRESS, new Configuration("dbms.default_listen_address")); 45 | put( Setting.DIRECTORIES_DATA, new Configuration("dbms.directories.data")); 46 | put( Setting.DIRECTORIES_LOGS, new Configuration("dbms.directories.logs")); 47 | put( Setting.DIRECTORIES_METRICS, new Configuration("dbms.directories.metrics")); 48 | put( Setting.JVM_ADDITIONAL, new Configuration("dbms.jvm.additional")); 49 | put( Setting.LOGS_GC_ROTATION_KEEPNUMBER, new Configuration( "dbms.logs.gc.rotation.keep_number")); 50 | put( Setting.MEMORY_HEAP_INITIALSIZE, new Configuration("dbms.memory.heap.initial_size")); 51 | put( Setting.MEMORY_HEAP_MAXSIZE, new Configuration("dbms.memory.heap.max_size")); 52 | put( Setting.MEMORY_PAGECACHE_SIZE, new Configuration("dbms.memory.pagecache.size")); 53 | put( Setting.SECURITY_PROCEDURES_UNRESTRICTED, new Configuration("dbms.security.procedures.unrestricted")); 54 | put( Setting.TXLOG_RETENTION_POLICY, new Configuration("dbms.tx_log.rotation.retention_policy")); 55 | }}; 56 | public static Map getConfigurationNameMap() 57 | { 58 | return getConfigurationNameMap( TestSettings.NEO4J_VERSION ); 59 | } 60 | 61 | public static Map getConfigurationNameMap( Neo4jVersion version ) 62 | { 63 | switch ( version.major ) 64 | { 65 | case 3: 66 | EnumMap out = new EnumMap( CONFIGURATIONS_4X ); 67 | out.put( Setting.DEFAULT_LISTEN_ADDRESS, new Configuration( "dbms.connectors.default_listen_address" ) ); 68 | return out; 69 | case 4: 70 | return CONFIGURATIONS_4X; 71 | default: 72 | return CONFIGURATIONS_5X; 73 | } 74 | } 75 | public static Path getConfigurationResourcesFolder() 76 | { 77 | return getConfigurationResourcesFolder(TestSettings.NEO4J_VERSION); 78 | } 79 | 80 | public static Path getConfigurationResourcesFolder( Neo4jVersion version ) 81 | { 82 | if(version.isAtLeastVersion( Neo4jVersion.NEO4J_VERSION_500 )) 83 | { 84 | return Paths.get("src", "test", "resources", "confs"); 85 | } 86 | else return Paths.get( "src", "test", "resources", "confs", "before50"); 87 | } 88 | 89 | public String name; 90 | public String envName; 91 | 92 | private Configuration( String name ) 93 | { 94 | this.name = name; 95 | this.envName = "NEO4J_" + name.replace( '_', '-' ) 96 | .replace( '.', '_') 97 | .replace( "-", "__" ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/coredb/configurations/Setting.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.coredb.configurations; 2 | 3 | public enum Setting 4 | { 5 | APOC_EXPORT_FILE_ENABLED, 6 | BACKUP_ENABLED, 7 | BACKUP_LISTEN_ADDRESS, 8 | BROWSER_ALLOW_OUTGOING_CONNECTIONS, 9 | CLUSTER_DISCOVERY_ADDRESS, 10 | CLUSTER_RAFT_ADDRESS, 11 | CLUSTER_ROUTING_ADDRESS, 12 | CLUSTER_TRANSACTION_ADDRESS, 13 | DEFAULT_LISTEN_ADDRESS, 14 | DIRECTORIES_DATA, 15 | DIRECTORIES_LOGS, 16 | DIRECTORIES_METRICS, 17 | JVM_ADDITIONAL, 18 | LOGS_GC_ROTATION_KEEPNUMBER, 19 | MEMORY_HEAP_INITIALSIZE, 20 | MEMORY_HEAP_MAXSIZE, 21 | MEMORY_PAGECACHE_SIZE, 22 | MINIMUM_PASSWORD_LENGTH, 23 | SECURITY_PROCEDURES_UNRESTRICTED, 24 | TXLOG_RETENTION_POLICY 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/coredb/plugins/Neo4jPluginEnv.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.coredb.plugins; 2 | 3 | import com.neo4j.docker.utils.Neo4jVersion; 4 | import com.neo4j.docker.utils.TestSettings; 5 | 6 | public class Neo4jPluginEnv 7 | { 8 | public static final String PLUGIN_ENV_4X = "NEO4JLABS_PLUGINS"; 9 | public static final String PLUGIN_ENV_5X = "NEO4J_PLUGINS"; 10 | 11 | public static String get( ) 12 | { 13 | return get(TestSettings.NEO4J_VERSION); 14 | } 15 | 16 | public static String get( Neo4jVersion version ) 17 | { 18 | if( version.isAtLeastVersion( Neo4jVersion.NEO4J_VERSION_500 ) ) 19 | { 20 | return PLUGIN_ENV_5X; 21 | } 22 | else return PLUGIN_ENV_4X; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/neo4jadmin/TestAdminBasic.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.neo4jadmin; 2 | 3 | import com.neo4j.docker.utils.WaitStrategies; 4 | import com.neo4j.docker.utils.TestSettings; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.junit.jupiter.api.Assumptions; 7 | import org.junit.jupiter.api.Test; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.testcontainers.containers.ContainerLaunchException; 11 | import org.testcontainers.containers.GenericContainer; 12 | import org.testcontainers.containers.output.Slf4jLogConsumer; 13 | 14 | import java.time.Duration; 15 | 16 | public class TestAdminBasic 17 | { 18 | private final Logger log = LoggerFactory.getLogger( TestAdminBasic.class ); 19 | 20 | @Test 21 | void testCannotRunNeo4j() 22 | { 23 | GenericContainer admin = new GenericContainer( TestSettings.ADMIN_IMAGE_ID ); 24 | admin.withEnv( "NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes" ) 25 | .withExposedPorts( 7474, 7687 ) 26 | .withLogConsumer( new Slf4jLogConsumer( log ) ) 27 | .withCommand( "neo4j", "console" ); 28 | WaitStrategies.waitUntilContainerFinished( admin, Duration.ofSeconds( 30) ); 29 | 30 | Assertions.assertThrows( ContainerLaunchException.class, admin::start ); 31 | admin.stop(); 32 | } 33 | @Test 34 | void testLicenseAcceptanceRequired_Neo4jAdmin() 35 | { 36 | Assumptions.assumeTrue( TestSettings.EDITION == TestSettings.Edition.ENTERPRISE, 37 | "No license checks for community edition"); 38 | 39 | String logsOut; 40 | try(GenericContainer container = new GenericContainer( TestSettings.ADMIN_IMAGE_ID ) 41 | .withLogConsumer( new Slf4jLogConsumer( log ) ) ) 42 | { 43 | WaitStrategies.waitUntilContainerFinished( container, Duration.ofSeconds( 30) ); 44 | // container start should fail due to licensing. 45 | Assertions.assertThrows( ContainerLaunchException.class, container::start, 46 | "Neo4j did not notify about accepting the license agreement" ); 47 | logsOut = container.getLogs(); 48 | } 49 | // double check the container didn't warn and start neo4j anyway 50 | Assertions.assertTrue( logsOut.contains( "must accept the license" ), 51 | "Neo4j did not notify about accepting the license agreement" ); 52 | Assertions.assertFalse( logsOut.contains( "Remote interface available" ), 53 | "Neo4j was started even though the license was not accepted" ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/neo4jadmin/TestDumpLoad.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.neo4jadmin; 2 | 3 | import com.neo4j.docker.utils.DatabaseIO; 4 | import com.neo4j.docker.utils.Neo4jVersion; 5 | import com.neo4j.docker.utils.SetContainerUser; 6 | import com.neo4j.docker.utils.WaitStrategies; 7 | import com.neo4j.docker.utils.TemporaryFolderManager; 8 | import com.neo4j.docker.utils.TestSettings; 9 | import org.junit.jupiter.api.Assertions; 10 | import org.junit.jupiter.api.Assumptions; 11 | import org.junit.jupiter.api.BeforeAll; 12 | import org.junit.jupiter.api.Test; 13 | import org.junit.jupiter.api.extension.RegisterExtension; 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | import org.testcontainers.containers.GenericContainer; 17 | import org.testcontainers.containers.output.Slf4jLogConsumer; 18 | import org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy; 19 | import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; 20 | 21 | import java.nio.file.Path; 22 | import java.time.Duration; 23 | 24 | public class TestDumpLoad 25 | { 26 | private static Logger log = LoggerFactory.getLogger( TestDumpLoad.class ); 27 | @RegisterExtension 28 | public static TemporaryFolderManager temporaryFolderManager = new TemporaryFolderManager(); 29 | 30 | @BeforeAll 31 | static void beforeAll() 32 | { 33 | Assumptions.assumeTrue( TestSettings.NEO4J_VERSION.isAtLeastVersion( Neo4jVersion.NEO4J_VERSION_500 ), 34 | "These tests only apply to neo4j-admin images of 5.0 and greater"); 35 | } 36 | 37 | private GenericContainer createDBContainer( boolean asDefaultUser, String password ) 38 | { 39 | String auth = "none"; 40 | if(!password.equalsIgnoreCase("none")) 41 | { 42 | auth = "neo4j/"+password; 43 | } 44 | 45 | GenericContainer container = new GenericContainer( TestSettings.IMAGE_ID ); 46 | container.withEnv( "NEO4J_AUTH", auth ) 47 | .withEnv( "NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes" ) 48 | .withExposedPorts( 7474, 7687 ) 49 | .withLogConsumer( new Slf4jLogConsumer( log ) ) 50 | .waitingFor( WaitStrategies.waitForNeo4jReady( password) ); 51 | if(!asDefaultUser) 52 | { 53 | SetContainerUser.nonRootUser( container ); 54 | } 55 | return container; 56 | } 57 | 58 | private GenericContainer createAdminContainer( boolean asDefaultUser ) 59 | { 60 | GenericContainer container = new GenericContainer( TestSettings.ADMIN_IMAGE_ID ); 61 | container.withEnv( "NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes" ) 62 | .withExposedPorts( 7474, 7687 ) 63 | .withLogConsumer( new Slf4jLogConsumer( log ) ) 64 | .waitingFor( new LogMessageWaitStrategy().withRegEx( "^Done: \\d+ files, [\\d\\.,]+[KMGi]*B processed.*" ) ) 65 | // .waitingFor( new LogMessageWaitStrategy().withRegEx( "^Done: .*" ) ) 66 | .withStartupCheckStrategy( new OneShotStartupCheckStrategy().withTimeout( Duration.ofSeconds( 90 ) ) ); 67 | if(!asDefaultUser) 68 | { 69 | SetContainerUser.nonRootUser( container ); 70 | } 71 | return container; 72 | } 73 | 74 | @Test 75 | void shouldDumpAndLoad_defaultUser_noAuth() throws Exception 76 | { 77 | shouldCreateDumpAndLoadDump( true, "none" ); 78 | } 79 | 80 | @Test 81 | void shouldDumpAndLoad_nonDefaultUser_noAuth() throws Exception 82 | { 83 | shouldCreateDumpAndLoadDump( false, "none" ); 84 | } 85 | 86 | @Test 87 | void shouldDumpAndLoad_defaultUser_withAuth() throws Exception 88 | { 89 | shouldCreateDumpAndLoadDump( true, "verysecretpassword" ); 90 | } 91 | 92 | @Test 93 | void shouldDumpAndLoad_nonDefaultUser_withAuth() throws Exception 94 | { 95 | shouldCreateDumpAndLoadDump( false, "verysecretpassword" ); 96 | } 97 | 98 | private void shouldCreateDumpAndLoadDump( boolean asDefaultUser, String password ) throws Exception 99 | { 100 | Path firstDataDir; 101 | Path secondDataDir; 102 | Path backupDir; 103 | 104 | // start a database and populate it 105 | try(GenericContainer container = createDBContainer( asDefaultUser, password )) 106 | { 107 | firstDataDir = temporaryFolderManager.createNamedFolderAndMountAsVolume(container,"data1", "/data"); 108 | container.start(); 109 | DatabaseIO dbio = new DatabaseIO( container ); 110 | dbio.putInitialDataIntoContainer( "neo4j", password ); 111 | container.getDockerClient().stopContainerCmd( container.getContainerId() ).withTimeout(30).exec(); 112 | } 113 | 114 | // use admin container to create dump 115 | try(GenericContainer admin = createAdminContainer( asDefaultUser )) 116 | { 117 | temporaryFolderManager.mountHostFolderAsVolume( admin, firstDataDir, "/data" ); 118 | backupDir = temporaryFolderManager.createFolderAndMountAsVolume(admin, "/backups"); 119 | admin.withCommand( "neo4j-admin", "database", "dump", "neo4j", "--to-path=/backups" ); 120 | admin.start(); 121 | } 122 | Assertions.assertTrue( backupDir.resolve( "neo4j.dump" ).toFile().exists(), "dump file not created"); 123 | 124 | // dump file exists. Now try to load it into a new database. 125 | // use admin container to create dump 126 | try(GenericContainer admin = createAdminContainer( asDefaultUser )) 127 | { 128 | secondDataDir = temporaryFolderManager.createNamedFolderAndMountAsVolume(admin, "data2", "/data"); 129 | temporaryFolderManager.mountHostFolderAsVolume( admin, backupDir, "/backups" ); 130 | admin.withCommand( "neo4j-admin", "database", "load", "neo4j", "--from-path=/backups" ); 131 | admin.start(); 132 | } 133 | 134 | // verify data in 2nd data directory by starting a database and verifying data we populated earlier 135 | try(GenericContainer container = createDBContainer( asDefaultUser, password )) 136 | { 137 | temporaryFolderManager.mountHostFolderAsVolume( container, secondDataDir, "/data" ); 138 | container.start(); 139 | DatabaseIO dbio = new DatabaseIO( container ); 140 | dbio.verifyInitialDataInContainer( "neo4j", password ); 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/neo4jadmin/TestReport.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.neo4jadmin; 2 | 3 | import com.neo4j.docker.utils.WaitStrategies; 4 | import com.neo4j.docker.utils.TestSettings; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.junit.jupiter.api.Test; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.testcontainers.containers.ContainerLaunchException; 10 | import org.testcontainers.containers.GenericContainer; 11 | import org.testcontainers.containers.output.Slf4jLogConsumer; 12 | 13 | import java.time.Duration; 14 | 15 | public class TestReport 16 | { 17 | private final Logger log = LoggerFactory.getLogger( TestReport.class ); 18 | 19 | private GenericContainer createAdminContainer() 20 | { 21 | GenericContainer container = new GenericContainer( TestSettings.ADMIN_IMAGE_ID ) 22 | .withEnv( "NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes" ).withEnv( "NEO4J_DEBUG", "yes" ) 23 | .withCommand( "neo4j-admin", "server", "report" ) 24 | .withLogConsumer( new Slf4jLogConsumer( log ) ); 25 | WaitStrategies.waitUntilContainerFinished( container, Duration.ofSeconds( 20 ) ); 26 | return container; 27 | } 28 | 29 | @Test 30 | void shouldErrorHelpfullyIfAdminReport() 31 | { 32 | try(GenericContainer container = createAdminContainer()) 33 | { 34 | Assertions.assertThrows( ContainerLaunchException.class, container::start ); 35 | Assertions.assertTrue( container.getLogs().contains( "To run the report tool inside a neo4j container, do:" ), 36 | "did not error about needing to run in the same container as the database." + 37 | " Actual logs:"+container.getLogs() ); 38 | Assertions.assertTrue( container.getLogs().contains( "docker exec neo4j-admin-report" ), 39 | "did not error about needing to run in the same container as the database." + 40 | " Actual logs:"+container.getLogs() ); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/utils/HostFileHttpHandler.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.utils; 2 | 3 | import com.sun.net.httpserver.HttpExchange; 4 | import com.sun.net.httpserver.HttpHandler; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.net.HttpURLConnection; 9 | import java.nio.file.Files; 10 | 11 | /** 12 | * HttpHandler that responds to all http requests with the given file from the file system 13 | */ 14 | public class HostFileHttpHandler implements HttpHandler 15 | { 16 | private final File file; 17 | private final String contentType; 18 | 19 | public HostFileHttpHandler( File fileToDownload, String contentType ) 20 | { 21 | this.file = fileToDownload; 22 | this.contentType = contentType; 23 | } 24 | 25 | @Override 26 | public void handle( HttpExchange exchange ) throws IOException 27 | { 28 | exchange.getResponseHeaders().add( "Content-Type", contentType ); 29 | exchange.sendResponseHeaders( HttpURLConnection.HTTP_OK, file.length() ); 30 | Files.copy( this.file.toPath(), exchange.getResponseBody() ); 31 | exchange.close(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/utils/HttpServerTestExtension.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.utils; 2 | 3 | import com.sun.net.httpserver.HttpHandler; 4 | import com.sun.net.httpserver.HttpServer; 5 | import org.junit.jupiter.api.extension.AfterEachCallback; 6 | import org.junit.jupiter.api.extension.BeforeEachCallback; 7 | import org.junit.jupiter.api.extension.ExtensionContext; 8 | 9 | import java.net.InetSocketAddress; 10 | 11 | /** 12 | * Runs a HTTP Server with to allow integration testing 13 | */ 14 | public class HttpServerTestExtension implements AfterEachCallback, BeforeEachCallback 15 | { 16 | public final int PORT = 3000; 17 | private HttpServer server; 18 | 19 | @Override 20 | public void beforeEach(ExtensionContext extensionContext) throws Exception 21 | { 22 | server = HttpServer.create( new InetSocketAddress( PORT ), 0 ); 23 | server.setExecutor( null ); // creates a default executor 24 | server.start(); 25 | } 26 | 27 | @Override 28 | public void afterEach(ExtensionContext extensionContext) throws Exception 29 | { 30 | if ( server != null ) 31 | { 32 | server.stop( 5 ); // waits up to 5 seconds to stop serving http requests 33 | } 34 | } 35 | 36 | // Register a handler to provide desired behaviour on a specific uri path 37 | public void registerHandler( String uriToHandle, HttpHandler httpHandler ) 38 | { 39 | if (!uriToHandle.startsWith( "/" )){ 40 | uriToHandle = '/' + uriToHandle; 41 | } 42 | server.createContext( uriToHandle, httpHandler ); 43 | } 44 | 45 | public void unregisterEndpoint(String endpoint) 46 | { 47 | if (!endpoint.startsWith( "/" )){ 48 | endpoint = '/' + endpoint; 49 | } 50 | try 51 | { 52 | server.removeContext(endpoint); 53 | } 54 | catch (IllegalArgumentException iex) 55 | { 56 | // there was nothing registered to that endpoint so action is a NOP. 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/test/java/com/neo4j/docker/utils/Neo4jVersion.java: -------------------------------------------------------------------------------- 1 | package com.neo4j.docker.utils; 2 | 3 | import java.util.regex.Matcher; 4 | import java.util.regex.Pattern; 5 | 6 | public class Neo4jVersion 7 | { 8 | public static final Neo4jVersion NEO4J_VERSION_400 = new Neo4jVersion( 4, 0, 0 ); 9 | public static final Neo4jVersion NEO4J_VERSION_440 = new Neo4jVersion( 4, 4, 0 ); 10 | public static final Neo4jVersion NEO4J_VERSION_500 = new Neo4jVersion( 5, 0, 0 ); 11 | public static final Neo4jVersion NEO4J_VERSION_527 = new Neo4jVersion( 5, 27, 0 ); 12 | 13 | public final int major; 14 | public final int minor; 15 | public final int patch; 16 | public final String label; 17 | 18 | public static Neo4jVersion fromVersionString( String version ) 19 | { 20 | Pattern pattern = Pattern.compile( "(?[\\d]+)\\.(?[\\d]+)\\.(?[\\d]+)(?