Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
feat(neo4j): enhance configuration and directory structure for Neo4j integration
Dmitry Ng339aa958f056
diff --git a/.env.example b/.env.exampleindex 85308a19..696a5b9e 100644--- a/.env.example+++ b/.env.example@@ -366,6 +366,21 @@ NEO4J_MEMORY=4G## /dev/shm is a separate limit but its actual usage counts toward NEO4J_MEMORY.NEO4J_SHM_SIZE=4gNEO4J_NOFILE=65536+## JVM heap/page cache sizing; NEO4J_CPUS/NEO4J_MEMORY only cap the container. Defaults favor+## heap over page cache for a low write-throughput deployment with occasional wide reads.+NEO4J_HEAP_INITIAL_SIZE=2G+NEO4J_HEAP_MAX_SIZE=2G+NEO4J_PAGECACHE_SIZE=1G+## Caps a single transaction so one runaway query fails cleanly instead of exhausting heap.+NEO4J_TRANSACTION_MAX=1G+NEO4J_BOLT_ADVERTISED_ADDRESS=+## Set only when a reverse proxy in front of Neo4j Browser strips/rewrites the Host+## header (so the dynamic Host-header-based advertised address is wrong); format host:port.+NEO4J_HTTP_ADVERTISED_ADDRESS=++## Host directory with static, non-.env-tunable Neo4j/APOC settings and the+## pinned APOC plugin jar (conf/ and plugins/ subdirectories)+NEO4J_DIR=./neo4j## PentAGI image settingsPENTAGI_IMAGE=diff --git a/README.md b/README.mdindex 3ea28da8..df6aacca 100644--- a/README.md+++ b/README.md@@ -2826,9 +2826,21 @@ The values below are PentAGI's recommended `.env.example`/compose defaults, not| `NEO4J_CPUS`, `NEO4J_MEMORY` | `4.0`, `4G` | Neo4j container limits; use `neo4j-admin server memory-recommendation --docker` for production sizing || `NEO4J_SHM_SIZE` | `4g` | `/dev/shm` limit; actual use counts toward the container memory limit || `NEO4J_NOFILE` | `65536` | Open-file soft/hard limit, suitable for many indexes and concurrent connections |+| `NEO4J_HEAP_INITIAL_SIZE`, `NEO4J_HEAP_MAX_SIZE`, `NEO4J_PAGECACHE_SIZE` | `2G`, `2G`, `1G` | JVM heap/page cache sizing; `NEO4J_CPUS`/`NEO4J_MEMORY` only cap the container, the JVM does not reliably size itself to fit inside that cap on its own. Defaults favor heap over page cache — suited to a low write-throughput deployment with occasional wide reads, since query execution/result materialization lives in heap while a small dataset is already comfortably held by 1G of page cache; re-run `neo4j-admin server memory-recommendation --docker` once real data volume is known |+| `NEO4J_TRANSACTION_MAX` | `1G` | Caps a single transaction's memory (`db.memory.transaction.max`) so one runaway/unbounded query (e.g. a Cartesian product or an unbounded variable-length path before a `LIMIT`) fails cleanly with an out-of-memory Cypher error instead of exhausting the whole heap and taking down every other query on the server |+| `NEO4J_BOLT_ADVERTISED_ADDRESS` | empty | Set only when Neo4j Browser and the Bolt connector are reverse-proxied on different public domains (e.g. behind Guarder with CORS/cookie-group support for cross-origin bolt access); format `host:port`. Left empty, Neo4j's discovery endpoint advertises whatever `Host` header the request arrived with, which is correct only when both share one domain |+| `NEO4J_HTTP_ADVERTISED_ADDRESS` | empty | Set only when a reverse proxy in front of Neo4j Browser strips or rewrites the `Host` header, making the dynamic Host-header-based advertised address incorrect; format `host:port`. Leave empty in the common case (proxy forwards `Host` unchanged) |`NEO4J_USER`, `NEO4J_PASSWORD`, `NEO4J_URI`, and `NEO4J_DATABASE` configure the bundled connection. Neo4j Community Edition supports only its default database; do not configure a separate database name that requires Enterprise multi-database support.+The installer copies [`examples/neo4j`](examples/neo4j) beside the installation as `./neo4j`. It contains static, non-`.env`-tunable settings that don't have a `NEO4J_*` variable: `conf/neo4j.conf` and `conf/apoc.conf`, plus a version-pinned `plugins/apoc-*-core.jar`. The compose mount is controlled by:++```bash+NEO4J_DIR=./neo4j+```++`NEO4J_DIR` may point directly to `./examples/neo4j` for development. Both `conf/` and `plugins/` are mounted read-only; the stack still starts on Neo4j's built-in defaults (without APOC) if the directory is absent, since Docker creates an empty one automatically. Do not duplicate any `NEO4J_*` variable from the table above inside `conf/neo4j.conf` — the Neo4j Docker entrypoint always strips a matching line from the mounted file and re-appends the environment variable's value, so a duplicated setting in the file would be silently ignored.+The bundled stack currently wires Neo4j only. The Graphiti image contains FalkorDB support, but using it requires a separately configured deployment because the stock compose file does not expose `GRAPHITI_GRAPH_BACKEND` or `FALKORDB_*`.#### Verification and Troubleshootingdiff --git a/backend/cmd/installer/files/links/neo4j b/backend/cmd/installer/files/links/neo4jnew file mode 120000index 00000000..19ce9fa6--- /dev/null+++ b/backend/cmd/installer/files/links/neo4j@@ -0,0 +1 @@+../../../../../examples/neo4j\ No newline at end of filediff --git a/backend/cmd/installer/loader/loader.go b/backend/cmd/installer/loader/loader.goindex 3da52e39..122cbbfc 100644--- a/backend/cmd/installer/loader/loader.go+++ b/backend/cmd/installer/loader/loader.go@@ -5,6 +5,7 @@ import ("net/url""os""reflect"+ "regexp""strconv""strings""sync"@@ -14,6 +15,12 @@ import ("github.com/caarlos0/env/v10")+// envVarNameRe matches valid environment variable identifiers (e.g. OPEN_AI_KEY).+// Used to distinguish a real commented-out assignment (e.g. "#SOME_VAR=value")+// from a plain human-readable comment that merely contains a stray '=' character+// (e.g. "<=" comparisons or "empty = disabled" phrasing in descriptive text).+var envVarNameRe = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)+func LoadEnvFile(path string) (EnvFile, error) {info, err := os.Stat(path)if err != nil {@@ -51,8 +58,9 @@ func loadVars(raw string) map[string]*EnvVar {if line == "" {continue}+ isComment := falseif strings.HasPrefix(line, "#") {- envVar.IsComment = true+ isComment = trueline = trim(strings.TrimPrefix(line, "#"))}@@ -60,7 +68,17 @@ func loadVars(raw string) map[string]*EnvVar {if len(parts) != 2 {continue}- envVar.Name = trim(parts[0])+ name := trim(parts[0])+ // a commented line only represents a disabled variable assignment+ // (e.g. "#SOME_VAR=value") if what precedes '=' is a valid identifier;+ // otherwise it's just descriptive text that happens to contain '='+ // (e.g. "<=" comparisons or "empty = disabled" phrasing) and must not+ // be treated as a pseudo-variable that never resolves as "unchanged"+ if isComment && !envVarNameRe.MatchString(name) {+ continue+ }+ envVar.IsComment = isComment+ envVar.Name = nameenvVar.Value = trim(stripComments(parts[1]))envVar.IsChanged = envVar.Value != parts[1] || envVar.Name != parts[0]if envVar.Name != "" {diff --git a/backend/cmd/installer/loader/loader_test.go b/backend/cmd/installer/loader/loader_test.goindex 4af2e850..51bfd761 100644--- a/backend/cmd/installer/loader/loader_test.go+++ b/backend/cmd/installer/loader/loader_test.go@@ -544,6 +544,60 @@ func TestLoadVarsEdgeCases(t *testing.T) {}}+// TestLoadVarsCommentProseWithEquals ensures that descriptive comment lines+// containing a stray '=' character (e.g. "<=" comparisons, or "empty = disabled"+// phrasing used throughout .env.example) are not mistaken for commented-out+// variable assignments. Regression test for a bug where such comments produced+// bogus pseudo-variables that were permanently reported as "changed", causing+// "Apply Changes" to show pending changes that could never be resolved.+func TestLoadVarsCommentProseWithEquals(t *testing.T) {+ content := strings.Join([]string{+ "## Default: 1200 (20 minutes). Range: 1-10800 (up to 3 hours). Values <= 0 or above 10800 are clamped to 10800.",+ "TERMINAL_TOOL_TIMEOUT=1200",+ "",+ "## Go pprof HTTP listener (empty = disabled). Use host:port, e.g. :7777.",+ "PPROF_ADDR=",+ "",+ "## one worker node, one Neo4j/Graphiti, one Langfuse (empty = standalone instance).",+ "TENANT_ID=",+ "",+ "#REAL_COMMENTED_VAR=commented_value",+ }, "\n")++ vars := loadVars(content)++ for name, envVar := range vars {+ if envVar.IsComment {+ continue+ }+ if strings.ContainsAny(name, " #<>().,:") {+ t.Errorf("found bogus pseudo-variable parsed from comment prose: %q (value=%q)", name, envVar.Value)+ }+ }++ // a genuine commented-out assignment must still be recognized+ commented, ok := vars["REAL_COMMENTED_VAR"]+ if !ok {+ t.Fatal("expected REAL_COMMENTED_VAR to be parsed from a real commented-out assignment")+ }+ if !commented.IsComment || commented.Value != "commented_value" {+ t.Errorf("REAL_COMMENTED_VAR parsed incorrectly: %+v", commented)+ }++ // real variables following prose comments must still parse correctly and+ // must never be permanently marked as changed+ for _, name := range []string{"TERMINAL_TOOL_TIMEOUT", "PPROF_ADDR", "TENANT_ID"} {+ envVar, ok := vars[name]+ if !ok {+ t.Errorf("expected %s to be parsed", name)+ continue+ }+ if envVar.IsChanged {+ t.Errorf("%s should not be marked as changed, got IsChanged=true", name)+ }+ }+}+func TestPatchRaw(t *testing.T) {envFile := &envFile{vars: map[string]*EnvVar{diff --git a/backend/cmd/installer/processor/fs.go b/backend/cmd/installer/processor/fs.goindex 5a2b1968..7c2605c6 100644--- a/backend/cmd/installer/processor/fs.go+++ b/backend/cmd/installer/processor/fs.go@@ -16,6 +16,7 @@ import (const (observabilityDirectory = "observability"graphitiConfigsDirectory = "graphiti"+ neo4jDirectory = "neo4j"pentagiExampleCustomConfigLLM = "example.custom.provider.yml"pentagiExampleOllamaConfigLLM = "example.ollama.provider.yml")@@ -25,6 +26,15 @@ var filesToExcludeFromVerification = []string{"observability/grafana/config/grafana.ini",pentagiExampleCustomConfigLLM,pentagiExampleOllamaConfigLLM,+ // user-editable Neo4j/APOC static settings: created once if missing, never+ // overwritten afterwards, even when the user forces a files update+ "neo4j/conf/neo4j.conf",+ "neo4j/conf/apoc.conf",+ // user-editable Graphiti LLM provider presets: same "create once" policy+ "graphiti/custom.yaml",+ "graphiti/gemini.yaml",+ "graphiti/litellm.yaml",+ "graphiti/openai.yaml",}var allStacks = []ProductStack{@@ -56,7 +66,8 @@ func (fs *fileSystemOperationsImpl) ensureStackIntegrity(ctx context.Context, stcase ProductStackGraphiti:errCompose := fs.ensureFileFromEmbed(composeFileGraphiti, state)errConfigs := fs.ensureDirectoryFromEmbed(graphitiConfigsDirectory, state)- return errors.Join(errCompose, errConfigs)+ errNeo4j := fs.ensureDirectoryFromEmbed(neo4jDirectory, state)+ return errors.Join(errCompose, errConfigs, errNeo4j)case ProductStackLangfuse:return fs.ensureFileFromEmbed(composeFileLangfuse, state)@@ -92,7 +103,10 @@ func (fs *fileSystemOperationsImpl) verifyStackIntegrity(ctx context.Context, stif err := fs.verifyFileIntegrity(composeFileGraphiti, state); err != nil {return err}- return fs.verifyDirectoryIntegrity(graphitiConfigsDirectory, state)+ if err := fs.verifyDirectoryIntegrity(graphitiConfigsDirectory, state); err != nil {+ return err+ }+ return fs.verifyDirectoryIntegrity(neo4jDirectory, state)case ProductStackLangfuse:return fs.verifyFileIntegrity(composeFileLangfuse, state)@@ -132,6 +146,11 @@ func (fs *fileSystemOperationsImpl) checkStackIntegrity(ctx context.Context, sta} else {maps.Copy(result, r)}+ if r, err := fs.checkDirectoryIntegrity(neo4jDirectory); err != nil {+ return result, err+ } else {+ maps.Copy(result, r)+ }case ProductStackLangfuse:result[composeFileLangfuse] = fs.checkFileIntegrity(composeFileLangfuse)@@ -177,6 +196,7 @@ func (fs *fileSystemOperationsImpl) cleanupStackFiles(ctx context.Context, stackcase ProductStackGraphiti:filesToRemove = append(filesToRemove, filepath.Join(workingDir, composeFileGraphiti))filesToRemove = append(filesToRemove, filepath.Join(workingDir, graphitiConfigsDirectory))+ filesToRemove = append(filesToRemove, filepath.Join(workingDir, neo4jDirectory))case ProductStackLangfuse:filesToRemove = append(filesToRemove, filepath.Join(workingDir, composeFileLangfuse))diff --git a/backend/cmd/installer/processor/fs_test.go b/backend/cmd/installer/processor/fs_test.goindex 9ec7559f..4ad9b937 100644--- a/backend/cmd/installer/processor/fs_test.go+++ b/backend/cmd/installer/processor/fs_test.go@@ -229,6 +229,69 @@ func TestFileSystemOperationsImpl_VerifyDirectoryContentIntegrity(t *testing.T)}}+// TestFileSystemOperationsImpl_UserEditableFilesExcluded ensures the specific+// user-editable static config files (Neo4j/APOC settings and Graphiti LLM+// provider presets) are registered in the exclusion policy: created once if+// missing, but never overwritten afterwards even when force=true is used.+func TestFileSystemOperationsImpl_UserEditableFilesExcluded(t *testing.T) {+ processor := createTestProcessor()+ fsOps := newFileSystemOperations(processor).(*fileSystemOperationsImpl)++ mustBeExcluded := []string{+ "neo4j/conf/neo4j.conf",+ "neo4j/conf/apoc.conf",+ "graphiti/custom.yaml",+ "graphiti/gemini.yaml",+ "graphiti/litellm.yaml",+ "graphiti/openai.yaml",+ }++ for _, path := range mustBeExcluded {+ if !fsOps.isExcludedFromVerification(path) {+ t.Errorf("expected %s to be excluded from verification (user-editable), but it is not", path)+ }+ }+}++// TestFileSystemOperationsImpl_UserEditableFilesNeverOverwritten verifies the+// end-to-end behavior via verifyDirectoryContentIntegrity: a modified+// user-editable file is left untouched even when force=true is set, unlike a+// regular (non-excluded) modified file in the same directory.+func TestFileSystemOperationsImpl_UserEditableFilesNeverOverwritten(t *testing.T) {+ tmpDir := t.TempDir()+ targetPath := filepath.Join(tmpDir, neo4jDirectory)++ processor := createTestProcessor()+ mockState := processor.state.(*mockState)+ mockState.envPath = filepath.Join(tmpDir, ".env")++ mockFiles := processor.files.(*mockFiles)+ regularFile := "neo4j/plugins/apoc-core.jar"+ mockFiles.lists[neo4jDirectory] = []string{+ "neo4j/conf/neo4j.conf",+ regularFile,+ }+ mockFiles.statuses["neo4j/conf/neo4j.conf"] = files.FileStatusModified+ mockFiles.statuses[regularFile] = files.FileStatusModified+ mockFiles.AddFile(neo4jDirectory, []byte{})++ _ = os.MkdirAll(targetPath, 0o755)++ fsOps := newFileSystemOperations(processor).(*fileSystemOperationsImpl)+ state := &operationState{force: true, mx: &sync.Mutex{}, ctx: t.Context()}++ err := fsOps.verifyDirectoryIntegrity(neo4jDirectory, state)+ assertNoError(t, err)++ if len(mockFiles.copies) != 1 {+ t.Fatalf("expected exactly 1 copy (only the non-excluded modified file), got %d: %+v",+ len(mockFiles.copies), mockFiles.copies)+ }+ if mockFiles.copies[0].Src != regularFile {+ t.Errorf("expected only %s to be updated, got copy of %s instead", regularFile, mockFiles.copies[0].Src)+ }+}+func TestFileSystemOperationsImpl_ExcludedFilesHandling(t *testing.T) {if len(filesToExcludeFromVerification) == 0 {t.Skip("no excluded files configured; skipping excluded files tests")@@ -520,6 +583,14 @@ func TestCheckStackIntegrity(t *testing.T) {"graphiti/openai.yaml",}m.statuses["graphiti/openai.yaml"] = files.FileStatusOK+ m.lists[neo4jDirectory] = []string{+ "neo4j/conf/neo4j.conf",+ "neo4j/conf/apoc.conf",+ "neo4j/plugins/apoc-core.jar",+ }+ m.statuses["neo4j/conf/neo4j.conf"] = files.FileStatusOK+ m.statuses["neo4j/conf/apoc.conf"] = files.FileStatusOK+ m.statuses["neo4j/plugins/apoc-core.jar"] = files.FileStatusOK// langfusem.statuses[composeFileLangfuse] = files.FileStatusModified// observability@@ -530,12 +601,15 @@ func TestCheckStackIntegrity(t *testing.T) {m.statuses["observability/config.yml"] = files.FileStatusOK},expected: map[string]files.FileStatus{- composeFilePentagi: files.FileStatusOK,- composeFileGraphiti: files.FileStatusOK,- "graphiti/openai.yaml": files.FileStatusOK,- composeFileLangfuse: files.FileStatusModified,- composeFileObservability: files.FileStatusMissing,- "observability/config.yml": files.FileStatusOK,+ composeFilePentagi: files.FileStatusOK,+ composeFileGraphiti: files.FileStatusOK,+ "graphiti/openai.yaml": files.FileStatusOK,+ "neo4j/conf/neo4j.conf": files.FileStatusOK,+ "neo4j/conf/apoc.conf": files.FileStatusOK,+ "neo4j/plugins/apoc-core.jar": files.FileStatusOK,+ composeFileLangfuse: files.FileStatusModified,+ composeFileObservability: files.FileStatusMissing,+ "observability/config.yml": files.FileStatusOK,},},{@@ -550,6 +624,14 @@ func TestCheckStackIntegrity(t *testing.T) {"graphiti/openai.yaml",}m.statuses["graphiti/openai.yaml"] = files.FileStatusOK+ m.lists[neo4jDirectory] = []string{+ "neo4j/conf/neo4j.conf",+ "neo4j/conf/apoc.conf",+ "neo4j/plugins/apoc-core.jar",+ }+ m.statuses["neo4j/conf/neo4j.conf"] = files.FileStatusOK+ m.statuses["neo4j/conf/apoc.conf"] = files.FileStatusOK+ m.statuses["neo4j/plugins/apoc-core.jar"] = files.FileStatusOK// langfusem.statuses[composeFileLangfuse] = files.FileStatusModified// observability@@ -560,12 +642,15 @@ func TestCheckStackIntegrity(t *testing.T) {m.statuses["observability/config.yml"] = files.FileStatusOK},expected: map[string]files.FileStatus{- composeFilePentagi: files.FileStatusOK,- composeFileGraphiti: files.FileStatusOK,- "graphiti/openai.yaml": files.FileStatusOK,- composeFileLangfuse: files.FileStatusModified,- composeFileObservability: files.FileStatusMissing,- "observability/config.yml": files.FileStatusOK,+ composeFilePentagi: files.FileStatusOK,+ composeFileGraphiti: files.FileStatusOK,+ "graphiti/openai.yaml": files.FileStatusOK,+ "neo4j/conf/neo4j.conf": files.FileStatusOK,+ "neo4j/conf/apoc.conf": files.FileStatusOK,+ "neo4j/plugins/apoc-core.jar": files.FileStatusOK,+ composeFileLangfuse: files.FileStatusModified,+ composeFileObservability: files.FileStatusMissing,+ "observability/config.yml": files.FileStatusOK,},},{@@ -629,6 +714,14 @@ func TestCheckStackIntegrity_RealFiles(t *testing.T) {"graphiti/openai.yaml",}mockFiles.statuses["graphiti/openai.yaml"] = files.FileStatusOK+ mockFiles.lists[neo4jDirectory] = []string{+ "neo4j/conf/neo4j.conf",+ "neo4j/conf/apoc.conf",+ "neo4j/plugins/apoc-core.jar",+ }+ mockFiles.statuses["neo4j/conf/neo4j.conf"] = files.FileStatusOK+ mockFiles.statuses["neo4j/conf/apoc.conf"] = files.FileStatusOK+ mockFiles.statuses["neo4j/plugins/apoc-core.jar"] = files.FileStatusOKmockFiles.statuses[composeFileLangfuse] = files.FileStatusModifiedmockFiles.statuses[composeFileObservability] = files.FileStatusMissingmockFiles.lists[observabilityDirectory] = []string{@@ -651,7 +744,7 @@ func TestCheckStackIntegrity_RealFiles(t *testing.T) {}// Verify all files are captured- expectedCount := 7 // 4 compose files + 1 Graphiti config + 2 observability files+ expectedCount := 10 // 4 compose files + 1 Graphiti config + 3 Neo4j files + 2 observability filesif len(result) != expectedCount {t.Errorf("expected %d files, got %d", expectedCount, len(result))}diff --git a/backend/cmd/installer/wizard/locale/locale.go b/backend/cmd/installer/wizard/locale/locale.goindex 82e5883f..24873983 100644--- a/backend/cmd/installer/wizard/locale/locale.go+++ b/backend/cmd/installer/wizard/locale/locale.go@@ -841,6 +841,7 @@ Graphiti provides temporal knowledge graph capabilities:• Flow-scoped contextual searchGraphiti reuses credentials configured in the LLM Providers and Embeddings screens. LiteLLM credentials remain in .env. Select the provider preset here; configure its models in ./graphiti/<provider>.yaml.+Supports openai, gemini, litellm, custom.Choose between embedded instance or external connection.`@@ -857,7 +858,7 @@ Choose between embedded instance or external connection.`MonitoringGraphitiTimeout = "Request Timeout"MonitoringGraphitiTimeoutDesc = "Timeout in seconds for Graphiti operations"MonitoringGraphitiLLMClientType = "LLM Provider Preset"- MonitoringGraphitiLLMClientTypeDesc = "Provider preset; credentials come from LLM Providers (LiteLLM from .env) and models from ./graphiti/<provider>.yaml"+ MonitoringGraphitiLLMClientTypeDesc = "Provider preset; credentials come from LLM Providers (openai, gemini, litellm, custom) and models from ./graphiti/<provider>.yaml"MonitoringGraphitiSeparateEmbedding = "Use Separate Embedding Endpoint"MonitoringGraphitiSeparateEmbeddingDesc = "Use the shared Embeddings configuration instead of the selected LLM credentials"MonitoringGraphitiSemaphoreLimit = "Coroutine Limit"diff --git a/docker-compose-graphiti.yml b/docker-compose-graphiti.ymlindex 10979996..31df8031 100644--- a/docker-compose-graphiti.yml+++ b/docker-compose-graphiti.yml@@ -15,7 +15,7 @@ services:container_name: neo4jhostname: neo4jhealthcheck:- test: ["CMD-SHELL", "wget -qO- http://localhost:7474 || exit 1"]+ test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:7474 || exit 1"]interval: 1stimeout: 10sretries: 10@@ -38,8 +38,21 @@ services:max-file: "7"volumes:- neo4j_data:/data+ - ${NEO4J_DIR:-./neo4j}/conf:/conf:ro+ - ${NEO4J_DIR:-./neo4j}/plugins:/plugins:ro+ - ${NEO4J_DIR:-./neo4j}/logs:/logs+ - ${NEO4J_DIR:-./neo4j}/import:/import+ - ${NEO4J_DIR:-./neo4j}/metrics:/metrics+ - ${NEO4J_DIR:-./neo4j}/ssl:/ssl:ro+ - ${NEO4J_DIR:-./neo4j}/backups:/backupsenvironment:- NEO4J_AUTH=${NEO4J_USER:-neo4j}/${NEO4J_PASSWORD:-devpassword}+ - NEO4J_server_bolt_advertised__address=${NEO4J_BOLT_ADVERTISED_ADDRESS:-}+ - NEO4J_server_http_advertised__address=${NEO4J_HTTP_ADVERTISED_ADDRESS:-}+ - NEO4J_server_memory_heap_initial__size=${NEO4J_HEAP_INITIAL_SIZE:-2G}+ - NEO4J_server_memory_heap_max__size=${NEO4J_HEAP_MAX_SIZE:-2G}+ - NEO4J_server_memory_pagecache_size=${NEO4J_PAGECACHE_SIZE:-1G}+ - NEO4J_db_memory_transaction_max=${NEO4J_TRANSACTION_MAX:-1G}networks:- pentagi-networkshm_size: ${NEO4J_SHM_SIZE:-4g}diff --git a/docker-compose.yml b/docker-compose.ymlindex 91623065..97c5a7ae 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -127,6 +127,13 @@ services:- GRAPHITI_ENABLED=${GRAPHITI_ENABLED:-}- GRAPHITI_TIMEOUT=${GRAPHITI_TIMEOUT:-}- GRAPHITI_URL=${GRAPHITI_URL:-}+ - NEO4J_URI=${NEO4J_URI:-}+ - NEO4J_USER=${NEO4J_USER:-}+ - NEO4J_PASSWORD=${NEO4J_PASSWORD:-}+ - NEO4J_DATABASE=${NEO4J_DATABASE:-}+ - NEO4J_POLL_INTERVAL=${NEO4J_POLL_INTERVAL:-}+ - NEO4J_IDLE_TIMEOUT=${NEO4J_IDLE_TIMEOUT:-}+ - NEO4J_QUERIES_FILE=${NEO4J_QUERIES_FILE:-}- PUBLIC_URL=${PUBLIC_URL:-}- STATIC_DIR=${STATIC_DIR:-}- STATIC_URL=${STATIC_URL:-}diff --git a/examples/neo4j/conf/apoc.conf b/examples/neo4j/conf/apoc.confnew file mode 100644index 00000000..80cd3ee0--- /dev/null+++ b/examples/neo4j/conf/apoc.conf@@ -0,0 +1,11 @@+# APOC static configuration for the Graphiti stack (examples/neo4j/conf).+#+# Purely static plugin settings; none of these have an equivalent NEO4J_*+# environment variable in .env.example, so there is nothing to dedupe here.+# The APOC plugin jar itself ships in the sibling ../plugins directory and is+# bind-mounted read-only to /plugins by docker-compose-graphiti.yml (via+# NEO4J_DIR); Neo4j loads any jar present there automatically at startup.+apoc.export.file.enabled=true+apoc.import.file.enabled=true+apoc.import.file.use_neo4j_config=true+apoc.import.file.max_memory=1Gdiff --git a/examples/neo4j/conf/neo4j.conf b/examples/neo4j/conf/neo4j.confnew file mode 100644index 00000000..85971ef5--- /dev/null+++ b/examples/neo4j/conf/neo4j.conf@@ -0,0 +1,47 @@+# Neo4j static configuration for the Graphiti stack (examples/neo4j/conf).+#+# Only settings that are NOT user-tunable via .env live here. User-facing+# settings (credentials, memory sizing, bolt advertised address, CPU/RAM+# limits, shm size, ulimits) are provided as NEO4J_* environment variables+# from .env / .env.example and applied through docker-compose-graphiti.yml.+#+# Do not duplicate those here: the Neo4j Docker entrypoint always strips a+# matching line from this file and re-appends the environment variable's+# value, so any duplicated setting would be silently ignored anyway.+#+# This file is optional: docker-compose-graphiti.yml mounts this directory as+# /conf via NEO4J_DIR, and Neo4j starts fine with image defaults if absent/empty.++# Security: APOC needs unrestricted/allowlisted access to its own procedures;+# scope this to the apoc.* namespace instead of allowing every procedure.+dbms.security.procedures.unrestricted=apoc.*+dbms.security.procedures.allowlist=apoc.*+dbms.security.auth_enabled=true++# Logging+db.logs.query.enabled=INFO++# Connectors bind on all interfaces inside the container; the host-side+# binding/exposure is controlled by the "ports" mapping in+# docker-compose-graphiti.yml, not here.+server.default_listen_address=0.0.0.0++# Bolt connector (plaintext). TLS is intentionally left DISABLED because this+# compose stack does not provision an SSL policy/certificates for Neo4j;+# enable it only after configuring dbms.ssl.policy.bolt.* and mounting certs.+server.bolt.enabled=true+server.bolt.tls_level=DISABLED+server.bolt.listen_address=0.0.0.0:7687++# HTTP connector+server.http.enabled=true+server.http.listen_address=0.0.0.0:7474++# Performance tuning independent of heap/pagecache sizing (which is set via+# NEO4J_HEAP_INITIAL_SIZE / NEO4J_HEAP_MAX_SIZE / NEO4J_PAGECACHE_SIZE).+server.memory.pagecache.flush.buffer.enabled=true+server.memory.pagecache.flush.buffer.size_in_pages=512++# Runaway query / lock protection+db.transaction.timeout=15m+db.lock.acquisition.timeout=15mdiff --git a/examples/neo4j/plugins/LICENSE.txt b/examples/neo4j/plugins/LICENSE.txtnew file mode 100644index 00000000..c74ef5df--- /dev/null+++ b/examples/neo4j/plugins/LICENSE.txt@@ -0,0 +1,201 @@+ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "{}"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright {yyyy} {name of copyright owner}++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.diff --git a/examples/neo4j/plugins/apoc-5.26.19-core.jar b/examples/neo4j/plugins/apoc-5.26.19-core.jarnew file mode 100644index 00000000..2033a071Binary files /dev/null and b/examples/neo4j/plugins/apoc-5.26.19-core.jar differ