From b0ba718a441ee2e00300f01c67a07555d8e2b9e6 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 27 Mar 2025 15:46:27 +0000 Subject: [PATCH 1/3] added new instructions for building using docker hub images --- pages/custom-query-modules.mdx | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/pages/custom-query-modules.mdx b/pages/custom-query-modules.mdx index 36b607926..1e92835ca 100644 --- a/pages/custom-query-modules.mdx +++ b/pages/custom-query-modules.mdx @@ -81,10 +81,10 @@ Then, select a language you want to develop in. {

Download the MAGE image

} - Run the following command to get the Memgraph and MAGE development Docker image: + Run the following commands to get the Memgraph and MAGE Docker image and download the toolchain used for building modules: ```shell - docker run -p 7687:7687 memgraph/memgraph-mage:-dev + docker run -p 7687:7687 memgraph/memgraph-mage: ``` By running this command, you will get an image with the following tools @@ -106,15 +106,23 @@ Then, select a language you want to develop in. Use the following command to start the MAGE container: ```shell - docker run --rm -p 7687:7687 --name mage memgraph-mage:version-dev + docker run --rm -p 7687:7687 --name mage memgraph-mage: ``` Be sure to replace the version with the specific version, for example: ```shell - docker run --rm -p 7687:7687 --name mage memgraph-mage:1.4-dev + docker run --rm -p 7687:7687 --name mage memgraph-mage:3.1.1 ``` + {

Download and install toolchain and development dependencies

} + + Run the `make-dev-container.sh` script as `root` within the container to download the current toolchain version and install required `apt` packages: + + ```shell + docker exec -i -u root mage bash -c "./make-dev-container.sh" + ```` + {

Copy the files to the container

} Copy the files to the container named `mage`: @@ -125,10 +133,10 @@ Then, select a language you want to develop in. {

Enter the container

} - Position yourself inside the container as `root`: + Position yourself inside the container as `memgraph`: ```shell - docker exec -u root -it mage /bin/bash + docker exec -u memgraph -it mage /bin/bash ``` @@ -144,10 +152,15 @@ Then, select a language you want to develop in. {

Build MAGE

} - Build MAGE with the option to copy executables from `mage/dist` to `/usr/lib/memgraph/query_modules`: + Build MAGE: + + ```shell + python3 setup build + ``` + Then copy executables from `/mage/dist` to `/usr/lib/memgraph/query_modules` as `root`: ```shell - python3 setup build -p /usr/lib/memgraph/query_modules/ + docker exec -i -u root mage bash -c "cp -vr /mage/dist/* /usr/lib/memgraph/query_modules/" ``` {

Exit the container

} @@ -389,6 +402,11 @@ Then, select a language you want to develop in. + + + We currently do not produce MAGE images with cuGraph (since version 1.3). If this is something you require, please raise an [issue](https://github.com/memgraph/mage/issues) + + {

Download MAGE source code

} From e55aa5033226006957aae74d0d9e8bc912797e30 Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 27 Mar 2025 16:30:13 +0000 Subject: [PATCH 2/3] fix some mistakes --- pages/custom-query-modules.mdx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pages/custom-query-modules.mdx b/pages/custom-query-modules.mdx index 1e92835ca..ba3ba1749 100644 --- a/pages/custom-query-modules.mdx +++ b/pages/custom-query-modules.mdx @@ -87,9 +87,6 @@ Then, select a language you want to develop in. docker run -p 7687:7687 memgraph/memgraph-mage: ``` - By running this command, you will get an image with the following tools - installed: `Python3`, `Rust`, `Clang`, `Make`, and `CMake`. - {

Develop a query

} When developing with Mage, take a look at the basis of developed [algorithms and utility procedures](https://github.com/memgraph/mage) and extend based on that. @@ -109,7 +106,7 @@ Then, select a language you want to develop in. docker run --rm -p 7687:7687 --name mage memgraph-mage: ``` - Be sure to replace the version with the specific version, for example: + Be sure to replace the `` with the specific version, for example: ```shell docker run --rm -p 7687:7687 --name mage memgraph-mage:3.1.1 @@ -123,6 +120,9 @@ Then, select a language you want to develop in. docker exec -i -u root mage bash -c "./make-dev-container.sh" ```` + By running this command, your your container will have the following tools + installed: `Python3`, `Rust`, `Clang`, `Make`, and `CMake` alongside the toolchain used to build both Memgraph and MAGE. + {

Copy the files to the container

} Copy the files to the container named `mage`: @@ -152,9 +152,10 @@ Then, select a language you want to develop in. {

Build MAGE

} - Build MAGE: + Activate the toolchain and build MAGE: ```shell + source /opt/toolchain-v6/activate python3 setup build ``` From f345ba900d40dfe81cf3b7f1f3a24aaff2b6a15b Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 27 Mar 2025 16:33:00 +0000 Subject: [PATCH 3/3] fix headers --- pages/custom-query-modules.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/custom-query-modules.mdx b/pages/custom-query-modules.mdx index ba3ba1749..3eb01144c 100644 --- a/pages/custom-query-modules.mdx +++ b/pages/custom-query-modules.mdx @@ -23,7 +23,7 @@ and **Rust**. These procedures are grouped into modules - **query module** files (either `*.so` or `*.py` files). -# Developing your custom query module +## Developing your custom query module To develop your custom query module procedures you can follow the guides for each language: @@ -58,7 +58,7 @@ would be mapped in the Cypher query language as `example.procedure()` and Each query module file can contain multiple read and write procedures and functions. -# Modifying the existing query modules +## Modifying the existing query modules If existing MAGE library modules almost meet your needs, consider modifying them and make a contribution to the Memgraph Mage library.