NOM Server and Persistence Docker compose

Docker compose can be used to provision a set of related containers as services to experiment with or to run in test environments.

But Docker doesn’t recommend using compose for production.

Following is a set of steps to create a two container compose setup to experiment with NOM server container and an Enterprise Neo4j persistence container as storage.

Please refer to Docker first look guide for a complete example of a Docker compose environment with NOM persistence, NOM server and a managed Neo4j instance.

  • Define a storage service that uses an Enterprise Neo4j image. Follow the below template and replace appropriate user defined values.

    storage:
        hostname: <user defined>
        image: neo4j:<Neo4j version>-enterprise
        networks:
          - <user defined>
        ports:
          - <map http and bolt ports>
        environment:
          NEO4J_ACCEPT_LICENSE_AGREEMENT: "yes"
          NEO4J_AUTH: <user defined username>/<user defined password>
          NEO4J_server_default__advertised__address: <user defined>
          NEO4J_server_http_listen__address: <user defined>
          NEO4J_server_bolt_listen__address: <user defined to be used in the NOM server>
        healthcheck:
          test: [ "CMD-SHELL", "echo RETURN 1 | cypher-shell -a bolt://<value of NEO4J_server_bolt_listen__address> -u <user defined username> -p <user defined password> || exit 1" ]
  • Define a server service that uses NOM server image. Follow the below template and replace appropriate user defined values.

      server:
        hostname: server
        image: neo4j/neo4j-ops-manager-server:latest
        networks:
          - <user defined but should be the same as storage service>
        ports:
          - "<user defined>:8080"
          - "<user defined>:9090"
        environment:
          SPRING_NEO4J_URI: <bolt address from the storage service defined before>
          SPRING_NEO4J_AUTHENTICATION_USERNAME: <username from the storage service defined before>
          SPRING_NEO4J_AUTHENTICATION_PASSWORD: <password from the storage service defined before>
          SERVER_SSL_KEY_STORE_TYPE: PKCS12
          SERVER_SSL_KEY_STORE: <path to a self-signed cert file with pfx extension mounted into this container>
          SERVER_SSL_KEY_STORE_PASSWORD: <user defined for mounted certs>
          GRPC_SERVER_SECURITY_KEY_STORE_TYPE: PKCS12
          GRPC_SERVER_SECURITY_KEY_STORE: <path to a self-signed cert file with pfx extension mounted into this container>
          GRPC_SERVER_SECURITY_KEY_STORE_PASSWORD: <user defined for mounted certs>
          CORS_ALLOWEDHEADERS: "*"
          CORS_ALLOWEDORIGINS: "http://localhost:[*],https://localhost:[*]"
        volumes:
          - <path to certs self-signed certs>:<mounted path to certs self-signed certs>
  • Once the services are defined and saved to a compose file, run the following command:

    docker compose -f <compose file> up