cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Docker compose configuration for neosemantics errors out

I'm trying to get neosemantics working in a docker container. Has anyone been able to successfully get this running?

I get the following error:

...
2020-03-31 14:35:55.241+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.AbstractNeoServer$ServerComponentsLifecycleAdapter@7e14627b' was successfully initialized, but failed to start. Please see the attached cause exception "The ResourceConfig instance does not contain any root resource classes."
...

Here is my docker-compose.yml file:

version: '3'

services:
  neo4j:
    container_name: neo4j
    image: neo4j:3.5.16
    restart: always
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_AUTH=neo4j/mypassword
      - NEO4J_HOME=/var/lib/neo4j
      - NEO4J_dbms_unmanaged__extension__classes=semantics_extension=/rdf
      - NEO4J_dbms_security_procedures_whitelist=apoc.*, semantics.*
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*, semantics.*
      - NEO4J_apoc_export_file_enabled=true
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_apoc_import_file_use__neo4j__config=true
    volumes:
      - ~/Data/neo4j/data:/var/lib/neo4j/data
      - ~/Data/neo4j/import:/var/lib/neo4j/import
      - ~/Data/neo4j/conf:/var/lib/neo4j/conf
      - ~/Data/neo4j/logs:/var/lib/neo4j/logs
      - ~/Data/neo4j/plugins:/var/lib/neo4j/plugins
      - ~/Data/neo4j/rdf:/var/lib/neo4j/rdf

Update: I changed - NEO4J_dbms_unmanaged__extension__classes=semantics_extension=/rdf to - NEO4J_dbms_unmanaged__extension__classes=semantics.extension=/rdf
Now it no longer errors out, but when I try to use the semantics.importRDF() procedure I get the following error: There is no procedure with the name `semantics.importRDF` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.

1 ACCEPTED SOLUTION

Here is the working solution for me:

version: '3'

services:
  neo4j:
    container_name: neo4j
    image: neo4j:3.5.16
    restart: always
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_AUTH=neo4j/superSecretPassword
      - NEO4J_HOME=/var/lib/neo4j
      - NEO4J_dbms_unmanaged__extension__classes=semantics.extension=/rdf
      - NEO4J_dbms_security_procedures_whitelist=apoc.coll.*,apoc.load.*,semantics.*
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*,semantics.*
      - NEO4J_apoc_export_file_enabled=true
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_apoc_import_file_use__neo4j__config=true
    volumes:
      - ~/Data/neo4j/data:/var/lib/neo4j/data
      - ~/Data/neo4j/import:/var/lib/neo4j/import
      - ~/Data/neo4j/conf:/var/lib/neo4j/conf
      - ~/Data/neo4j/logs:/var/lib/neo4j/logs
      - ~/Data/neo4j/plugins:/var/lib/neo4j/plugins
      - ~/Data/neo4j/rdf:/var/lib/neo4j/rdf

It turns out, unbeknownst to me until now that neo4j desktop creates it's own instance(s) of the neo4j database. You can't (as far as I can tell) connect neo4j desktop to a running instance of neo4j in a docker container on your host machine. On a mac database instances are stored at /Users/chrisc/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases. When I deleted the databases created by Neo4j Desktop and used a standard web browser to connect to the docker instance, it worked correctly.

View solution in original post

3 REPLIES 3

It may not be the only issue you face, but your procedures whitelist and unrestricted settings are incorrect. See the APOC documentation for how to configure this with docker, and use a similar pattern for neosemantics.

https://neo4j.com/docs/labs/apoc/current/introduction/#_using_apoc_with_the_neo4j_docker_image

The example uses
-e NEO4J_dbms_security_procedures_unrestricted=apoc.\\\*
added to the docker run command. I'm not using the docker run command, I'm using docker-compose adding

- NEO4J_dbms_security_procedures_unrestricted=apoc.*, semantics.*

as an environment variable. As I understand docker compose, you don't need to escape the wildcard (apoc.\\\*) like you would in a docker run command. At any rate, I've tried it both ways and neo4j can't find the plugin when I try to use it. Anything else you might see?

Here is the working solution for me:

version: '3'

services:
  neo4j:
    container_name: neo4j
    image: neo4j:3.5.16
    restart: always
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      - NEO4J_AUTH=neo4j/superSecretPassword
      - NEO4J_HOME=/var/lib/neo4j
      - NEO4J_dbms_unmanaged__extension__classes=semantics.extension=/rdf
      - NEO4J_dbms_security_procedures_whitelist=apoc.coll.*,apoc.load.*,semantics.*
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*,semantics.*
      - NEO4J_apoc_export_file_enabled=true
      - NEO4J_apoc_import_file_enabled=true
      - NEO4J_apoc_import_file_use__neo4j__config=true
    volumes:
      - ~/Data/neo4j/data:/var/lib/neo4j/data
      - ~/Data/neo4j/import:/var/lib/neo4j/import
      - ~/Data/neo4j/conf:/var/lib/neo4j/conf
      - ~/Data/neo4j/logs:/var/lib/neo4j/logs
      - ~/Data/neo4j/plugins:/var/lib/neo4j/plugins
      - ~/Data/neo4j/rdf:/var/lib/neo4j/rdf

It turns out, unbeknownst to me until now that neo4j desktop creates it's own instance(s) of the neo4j database. You can't (as far as I can tell) connect neo4j desktop to a running instance of neo4j in a docker container on your host machine. On a mac database instances are stored at /Users/chrisc/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases. When I deleted the databases created by Neo4j Desktop and used a standard web browser to connect to the docker instance, it worked correctly.