Building from source
This is for anyone building TamarackDB from source: contributors and packagers. For how to run it, see Deployment. For how it works inside, see Architecture.
Build
make buildThis builds three binaries under bin/:
| Binary | Purpose |
|---|---|
tamarackdb-server | The HTTP server |
tamarackdb-init | Creates a new data directory |
tamarackdb-backup | Copies new events from a remote instance into a local backup file |
Each binary also has its own target with the same name, so make tamarackdb-init
builds only that one.
The running build’s version comes from git describe --tags --always --dirty,
evaluated at build time. It is baked into every binary at build time, not read at
runtime: the Makefile sets internal/buildinfo.Version through -ldflags "-X ...".
--version prints the running build’s version and exits, without loading a config
file or opening the database. Every TamarackDB binary accepts it.
Test
make testDemo dataset
cmd/tamarackdb-demo fills a data directory with a large set of made-up data.
Events get random types, one or two identifiers, one metadata tag, and filler
text as payload. Projections get a random type, a numeric id, and longer filler
text as payload. The tool writes straight to the
store, not through the HTTP server, so it can seed a large database fast. Use it
to try QUERY /events and GET /projections/{type}/{id} at scale.
make tamarackdb-demo
./bin/tamarackdb-demo --data-dir /path/to/data --events 1000000 --projections 100000 --seed 1--events sets how many events to write (default 1000000). --projections sets
how many projections to create (default 0). Set one of them to 0 to seed only the
other. --seed makes the run repeatable.
Projection ids always run from 1 to --projections. A second run on the same data
directory replaces the projections of the first one.
Other Makefile targets
make run: build, then start the server withconfig.tomlfrom the repository root, or the built-in defaults if there’s none. The defaultsocketPathsits in/run/tamarackdb, which usually doesn’t exist on a development machine: setsocketPath, orbindAddressandport, inconfig.toml.make test-race: run the tests with Go’s race detector, as the CI doesmake fmt/make vet/make tidy: standard Go housekeeping. The CI fails a pull request whose code isn’t formatted withgofmt, so runmake fmtfirst.make clean: removesbin/
Documentation site
The documentation is a Hugo site in docs/, using the
Doks theme. You need Hugo extended and Node.js 20 or
later. From docs/:
npm ci
npm run devnpm run dev serves the site at http://localhost:1313/ and reloads on every
change. npm run build writes the static site to docs/public/.
The site is published to https://tamarackdb.github.io/ each time a v* tag
is pushed.