Skip to content
Jens Weber edited this page May 5, 2023 · 8 revisions

Developing for/with GrapeVine

Install neo4j

Alternative 1: using Docker

This is perhaps the easiest way to get going. However, it may have some performance penalties to run neo4j in a container.

If you want to go this route, you need Docker, of course.

The current version of GrapeVine has been upgraded to support neo4j 5 (currently in version 5.7). (Note: Cypher syntax changes between Neo4J 5 and 4 mean that the latest version of GrapeVine is no longer compatible with Neo4J 4.)

The following command should do the trick. It configures Neo4J with the APOC plugin and also gives it some good heap memory. (add more if available to run more massive graph transformations)

docker run --name neo4j -p 7474:7474 -p 7687:7687 -d -v $HOME/neo4j/data:/data -v $HOME/neo4j/logs:/logs -v $HOME/neo4j/import:/var/lib/neo4j/import -v $HOME/neo4j/plugins:/plugins -e NEO4J_PLUGINS=\[\"apoc\"\] -e NEO4J_apoc_export_file_enabled=true -e NEO4J_AUTH=none -e NEO4J_apoc_import_file_use__neo4j__config=true -e NEO4J_apoc_import_file_enabled=true -e NEO4J_dbms_cypher_lenient__create__relationship=true -e NEO4J_server_memory_heap_max__size=16G  neo4j:5.7

Alternative 2: On bare metal

Install neo4j using a package manager (like homebrew) or download the tarball from the neo4j download site

Configure neo4j.conf

  • locate neo4j.conf in the neo4j home directory (called $NEO4JHOME below).
  • If you installed neo4j with homebrew, it $NEO4JHOME is likely /usr/local/Cellar/neo4j/5.7.0/
  • neo4j.conf then is likely in $NEO4JHOME/libexec/conf
  • Give neo4j more heap space: server.memory.heap.max_size=12G (at least 8G or more, if available)
  • add the following setting dbms.cypher.lenient_create_relationship=true
  • disable authentication (makes things easier for local dev): dbms.security.auth_enabled=false. If you want authentication, then set the password for user 'neo4j' to 'grape' (or change the password in the grapevine code.

Enable APOC plugin

  • Copy the APOC plugin into the plugins directory: cp $NEO4JHOME/libexec/labs/apoc-5.7.0-core.jar $NEO4JHOME/libexec/plugins
  • Create an apoc.conf file in the neo4j conf directory with the following settings:
apoc.export.file.enabled=true
apoc.import.file.use_neo4j_config=true
apoc.import.file.enabled=true

Start Neo4J

  • $NEO4JHOME/bin/neo4j-admin server console
  • If neo4j fails to start, complaining about unknown settings in neo4j.conf (which are generated by homebrew), then just delete those two settings starting with wrapper.java... and try again.

  • If neo4j complains about running on an unsupported Java version, set the right JAVA_HOME path in $NEO4J_HOME/bin/neo4j and $NEO4J_HOME/bin/neo4j-admin. (You may have to install the right Java version first. (brew install openjdk@17)

  • You should be able to login without authentication using the neo4j browser

  • You can also start neo4j as a background service, for example with brew services restart neo4j. However, the nice thing about starting neo4j console in the foreground is that you can observe error messages and warnings in the terminal window as they appear

Install Clojure

Package managers like Homebrew make this easy (but you can also do this manually)

Clone the Grape project from Github

Install GraphViz

  • brew install graphviz

Run grapevine

  • lein run in the Grape directory and then open the worksheet (or tutorial) in the browser

IDE

Any IDE will work but I like to use Calva, which is a plugin to VSCode

  • to connect to the (remote) REPL from within the IDE, use Calva: Start or Connect to a Clojure REPL (ctrl-cmd-C, ctrl-cmd-R) or choose the command from the VS Code command menu (shift-command-P), then select Connect to a running REPL, not in your project, followed by Leiningen.