chore: extend Uncloud-in-Docker section in HACKING.md

This commit is contained in:
Pasha Sviderski
2026-03-25 15:03:22 +10:00
parent ba73259887
commit 9fb20c30b3
2 changed files with 52 additions and 12 deletions
+37 -12
View File
@@ -47,16 +47,6 @@ Windows:
GOOS=linux GOARCH=amd64 go build -o uncloudd ./cmd/uncloudd GOOS=linux GOARCH=amd64 go build -o uncloudd ./cmd/uncloudd
``` ```
## Docker in Docker (ucind)
When running ucind and running in trouble, you must manually remove the cluster, by running:
```shell
docker stop CONTAINERID
docker rm CONTAINERID
docker network rm CLUSTERNAME
```
## Testing ## Testing
Run all tests (unit and e2e): Run all tests (unit and e2e):
@@ -67,10 +57,10 @@ make test
### End-to-end tests ### End-to-end tests
E2e tests run inside Docker using the [`ucind`](Dockerfile) (Uncloud-in-Docker) image. Build it first: E2e tests run inside Docker using the [Uncloud-in-Docker](#uncloud-in-docker-ucind) image. Build it first:
```shell ```shell
make ucind-image mise ucind:image
``` ```
⚠️ NOTE: You need to rebuild the `ucind` image every time you make changes to the daemon code if you want to test them ⚠️ NOTE: You need to rebuild the `ucind` image every time you make changes to the daemon code if you want to test them
@@ -127,3 +117,38 @@ Regenerate mocks:
```shell ```shell
make mocks make mocks
``` ```
## Uncloud in Docker (UCinD)
The [`ucind`](./cmd/ucind) CLI lets you run Uncloud clusters locally using Docker containers instead of real machines.
Each cluster machine runs as a Docker container connected to a shared Docker network.
Cluster machines use the `ghcr.io/psviderski/ucind:latest` Docker image by default. It may not always have the
latest changes to the `uncloudd` daemon code as it's not automatically rebuilt on CI yet.
You can rebuild it locally to pick up the latest changes, including your work in progress, and test them in a UCinD
cluster:
```shell
mise ucind:image
```
Create a cluster with 3 machines:
```shell
mise ucind cluster create -m 3
```
This also sets the new cluster as the active context, so you can interact with it using the `uc` CLI right away.
Remove the cluster when you're done:
```shell
mise ucind cluster rm
```
Sometimes crashed tests or interrupted runs can leave orphaned containers and networks behind. Clean them all up with:
```shell
mise ucind:cleanup
```
+15
View File
@@ -10,6 +10,9 @@ protoc = "27.3"
protoc-gen-go = "1.34.2" protoc-gen-go = "1.34.2"
protoc-gen-go-grpc = "1.5.1" protoc-gen-go-grpc = "1.5.1"
[vars]
ucind_image = "ghcr.io/psviderski/ucind:latest"
[env] [env]
_.file = ".env" _.file = ".env"
@@ -42,6 +45,18 @@ protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=p
--proto_path=. --proto_path=internal/machine/api/vendor internal/machine/api/pb/*.proto --proto_path=. --proto_path=internal/machine/api/vendor internal/machine/api/pb/*.proto
""" """
[tasks.uc]
description = "Run the Uncloud CLI"
run = "go run ./cmd/uncloud"
[tasks.ucind]
description = "Run ucind CLI for managing local Docker-based clusters"
run = "go run ./cmd/ucind"
[tasks."ucind:image"]
description = "Build the ucind Docker image"
run = "docker build -t {{vars.ucind_image}} --target ucind ."
[tasks."ucind:cleanup"] [tasks."ucind:cleanup"]
description = "Remove ucind managed containers and networks" description = "Remove ucind managed containers and networks"
run = """ run = """