-
Notifications
You must be signed in to change notification settings - Fork 4
Add optional Neo4j GDS plugin installation (#1) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,7 @@ DATA_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/BloodHound-CE/$WORKSPACE" | |||||||||||||||||||||||||||||||||
| NEO4J_VOL="$DATA_DIR/neo4j" | ||||||||||||||||||||||||||||||||||
| POSTGRES_VOL="$DATA_DIR/postgres" | ||||||||||||||||||||||||||||||||||
| NETWORK="BloodHound-CE-network" | ||||||||||||||||||||||||||||||||||
| INSTALL_GDS="${INSTALL_GDS:-true}" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| BLOODHOUND_ADMIN_NAME="admin" | ||||||||||||||||||||||||||||||||||
| BLOODHOUND_ADMIN_PASSWORD="admin" | ||||||||||||||||||||||||||||||||||
|
|
@@ -88,6 +89,73 @@ function run_postgres() { | |||||||||||||||||||||||||||||||||
| >/dev/null | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| function install_gds_plugin() { | ||||||||||||||||||||||||||||||||||
| if [ "$INSTALL_GDS" = "true" ]; then | ||||||||||||||||||||||||||||||||||
| local PLUGINS_DIR="$NEO4J_VOL/plugins" | ||||||||||||||||||||||||||||||||||
| local GDS_VERSION="2.6.7" | ||||||||||||||||||||||||||||||||||
| local GDS_JAR="neo4j-graph-data-science-${GDS_VERSION}.jar" | ||||||||||||||||||||||||||||||||||
| local GDS_URL="https://github.com/neo4j/graph-data-science/releases/download/${GDS_VERSION}/${GDS_JAR}" | ||||||||||||||||||||||||||||||||||
| local GDS_SHA256="ecdad4b1050f7727af1af76579344b792b4ea8e48102955bec0e99d7cb8a46e9" | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| local GDS_SHA256="ecdad4b1050f7727af1af76579344b792b4ea8e48102955bec0e99d7cb8a46e9" | |
| # Mapping of supported GDS versions to their SHA-256 checksums. | |
| # To add support for a new version, add a new entry below: | |
| declare -A GDS_SHA256_MAP=( | |
| ["2.6.7"]="ecdad4b1050f7727af1af76579344b792b4ea8e48102955bec0e99d7cb8a46e9" | |
| # Add more versions here as needed, e.g.: | |
| # ["2.7.0"]="sha256sum_for_2.7.0" | |
| ) | |
| local GDS_SHA256="${GDS_SHA256_MAP[$GDS_VERSION]}" | |
| if [ -z "$GDS_SHA256" ]; then | |
| echo -e "${RED}Error: No SHA-256 checksum known for GDS version $GDS_VERSION.${NC}" | |
| echo "Please update the script to add the checksum for this version." | |
| return 1 | |
| fi |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition [ ! -e \"$PLUGINS_DIR\" ] will be true even if the parent directory doesn't exist, leading to attempted downloads that will fail. This doesn't properly guard against the case where $NEO4J_VOL itself doesn't exist. The download will fail but the error handling may not clearly indicate the root cause.
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NEO4J_PLUGINS environment variable is set unconditionally, even when INSTALL_GDS=false. This will cause Neo4j to expect the GDS plugin but it won't be present, potentially causing errors. This environment variable should only be set when INSTALL_GDS=true.
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The install_gds_plugin function is called before run_neo4j, but it attempts to download files to $NEO4J_VOL/plugins which may not exist yet. If Neo4j has never run, this directory won't exist and the mkdir at line 103 may fail silently due to || true. Consider ensuring the base $NEO4J_VOL directory exists before attempting plugin installation, or handle the case where the directory creation fails more explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The GDS version is hardcoded. Consider making this configurable via an environment variable (e.g.,
GDS_VERSION="${GDS_VERSION:-2.6.7}") to allow users to specify different versions without modifying the script.