MicroCloud is an open source cloud platform written in Go. It orchestrates a cluster of machines by auto-configuring LXD, MicroCeph, and MicroOVN. Module: github.com/canonical/microcloud/microcloud.
MicroCloud requires Go 1.26.2 or higher.
-
CGO native dependency:
dqlite. Fetch and build it once with:make depsThis clones and builds the
dqliteC library under$GOPATH/deps/dqlite. SetCGO_CFLAGS,CGO_LDFLAGS, andLD_LIBRARY_PATHaccordingly if building outside ofmake.
api/ HTTP API handlers and request/response types
types/ Shared API type definitions
client/ Go client library for the MicroCloud API
cmd/
microcloud/ CLI binary
microcloudd/ Daemon binary
tui/ Terminal UI library (tables, prompts, autocomplete)
database/ dqlite schema and CRUD helpers
multicast/ UDP multicast peer discovery
service/ Service interface and wrappers for LXD, MicroCeph, MicroOVN
test/
suites/ System test suites (bash)
includes/ Shared shell helper functions
lint/ Shell lint scripts
e2e/ Post-deployment end-to-end tests (Terraform)
version/ Single source of truth for the version string
doc/ Sphinx documentation
Update these via the listed make target instead of editing by hand:
| File | Command |
|---|---|
go.mod, go.sum |
make update-gomod |
# Production build
make build
# Test build (scripted TUI input, simplified wordlist)
make build-testRun these in order. Each must pass before moving to the next.
# 1. Static analysis (golangci-lint, revive, shell lint scripts)
make check-static
# 2. Unit tests
make check-unit
# 3. Full build
make buildmake check-static runs golangci-lint, revive, and the shell scripts under test/lint/. Review any reformatted files and stage only changes relevant to your work.
<component/subcomponent>: <concise change description>
Examples:
api/services: Use the authHandlerMTLS funccmd/microcloud: Remove token add commandservice/lxd: Fix storage pool bootstrap error handling
Use separate commits for each logical change and for changes to different components. See CONTRIBUTING.md for DCO sign-off (git commit -s) and GPG signature requirements.
- Use
"Cannot"not"Unable to". - Capitalize the first letter of error strings:
fmt.Errorf("Cannot connect to ..."). - No contractions:
"does not"not"doesn't". - US English spelling throughout (
behavior,color,initialize,organization).
- No inline variable declarations inside
ifconditions — assign on a separate line first. - Prefer early returns to reduce nesting.
- Import grouping (enforced by
gci): stdlib → external →github.com/canonical/microcloud/microcloud. - Check
service/for existing helpers before implementing utilities from scratch. - Both the
microcloudCLI andmicrocloudddaemon enforceos.Geteuid() == 0; keep this behavior.
- Use
jq --exit-status(jq -e) when asserting field presence or values. - For expected command failure:
if cmd_should_fail; then echo "ERROR: ..."; exit 1; fi - Use helper functions from
test/includes/microcloud.sh(validate_system_*,reset_systems, etc.) rather than reimplementing validation logic.
| Tag | Purpose |
|---|---|
agent |
Production build |
test |
Enables TEST_CONSOLE=1 scripted input and replaces the EFF wordlist with a small test wordlist |