{
  "id": "developer",
  "title": "Developer notes",
  "url": "https://un5pn9hmggug.julianrbryant.com/docs/latest/develop/data-types/json/developer/",
  "summary": "Notes on JSON debugging, testing and documentation.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-08T12:21:52-07:00",
  "page_type": "content",
  "content_hash": "1c824c0a9250307c208d48d27889566b1f3d020aec7e82c9c56d7badad04739b",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Developing Redis JSON involves setting up the development environment (which can be either Linux-based or macOS-based), building RedisJSON (the Redis module providing JSON), running tests and benchmarks, and debugging both the JSON module and its tests."
    },
    {
      "id": "cloning-the-git-repository",
      "title": "Cloning the git repository",
      "role": "content",
      "text": "To clone the RedisJSON module and its submodules, run:\n[code example]"
    },
    {
      "id": "working-in-an-isolated-environment",
      "title": "Working in an isolated environment",
      "role": "content",
      "text": "There are several reasons to use an isolated environment for development, like keeping your workstation clean and developing for a different Linux distribution.\n\nYou can use a virtual machine as an isolated development environment. To set one up, you can use [Vagrant](https://un5gmtkzgk4bjvtwpbcebd8.julianrbryant.com) or Docker.\n\nTo set up a virtual machine with Docker:\n\n[code example]\nThen run [code example]docker exec[code example]\ndocker commit $rejson redisjson1\ndocker stop $rejson\nrejson=$(docker run -d -it -v $PWD:/build redisjson1 bash)\ndocker exec -it $rejson bash\n```\n\nYou can replace `debian:bullseye` with your OS of choice. If you use the same OS as your host machine, you can run the RedisJSON binary on your host after it is built."
    },
    {
      "id": "installing-prerequisites",
      "title": "Installing prerequisites",
      "role": "setup",
      "text": "To build and test RedisJSON one needs to install several packages, depending on the underlying OS. Currently, we support the Ubuntu/Debian, CentOS, Fedora, and macOS.\n\nEnter the `RedisJSON` directory and run:\n\n[code example]\n\n**This will install various packages on your system** using the native package manager and pip. It will invoke `sudo` on its own, prompting for permission.\n\nIf you prefer to avoid that, you can:\n\n* Review `system-setup.py` and install packages manually,\n* Use `system-setup.py --nop` to display installation commands without executing them,\n* Use an isolated environment like explained above,\n* Use a Python virtual environment, as Python installations are known to be sensitive when not used in isolation: `python -m virtualenv venv; . ./venv/bin/activate`"
    },
    {
      "id": "installing-redis",
      "title": "Installing Redis",
      "role": "setup",
      "text": "Generally, it is best to run the latest Redis version.\n\nIf your OS has a Redis 6.x package, you can install it using the OS package manager.\n\nOtherwise, you can invoke\n[code example]"
    },
    {
      "id": "getting-help",
      "title": "Getting help",
      "role": "content",
      "text": "[code example]\nmake setup         # install prerequisites\n\nmake build\n  DEBUG=1          # build debug variant\n  SAN=type         # build with LLVM sanitizer (type=address|memory|leak|thread)\n  VALGRIND|VG=1    # build for testing with Valgrind\nmake clean         # remove binary files\n  ALL=1            # remove binary directories\n\nmake all           # build all libraries and packages\n\nmake test          # run both cargo and python tests\nmake cargo_test    # run inbuilt rust unit tests\nmake pytest        # run flow tests using RLTest\n  TEST=file:name     # run test matching `name` from `file`\n  TEST_ARGS=\"...\"    # RLTest arguments\n  QUICK=1            # run only general tests\n  GEN=1              # run general tests on a standalone Redis topology\n  AOF=1              # run AOF persistency tests on a standalone Redis topology\n  SLAVES=1           # run replication tests on standalone Redis topology\n  CLUSTER=1          # run general tests on a Redis Open Source Cluster topology\n  VALGRIND|VG=1      # run specified tests with Valgrind\n  VERBOSE=1          # display more RLTest-related information\n\nmake pack          # build package (RAMP file)\nmake upload-artifacts   # copy snapshot packages to S3\n  OSNICK=nick             # copy snapshots for specific OSNICK\nmake upload-release     # copy release packages to S3\n\ncommon options for upload operations:\n  STAGING=1             # copy to staging lab area (for validation)\n  FORCE=1               # allow operation outside CI environment\n  VERBOSE=1             # show more details\n  NOP=1                 # do not copy, just print commands\n\nmake coverage      # perform coverage analysis\nmake show-cov      # show coverage analysis results (implies COV=1)\nmake upload-cov    # upload coverage analysis results to codecov.io (implies COV=1)\n\nmake docker        # build for specific Linux distribution\n  OSNICK=nick        # Linux distribution to build for\n  REDIS_VER=ver      # use Redis version `ver`\n  TEST=1             # test after build\n  PACK=1             # create packages\n  ARTIFACTS=1        # copy artifacts from docker image\n  PUBLISH=1          # publish (i.e. docker push) after build\n\nmake sanbox        # create container for CLang Sanitizer tests\n```"
    },
    {
      "id": "building-from-source",
      "title": "Building from source",
      "role": "content",
      "text": "Run [code example]make build[code example]make clean``` to remove built artifacts. ```make clean ALL=1``` will remove the entire bin subdirectory."
    },
    {
      "id": "running-tests",
      "title": "Running tests",
      "role": "content",
      "text": "There are several sets of unit tests:\n* Rust tests, integrated in the source code, run by [code example]tests/pytests[code example]make test[code example]TEST[code example]bash\n$ # use an existing local Redis instance for testing the module\n$ REDIS_PORT=6379 make test\n```"
    },
    {
      "id": "debugging",
      "title": "Debugging",
      "role": "content",
      "text": "To include debugging information, you need to set the [`DEBUG`]() environment variable before you compile RedisJSON. For example, run `export DEBUG=1`.\n\nYou can add breakpoints to Python tests in single-test mode. To set a breakpoint, call the ```BB()``` function inside a test."
    }
  ],
  "examples": [
    {
      "id": "cloning-the-git-repository-ex0",
      "language": "sh",
      "code": "git clone --recursive https://github.com/RedisJSON/RedisJSON.git",
      "section_id": "cloning-the-git-repository"
    },
    {
      "id": "working-in-an-isolated-environment-ex0",
      "language": "plaintext",
      "code": "rejson=$(docker run -d -it -v $PWD:/build debian:bullseye bash)\ndocker exec -it $rejson bash",
      "section_id": "working-in-an-isolated-environment"
    },
    {
      "id": "working-in-an-isolated-environment-ex1",
      "language": "cd /build``` from within the container.",
      "code": "In this mode, all installations remain in the scope of the Docker container.\nAfter you exit the container, you can either restart it with the previous",
      "section_id": "working-in-an-isolated-environment"
    },
    {
      "id": "installing-prerequisites-ex0",
      "language": "sh",
      "code": "$ ./sbin/setup",
      "section_id": "installing-prerequisites"
    },
    {
      "id": "installing-redis-ex0",
      "language": "sh",
      "code": "$ ./deps/readies/bin/getredis",
      "section_id": "installing-redis"
    },
    {
      "id": "building-from-source-ex0",
      "language": "make build``` to build RedisJSON.",
      "code": "Notes:\n\n* Binary files are placed under `target/release/`, according to platform and build variant.\n\n* RedisJSON uses [Cargo](https://github.com/rust-lang/cargo) as its build system.",
      "section_id": "building-from-source"
    },
    {
      "id": "building-from-source-ex1",
      "language": " will invoke both Cargo and the subsequent `make` command that's required to complete the build.",
      "code": "Use",
      "section_id": "building-from-source"
    },
    {
      "id": "running-tests-ex0",
      "language": "make cargo_test```.",
      "code": "* Python tests (enabled by RLTest), located in",
      "section_id": "running-tests"
    },
    {
      "id": "running-tests-ex1",
      "language": ", run by ```make pytest```.",
      "code": "You can run all tests with",
      "section_id": "running-tests"
    },
    {
      "id": "running-tests-ex2",
      "language": ".",
      "code": "To run only specific tests, use the",
      "section_id": "running-tests"
    },
    {
      "id": "running-tests-ex3",
      "language": " parameter. For example, run ```make test TEST=regex```.",
      "code": "You can run the module's tests against an \"embedded\" disposable Redis instance or against an instance\nyou provide. To use the \"embedded\" mode, you must include the `redis-server` executable in your `PATH`.\n\nYou can override the spawning of the embedded server by specifying a Redis port via the `REDIS_PORT`\nenvironment variable, e.g.:",
      "section_id": "running-tests"
    }
  ]
}
