Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,62 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
to [Semantic Versioning](https://semver.org). When adding a new entry, please use the entries below
as a guide.

## [Unreleased]

- **Podman / Fedora 44 / RHEL 9+ support for `make test`**

Docker CE is no longer installable or functional on Fedora 38+ and RHEL 9+ from the official
Docker repository. Podman (with `podman-docker` and `podman-compose`) is the supported
replacement on those platforms. This release makes the entire test infrastructure
runtime-agnostic so that `make test` works with either Docker or Podman transparently.

Changes by area:

- **`testutil/runtime.go`** (new): central runtime detection; auto-detects whether Docker or
Podman is in use (including `podman-docker` shims), sets `DOCKER_HOST` to the Podman socket
so the Docker SDK can communicate with it, and exposes `ContainerRuntime()` and
`ContainerComposeCmdPrefix()` helpers used everywhere else
- **`t/t.go` and `testutil/bulk.go`**: all hardcoded `docker compose --compatibility`
invocations replaced with `ContainerComposeCmdPrefix()`; all `docker logs`, `docker cp`, and
`docker exec` calls replaced with `ContainerRuntime()`
- **`contrib/Dockerfile`**: pre-creates all `/data/zero*`, `/data/alpha*`, `/data/dg1`, and
`/data/dg0.1` directories; Podman's `crun` OCI runtime does not auto-create a container's
`working_dir` at startup (unlike Docker's `runc`), which left containers stuck in "Created"
state
- **`t/Makefile`**: new `install-deps-docker-linux-dnf` target installs
`podman podman-docker podman-compose` and enables the Podman socket instead of attempting the
broken Docker CE install path on Fedora/RHEL
- **`t/scripts/check-deps-docker.sh`**: rewritten to detect and validate Podman on
`dnf`-based systems instead of requiring Docker CE
- **`t/scripts/check-docker-available-memory.sh`**: reads `/proc/meminfo` directly on Linux
(works for both Docker and Podman) rather than calling `docker info`
- **`Makefile`** (root): new `$(DOCKER)` variable falls back to `podman` when `docker` is
absent, used for image build targets

- **Fixed**
- fix(build): detect jemalloc under `/usr/lib64` so a dnf-installed `jemalloc-devel` is found on
Fedora/RHEL multilib systems
- fix(build): compile the bundled jemalloc 5.3.1 with `--disable-cxx` to avoid the
`std::__throw_bad_alloc` build failure on GCC 13+ (e.g. Fedora 44 / GCC 15); dgraph only links
jemalloc's C API, so the C++ layer is not needed
- fix(build): chain the jemalloc build recipe with `&&` (was `;`) so a failed compile no longer
falls through to `make install`, and clear any stale `/tmp/jemalloc-temp` before rebuilding
- fix(test): add the Docker CE repo via a downloaded `.repo` file instead of
`dnf config-manager --add-repo`, which was removed in DNF5 (Fedora 41+) and broke
`make setup` on Fedora

- **Added**
- test: add `contrib/smoke-test.sh` to bring up a local zero+alpha and verify
schema/mutation/query against a freshly built binary

- **Changed**
- build: `linux-dependency` now auto-detects the package manager (apt/dnf/pacman) and installs the
C/C++ toolchain + protobuf-compiler, so build prerequisites work on Fedora/RHEL and Arch in
addition to Debian/Ubuntu

- **Docs**
- docs(contributing): document building Dgraph on Fedora/RHEL

## [v25.3.4] - 2026-05-11

[v25.3.4]: https://github.com/dgraph-io/dgraph/compare/v25.3.3...v25.3.4
Expand Down
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,28 @@ Licensed variously under the Apache Public License 2.0 and Dgraph Community Lice
See the [README](t/README.md) in the [_t_](t) folder for instructions on building Dgraph on
non-Linux machines.

#### Building Dgraph on Fedora / RHEL

On Fedora, RHEL, and other `dnf`-based distributions, install the build prerequisites with:

```bash
make linux-dependency # auto-detects apt / dnf / pacman; installs gcc, make, protobuf-compiler, etc.
make install
```

Dgraph statically links jemalloc. Fedora's `jemalloc-devel` package ships only the shared library
(not the static `libjemalloc.a` that Dgraph links against), so `make` compiles jemalloc 5.3.1 from
source the first time and installs it to `/usr/local/lib` (this step needs `sudo`). The build
configures jemalloc with `--disable-cxx`, which avoids a `std::__throw_bad_alloc` compile error on
GCC 13+ (e.g. Fedora 44 / GCC 15); Dgraph uses only jemalloc's C API, so the C++ layer is not
needed. Once the static library exists, subsequent builds detect it and skip the rebuild.

After building, you can verify the binary with a quick single-node smoke test:

```bash
contrib/smoke-test.sh # brings up a local zero+alpha, runs schema/mutation/query, tears down
```

### Build Docker Image

```sh
Expand Down
31 changes: 19 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export GOPATH ?= $(shell go env GOPATH)
GOHOSTOS := $(shell go env GOHOSTOS)
GOHOSTARCH := $(shell go env GOHOSTARCH)

# Container runtime: prefer docker, fall back to podman (Fedora/RHEL default).
DOCKER ?= $(shell command -v docker 2>/dev/null || command -v podman 2>/dev/null || echo docker)

# Guard against empty GOPATH, which would resolve paths to root (e.g. /bin)
ifeq ($(GOPATH),)
$(error GOPATH is not set. Please set it explicitly, e.g. export GOPATH=$$HOME/go)
Expand Down Expand Up @@ -190,7 +193,7 @@ else
endif
@mkdir -p linux
@mv ./dgraph/dgraph ./linux/dgraph
@docker build -f contrib/Dockerfile -t dgraph/dgraph:local .
@$(DOCKER) build -f contrib/Dockerfile -t dgraph/dgraph:local .
@rm -r linux

.PHONY: image-local
Expand All @@ -207,7 +210,7 @@ clean: ## Clean build artifacts
docker-image: dgraph ## Build Docker image (dgraph/dgraph:$VERSION)
@mkdir -p linux
@cp ./dgraph/dgraph ./linux/dgraph
docker build -f contrib/Dockerfile -t dgraph/dgraph:$(DGRAPH_VERSION) .
$(DOCKER) build -f contrib/Dockerfile -t dgraph/dgraph:$(DGRAPH_VERSION) .

.PHONY: docker-image-standalone
docker-image-standalone: dgraph docker-image
Expand All @@ -219,19 +222,23 @@ docker-image-standalone: dgraph docker-image
coverage-docker-image: dgraph-coverage
@mkdir -p linux
@cp ./dgraph/dgraph ./linux/dgraph
docker build -f contrib/Dockerfile -t dgraph/dgraph:$(DGRAPH_VERSION) .
$(DOCKER) build -f contrib/Dockerfile -t dgraph/dgraph:$(DGRAPH_VERSION) .

# build and run dependencies for ubuntu linux
# build and run dependencies for linux (auto-detects apt / dnf / pacman)
# The bundled jemalloc is compiled from source (see dgraph/Makefile), so a C/C++
# toolchain plus curl/bzip2/tar are required even though libjemalloc itself is built locally.
.PHONY: linux-dependency
linux-dependency:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install ca-certificates
sudo apt-get -y install curl
sudo apt-get -y install gnupg
sudo apt-get -y install lsb-release
sudo apt-get -y install build-essential
sudo apt-get -y install protobuf-compiler
@if command -v apt-get >/dev/null 2>&1; then \
sudo apt-get update && \
sudo apt-get install -y ca-certificates curl gnupg lsb-release build-essential protobuf-compiler bzip2; \
elif command -v dnf >/dev/null 2>&1; then \
sudo dnf install -y ca-certificates curl gnupg gcc gcc-c++ make bzip2 tar protobuf-compiler; \
elif command -v pacman >/dev/null 2>&1; then \
sudo pacman -S --noconfirm --needed ca-certificates curl gnupg base-devel protobuf; \
else \
echo "ERROR: No supported package manager found (tried: apt, dnf, pacman)"; exit 1; \
fi

.PHONY: help
help: ## Show available targets and variables
Expand Down
8 changes: 7 additions & 1 deletion contrib/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ RUN set -eu; \

ADD linux /usr/local/bin

RUN mkdir /dgraph
RUN mkdir /dgraph && \
mkdir -p \
/data/zero1 /data/zero2 /data/zero3 /data/zero4 \
/data/zero5 /data/zero6 /data/zero7 /data/zero8 \
/data/alpha1 /data/alpha2 /data/alpha3 /data/alpha4 \
/data/alpha5 /data/alpha6 /data/alpha7 /data/alpha8 \
/data/dg1 /data/dg0.1
WORKDIR /dgraph

ENV GODEBUG=madvdontneed=1
Expand Down
103 changes: 103 additions & 0 deletions contrib/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: © 2017-2025 Istari Digital, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Smoke test for a locally-built dgraph binary. Brings up a single-node cluster
# (one zero + one alpha), exercises schema / mutation / query over the HTTP API,
# verifies the result, then tears everything down.
#
# Usage:
# contrib/smoke-test.sh
#
# Environment overrides:
# BIN path to the dgraph binary (default: ./dgraph/dgraph, else `dgraph` on PATH)
# ROOT working dir for cluster data (default: a fresh mktemp dir, removed on exit)

set -u

# Resolve the dgraph binary: prefer a local build, fall back to PATH.
if [ -z "${BIN:-}" ]; then
if [ -x "./dgraph/dgraph" ]; then
BIN="./dgraph/dgraph"
elif command -v dgraph >/dev/null 2>&1; then
BIN="dgraph"
else
echo "error: could not find dgraph binary (build it with 'make dgraph' or set BIN=...)" >&2
exit 1
fi
fi

# Resolve a path-form BIN to an absolute path (we cd into per-node data dirs below);
# leave a bare command name (found on PATH) untouched.
case "$BIN" in
*/*) BIN="$(cd "$(dirname "$BIN")" && pwd)/$(basename "$BIN")" ;;
esac

ROOT="${ROOT:-$(mktemp -d)}"
PASS=0; FAIL=0
ZERO_PID=""; ALPHA_PID=""

say() { printf '\n=== %s ===\n' "$*"; }
ok() { echo "PASS: $*"; PASS=$((PASS + 1)); }
bad() { echo "FAIL: $*"; FAIL=$((FAIL + 1)); }

cleanup() {
say "Tearing down"
[ -n "$ALPHA_PID" ] && kill "$ALPHA_PID" 2>/dev/null
[ -n "$ZERO_PID" ] && kill "$ZERO_PID" 2>/dev/null
wait 2>/dev/null
rm -rf "$ROOT"
}
trap cleanup EXIT

mkdir -p "$ROOT/zero" "$ROOT/alpha"

say "dgraph version"
"$BIN" version 2>&1 | sed -n '1,12p'

say "Starting zero"
( cd "$ROOT/zero" && exec "$BIN" zero --my localhost:5080 ) >"$ROOT/zero.log" 2>&1 &
ZERO_PID=$!

say "Starting alpha"
( cd "$ROOT/alpha" && exec "$BIN" alpha --my localhost:7080 --zero localhost:5080 ) \
>"$ROOT/alpha.log" 2>&1 &
ALPHA_PID=$!

say "Waiting for alpha /health"
healthy=0
for _ in $(seq 1 60); do
if curl -sf localhost:8080/health >/dev/null 2>&1; then healthy=1; break; fi
sleep 2
done
if [ "$healthy" = 1 ]; then
ok "alpha healthy"
else
bad "alpha did not become healthy"
echo "--- alpha.log (tail) ---"; tail -30 "$ROOT/alpha.log"
echo "--- zero.log (tail) ---"; tail -30 "$ROOT/zero.log"
exit 1
fi

say "Set schema"
curl -sf -X POST localhost:8080/alter -d 'name: string @index(exact) .' >/dev/null \
&& ok "alter" || bad "alter"

say "Mutation"
# N-Quads must be newline-terminated, so embed real newlines via $'...'.
MUT=$(curl -s -X POST 'localhost:8080/mutate?commitNow=true' \
-H 'Content-Type: application/rdf' \
-d $'{\n set {\n _:alice <name> "Alice" .\n _:bob <name> "Bob" .\n }\n}')
echo "$MUT"
echo "$MUT" | grep -q '"code":"Success"' && ok "mutate" || bad "mutate"

say "Query"
RES=$(curl -s -X POST localhost:8080/query \
-H 'Content-Type: application/dql' \
-d '{ q(func: eq(name, "Alice")) { name } }')
echo "$RES"
echo "$RES" | grep -q '"name":"Alice"' && ok "query returned Alice" || bad "query did not return Alice"

say "Result: PASS=$PASS FAIL=$FAIL"
[ "$FAIL" = 0 ]
21 changes: 11 additions & 10 deletions dgraph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ endif

# jemalloc stuff
# Check common package-manager install paths: /usr/local/lib (make
# install from source), /usr/lib (apt-get libjemalloc-dev), and
# /usr/lib/libjemalloc_pic.a (apk add jemalloc-dev on Alpine/Wolfi).
HAS_JEMALLOC = $(shell test -f /usr/local/lib/libjemalloc.a -o -f /usr/lib/libjemalloc.a -o -f /usr/lib/libjemalloc_pic.a && echo "jemalloc")
# install from source), /usr/lib (apt-get libjemalloc-dev),
# /usr/lib/libjemalloc_pic.a (apk add jemalloc-dev on Alpine/Wolfi), and
# /usr/lib64 (dnf jemalloc-devel on Fedora/RHEL multilib systems).
HAS_JEMALLOC = $(shell test -f /usr/local/lib/libjemalloc.a -o -f /usr/local/lib64/libjemalloc.a -o -f /usr/lib/libjemalloc.a -o -f /usr/lib64/libjemalloc.a -o -f /usr/lib/libjemalloc_pic.a -o -f /usr/lib64/libjemalloc_pic.a && echo "jemalloc")
JEMALLOC_URL = "https://github.com/jemalloc/jemalloc/releases/download/5.3.1/jemalloc-5.3.1.tar.bz2"

# go install variables
Expand Down Expand Up @@ -101,13 +102,13 @@ install: jemalloc

jemalloc:
@if [ -z "$(HAS_JEMALLOC)" ] ; then \
mkdir -p /tmp/jemalloc-temp && cd /tmp/jemalloc-temp ; \
echo "Downloading jemalloc" ; \
curl -f -s -L ${JEMALLOC_URL} -o jemalloc.tar.bz2 ; \
tar xjf ./jemalloc.tar.bz2 ; \
cd jemalloc-5.3.1 ; \
./configure --with-jemalloc-prefix='je_' --with-malloc-conf='background_thread:true,metadata_thp:auto'; \
make ; \
rm -rf /tmp/jemalloc-temp && mkdir -p /tmp/jemalloc-temp && cd /tmp/jemalloc-temp && \
echo "Downloading jemalloc" && \
curl -f -s -L ${JEMALLOC_URL} -o jemalloc.tar.bz2 && \
tar xjf ./jemalloc.tar.bz2 && \
cd jemalloc-5.3.1 && \
./configure --with-jemalloc-prefix='je_' --with-malloc-conf='background_thread:true,metadata_thp:auto' --disable-cxx && \
make && \
if [ "$(USER_ID)" = "0" ]; then \
make install ; \
else \
Expand Down
11 changes: 11 additions & 0 deletions dgraph/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ cluster.
func Execute() {
initCmds()

// podman-compose 1.5.0 expands an unset ${COVERAGE_OUTPUT} as a literal
// empty-string token, which shlex passes to us as os.Args[1]=="". Strip
// any empty-string arguments before cobra sees them; they are never valid.
filtered := os.Args[:1]
for _, a := range os.Args[1:] {
if a != "" {
filtered = append(filtered, a)
}
}
os.Args = filtered

// Convinces glog that Parse() has been called to avoid noisy logs.
// https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212
x.Check(flag.CommandLine.Parse([]string{}))
Expand Down
2 changes: 1 addition & 1 deletion dgraph/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ services:
"secret-file=/dgraph-acl/hmac-secret; access-ttl=20s;"

minio:
image: minio/minio:latest
image: docker.io/minio/minio:latest
env_file:
- ./minio.env
working_dir: /data/minio
Expand Down
2 changes: 1 addition & 1 deletion graphql/e2e/directives/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
--graphql "lambda-url=http://lambda:8686/graphql-worker; debug=true;" --trace "ratio=1.0;"

lambda:
image: dgraph/dgraph-lambda:latest
image: docker.io/dgraph/dgraph-lambda:latest
labels:
cluster: test
ports:
Expand Down
2 changes: 1 addition & 1 deletion graphql/e2e/normal/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
--graphql "lambda-url=http://lambda:8686/graphql-worker; debug=true;" --trace "ratio=1.0;"

lambda:
image: dgraph/dgraph-lambda:latest
image: docker.io/dgraph/dgraph-lambda:latest
labels:
cluster: test
ports:
Expand Down
4 changes: 2 additions & 2 deletions ocagent/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
--my=zero1:5180 --replicas=3 --logtostderr -v=2 --bindall --trace
"jaeger=http://ocagent:14268;"
ocagent:
image: omnition/opencensus-agent:1.0.15
image: docker.io/omnition/opencensus-agent:1.0.15
container_name: ocagent
labels:
cluster: test
Expand All @@ -51,7 +51,7 @@ services:
read_only: true
command: --config /conf/ocagent-config.yaml
datadog:
image: datadog/agent:latest
image: docker.io/datadog/agent:latest
container_name: datadog
working_dir: /working/datadog
volumes:
Expand Down
2 changes: 1 addition & 1 deletion systest/backup/encryption/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ services:
server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true;
client-cert=/dgraph-tls/client.zero1.crt; client-key=/dgraph-tls/client.zero1.key;"
minio:
image: minio/minio:latest
image: docker.io/minio/minio:latest
env_file:
- ../../backup.env
ports:
Expand Down
2 changes: 1 addition & 1 deletion systest/backup/minio-large/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ services:
server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true;
client-cert=/dgraph-tls/client.alpha3.crt; client-key=/dgraph-tls/client.alpha3.key;"
minio:
image: minio/minio:${MINIO_IMAGE_ARCH:-RELEASE.2020-11-13T20-10-18Z}
image: docker.io/minio/minio:${MINIO_IMAGE_ARCH:-RELEASE.2020-11-13T20-10-18Z}
env_file:
- ../../backup.env
ports:
Expand Down
2 changes: 1 addition & 1 deletion systest/backup/minio/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ services:
server-cert=/dgraph-tls/node.crt; server-key=/dgraph-tls/node.key; internal-port=true;
client-cert=/dgraph-tls/client.zero1.crt; client-key=/dgraph-tls/client.zero1.key;"
minio:
image: minio/minio:${MINIO_IMAGE_ARCH:-RELEASE.2020-11-13T20-10-18Z}
image: docker.io/minio/minio:${MINIO_IMAGE_ARCH:-RELEASE.2020-11-13T20-10-18Z}
env_file:
- ../../backup.env
ports:
Expand Down
Loading