Bobcares

Deploy neo4j docker-compose apoc

by | Dec 16, 2022

Wondering how to neo4j docker-compose apoc? you are in luck! Our experts have put together this guide to help you get started. Our Docker Support team is here to lend a hand with your queries and issues.

How to deploy neo4j docker-compose apoc?

First and foremost, Neo4j docker image provides an awesome graph database with convenient web UI.

However, it does not include plugins which support additional library.

We need to do some manual set up before being able to deploy the container with plugins.

Neo4j plugins

APOC stands for Awesome Procedures on Cypher, a standard utility library for common procedures and functions.

This allows developers across platforms and industries to use a standard library for common procedures and only write their own functionality for business logic and use-case-specific needs.

Graph algorithms provide one of the most potent approaches to analyzing connect data because their mathematical calculations are specifically built to operate on relationships.

They describe steps to take to process a graph to discover its general qualities or specific quantities.

Set up directories for volumes

In this, we need to create some directories under the work directory for Docker volumes.

$ mkdir data
$ mkdir logs
$ mkdir conf
$ mkdir plugins

Next, we need to generate the initial config file, we can dump it from the container

$ docker run --rm --volume=$(pwd)/conf:/conf neo4j:3.5.3 dump-config

which will download the configuration file to conf directory under the current host directory.

Download the plugin

In order to use plugins, find and download jar file of the plugins released on their websites, and store it in the plugins directory.

Edit the configuration file

Modify neo4j.conf by adding these line:

dbms.security.procedures.whitelist=algo.*,apoc.*
dbms.security.procedures.unrestricted=algo.*,apoc.*

Deploy the Neo4j container

Run the container, now using folder under working directory.

docker run -d \
--publish=7474:7474 \
--publish=7687:7687 \
--volume=$(pwd)/data:/data \
--volume=$(pwd)/logs:/logs \
--volume=$(pwd)/conf:/conf \
--volume=$(pwd)/plugins:/plugins \
--env=NEO4J_AUTH=none \
--name my_neo4j neo4j:3.2.3

The container:

Run as daemon
Publish 2 ports: 7474, 7687
Data is stored in data directory
Log is written to logs directory
Config is used from conf directory
Plugins are used in plugins directory
No authentication is required (we could set/require it by using --env NEO4J_AUTH=neo4j/<password> instead)

Confirm deployment

Check the status of the container by command:

$ docker ps

Then if the container is running, we can access to the Neo4j Browser UI at the address http://localhost:7474 and check the installation of the plugins by the Cypher command:

CALL algo.list();
CALL apoc.index.list();

If you prefer Python, py2neo module provides a way to connect to the database via this code:

from py2neo import Graph
graph = Graph("bolt://localhost:7474", auth=("neo4j_username", "password"))

Conclusion

To conclude, our Support Engineers demonstrated how to deploy neo4j docker-compose apoc.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.