Skip to content

Commit 03eed62

Browse files
authored
Merge branch 'main' into fix-kafka-container-arch-suffix-bug
2 parents 04432ce + 1031497 commit 03eed62

File tree

9 files changed

+778
-0
lines changed

9 files changed

+778
-0
lines changed

docs/modules/nebulagraph.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# NebulaGraph
2+
3+
Not available until the next release <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>
4+
5+
## Introduction
6+
7+
The Testcontainers module for [NebulaGraph](https://nebula-graph.io/), a distributed, scalable, and lightning-fast graph database. This module manages a complete NebulaGraph cluster including Meta Service, Storage Service, and Graph Service components.
8+
9+
## Adding this module to your project dependencies
10+
11+
Add the NebulaGraph module to your Go dependencies:
12+
13+
```go
14+
go get github.com/testcontainers/testcontainers-go/modules/nebulagraph
15+
```
16+
17+
## Usage example
18+
19+
<!--codeinclude-->
20+
[Creating a NebulaGraph container](../../modules/nebulagraph/nebulagraph_test.go) inside_block:TestNebulaGraphContainer
21+
<!--/codeinclude-->
22+
23+
## Module Reference
24+
25+
### RunCluster function
26+
27+
- Not available until the next release <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>
28+
29+
The NebulaGraph module provides a function to create a complete NebulaGraph cluster within a Docker network:
30+
31+
```golang
32+
func RunCluster(ctx context.Context,
33+
graphdImg string, graphdCustomizers []testcontainers.ContainerCustomizer,
34+
storagedImg string, storagedCustomizers []testcontainers.ContainerCustomizer,
35+
metadImg string, metadCustomizers []testcontainers.ContainerCustomizer,
36+
) (*Cluster, error)
37+
```
38+
39+
This function creates a complete NebulaGraph cluster with customizable settings. It returns a `Cluster` struct that contains references to all four components:
40+
- Meta Service (metad)
41+
- Storage Service (storaged)
42+
- Graph Service (graphd)
43+
44+
### Default Configuration
45+
46+
The module uses the following default configurations:
47+
48+
#### Default Images
49+
- Graph Service: `vesoft/nebula-graphd:v3.8.0`
50+
- Meta Service: `vesoft/nebula-metad:v3.8.0`
51+
- Storage Service: `vesoft/nebula-storaged:v3.8.0`
52+
53+
#### Exposed Ports
54+
- Graph Service: 9669 (TCP), 19669 (HTTP)
55+
- Meta Service: 9559 (TCP), 19559 (HTTP)
56+
- Storage Service: 9779 (TCP), 19779 (HTTP)
57+
58+
#### Health Checks
59+
60+
The module implements health checks for all services:
61+
62+
- Meta Service: HTTP health check on `/status` endpoint (port 19559)
63+
- Graph Service: HTTP health check on `/status` endpoint (port 19669)
64+
- Storage Service: Log-based health check for initialization
65+
- Activator Service: Log-based health check and exit status for storage registration
66+
67+
A cluster is considered ready when:
68+
69+
1. Meta service is healthy and accessible
70+
2. Graph service is healthy and accessible
71+
3. Storage service is initialized and running
72+
4. Storage service is successfully registered with the meta service via the activator
73+
74+
### Container Options
75+
76+
When starting the NebulaGraph container, you can pass options in a variadic way to configure it.
77+
78+
The module supports customization for each service container (Meta, Storage, Graph, and Activator) through ContainerCustomizer options. Common customizations include:
79+
80+
- Custom images for each service
81+
- Environment variables
82+
- Resource limits
83+
- Network settings
84+
- Volume mounts
85+
- Wait strategies
86+
87+
{% include "../features/common_functional_options_list.md" %}
88+
89+
### Container Methods
90+
91+
The `Cluster` struct provides the following methods:
92+
93+
#### ConnectionString
94+
95+
- Not available until the next release <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>
96+
97+
Returns the host:port string for connecting to the NebulaGraph graph service (graphd).
98+
99+
```golang
100+
func (c *Cluster) ConnectionString(ctx context.Context) (string, error)
101+
```
102+
103+
#### Terminate
104+
105+
- Not available until the next release <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>
106+
107+
Stops and removes all containers in the NebulaGraph cluster (Meta, Storage, Graph, and Activator services) and cleans up the associated Docker network.
108+
109+
```golang
110+
func (c *Cluster) Terminate(ctx context.Context) error
111+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ nav:
104104
- modules/mssql.md
105105
- modules/mysql.md
106106
- modules/nats.md
107+
- modules/nebulagraph.md
107108
- modules/neo4j.md
108109
- modules/ollama.md
109110
- modules/openfga.md

modules/nebulagraph/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include ../../commons-test.mk
2+
3+
.PHONY: test
4+
test:
5+
$(MAKE) test-nebulagraph

modules/nebulagraph/activator.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
for i in $(seq 1 ${ACTIVATOR_RETRY}); do
2+
echo "nebula" | nebula-console -addr graphd0 -port 9669 -u root -e 'ADD HOSTS "storaged0":9779' 1>/dev/null 2>/dev/null
3+
if [ $? -eq 0 ]; then
4+
echo "✔️ Storage activated successfully."
5+
exit 0
6+
else
7+
output=$(echo "nebula" | nebula-console -addr graphd0 -port 9669 -u root -e 'ADD HOSTS "storaged0":9779' 2>&1)
8+
if echo "$output" | grep -q "Existed"; then
9+
echo "✔️ Storage activated already , Exiting..."
10+
exit 0
11+
fi
12+
fi
13+
if [ $i -lt ${ACTIVATOR_RETRY} ]; then
14+
echo "⏳ Attempting to activate storaged, attempt $i/${ACTIVATOR_RETRY}... It's normal to take some attempts before storaged is ready. Please wait."
15+
else
16+
echo "❌ Failed to activate storaged after ${ACTIVATOR_RETRY} attempts. Please check MetaD, StorageD logs."
17+
echo "ℹ️ Error during storage activation:"
18+
echo "=============================================================="
19+
echo "$output"
20+
echo "=============================================================="
21+
exit 1
22+
fi
23+
sleep 5
24+
done && tail -f /dev/null

modules/nebulagraph/go.mod

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
module github.com/testcontainers/testcontainers-go/modules/nebulagraph
2+
3+
go 1.23.6
4+
5+
require (
6+
github.com/jolestar/go-commons-pool v2.0.0+incompatible
7+
github.com/nebula-contrib/nebula-sirius v1.0.0-rc2
8+
github.com/stretchr/testify v1.10.0
9+
github.com/testcontainers/testcontainers-go v0.38.0
10+
)
11+
12+
require (
13+
dario.cat/mergo v1.0.1 // indirect
14+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
15+
github.com/Microsoft/go-winio v0.6.2 // indirect
16+
github.com/apache/thrift v0.21.0 // indirect
17+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
18+
github.com/containerd/errdefs v1.0.0 // indirect
19+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
20+
github.com/containerd/log v0.1.0 // indirect
21+
github.com/containerd/platforms v0.2.1 // indirect
22+
github.com/cpuguy83/dockercfg v0.3.2 // indirect
23+
github.com/davecgh/go-spew v1.1.1 // indirect
24+
github.com/distribution/reference v0.6.0 // indirect
25+
github.com/docker/docker v28.3.3+incompatible // indirect
26+
github.com/docker/go-connections v0.5.0 // indirect
27+
github.com/docker/go-units v0.5.0 // indirect
28+
github.com/ebitengine/purego v0.8.4 // indirect
29+
github.com/felixge/httpsnoop v1.0.4 // indirect
30+
github.com/go-logr/logr v1.4.3 // indirect
31+
github.com/go-logr/stdr v1.2.2 // indirect
32+
github.com/go-ole/go-ole v1.2.6 // indirect
33+
github.com/gogo/protobuf v1.3.2 // indirect
34+
github.com/google/uuid v1.6.0 // indirect
35+
github.com/klauspost/compress v1.18.0 // indirect
36+
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
37+
github.com/magiconair/properties v1.8.10 // indirect
38+
github.com/moby/docker-image-spec v1.3.1 // indirect
39+
github.com/moby/go-archive v0.1.0 // indirect
40+
github.com/moby/patternmatcher v0.6.0 // indirect
41+
github.com/moby/sys/sequential v0.6.0 // indirect
42+
github.com/moby/sys/user v0.4.0 // indirect
43+
github.com/moby/sys/userns v0.1.0 // indirect
44+
github.com/moby/term v0.5.0 // indirect
45+
github.com/morikuni/aec v1.0.0 // indirect
46+
github.com/opencontainers/go-digest v1.0.0 // indirect
47+
github.com/opencontainers/image-spec v1.1.1 // indirect
48+
github.com/pkg/errors v0.9.1 // indirect
49+
github.com/pmezard/go-difflib v1.0.0 // indirect
50+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
51+
github.com/shirou/gopsutil/v4 v4.25.5 // indirect
52+
github.com/sirupsen/logrus v1.9.3 // indirect
53+
github.com/tklauser/go-sysconf v0.3.12 // indirect
54+
github.com/tklauser/numcpus v0.6.1 // indirect
55+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
56+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
57+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
58+
go.opentelemetry.io/otel v1.37.0 // indirect
59+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
60+
go.opentelemetry.io/otel/metric v1.37.0 // indirect
61+
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
62+
go.opentelemetry.io/otel/trace v1.37.0 // indirect
63+
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
64+
golang.org/x/crypto v0.40.0 // indirect
65+
golang.org/x/net v0.42.0 // indirect
66+
golang.org/x/sys v0.34.0 // indirect
67+
golang.org/x/text v0.27.0 // indirect
68+
google.golang.org/protobuf v1.36.6 // indirect
69+
gopkg.in/yaml.v3 v3.0.1 // indirect
70+
)

0 commit comments

Comments
 (0)