I am trying to refer to this link of documentation: Cypher init script - APOC Extended Documentation
This is my docker command:
docker run --rm \
--env NEO4J_AUTH="neo4j/test" \
--env NEO4JLABS_PLUGINS='["apoc"]' \
--env NEO4J_apoc_export_file_enabled="true" \
--env NEO4J_apoc_import_file_enabled="true" \
--env NEO4J_apoc_import_file_use__neo4j__config="true" \
--env NEO4J_dbms_directories_import="/" \
--env NEO4J_apoc_initializer_neo4j_1='CALL apoc.cypher.runSchemaFile("file:////var/lib/neo4j/db_init_scripts/db_ddls.cypher");' \
--env NEO4J_apoc_initializer_neo4j_2='CALL apoc.cypher.runFile("file:////var/lib/neo4j/db_init_scripts/db_schema.cypher");' \
--name neo4j \
neo4j:cus
where neo4j:cus is my custom image where I copied the required cypher files into neo4j:4.2 image
My db_ddl.cypher has create indexes:
CREATE CONSTRAINT idx_person_unq IF NOT EXISTS ON (p:Person) ASSERT p.name IS UNIQUE;
My db_schema.cypher has schema creation:
MERGE (p:Person {name: "Inital Person"});
When I try to start the container, I get below message:
Unrecognized setting. No declared setting with name: apoc.initializer.cypher.1
Unrecognized setting. No declared setting with name: apoc.initializer.cypher.2
When I try to use, older version of environment variables:
--env NEO4J_apoc_initializer_cypher_1='CALL apoc.cypher.runSchemaFile("file:////var/lib/neo4j/db_init_scripts/db_schema.cypher");' \
--env NEO4J_apoc_initializer_cypher_2='CALL apoc.cypher.runFile("file:////var/lib/neo4j/db_init_scripts/db_ddls.cypher");' \
I get this:
Unrecognized setting. No declared setting with name: apoc.initializer.cypher.1
Unrecognized setting. No declared setting with name: apoc.initializer.cypher.2
But when I try to run only one cypher:
--env NEO4J_apoc_initializer_cypher='CALL apoc.cypher.runSchemaFile("file:////var/lib/neo4j/db_init_scripts/db_ddls.cypher");' \
Then it works.
This is how my conf/neo4j.conf looks:
root@4f8955759b52:/var/lib/neo4j# grep apoc conf/neo4j.conf
#dbms.security.procedures.allowlist=apoc.coll.*,apoc.load.*,gds.*
apoc.initializer.neo4j.1=CALL apoc.cypher.runFile("file:////var/lib/neo4j/db_init_scripts/db_schema.cypher");
apoc.initializer.neo4j.0=CALL apoc.cypher.runSchemaFile("file:////var/lib/neo4j/db_init_scripts/db_ddls.cypher");
apoc.import.file.use_neo4j_config=true
apoc.import.file.enabled=true
apoc.export.file.enabled=true
dbms.security.procedures.unrestricted=apoc.*
Can anyone point what I am missing so that I can run both creation of indexes as well as initialize some schema as well?
Thanks