The runtime a data infrastructure proxy and orchestrator – our data plane. It connects to data infrastructure and is responsible for dashboard queries, parsing code files, reconciling infra state, implementing connectors, enforcing (row-based) access policies, scheduling tasks, triggering reports, and much more.
It's designed as a modular component that can be embedded in local applications (as it is into Rill Developer) or deployed stand-alone in a cloud environment.
The base directory contains a Runtime type that represents the lifecycle of the runtime. It ties together the sub-directories:
clientcontains a Go client library for connecting to a runtime server.driverscontains interfaces and drivers for external data infrastructure that the runtime interfaces with (like DuckDB and Druid).metricsviewcontains the metrics layer that converts metrics definitions and queries to raw SQL queries.parsercontains logic for parsing Rill projects.pkgcontains utility libraries.queriescontains the underlying implementation of the analytical APIs used for profiling and dashboards (note: gradually being replaced byresolvers/)reconcilerscontains logic that for each project resource reconciles the desired state expressed in code with the actual state observed in external data systems.resolverscontains implementations of a unified interface for resolving data queries, which is used in the metrics APIs, alerts, reports, and more.servercontains a server that implements the runtime's APIs.storagecontains logic that wraps a project's persistent file storage (on disk and in an object store).testruntimecontains helper functions for initializing a test runtime with test data and test connectors.
Run rill devtool local. You need to stop and restart it using ctrl+C when you make code changes.
In one terminal, start a full cloud development environment except the runtime:
rill devtool start cloud --except runtimeIn a separate terminal, start a runtime server:
go run ./cli runtime startOptionally, deploy a seed project:
rill devtool seed cloudYou can run all tests using:
go test ./runtime/...The runtime server is configured using environment variables parsed in cli/cmd/runtime/start.go.
We define our APIs using gRPC and use gRPC-Gateway to map the RPCs to a RESTful API. See proto/README.md for details.
To add a new endpoint:
- Describe the endpoint in
proto/rill/runtime/v1/api.proto - Re-generate gRPC and OpenAPI interfaces by running
make proto.generate - Copy the new handler signature from the
RuntimeServiceServerinterface inproto/gen/rill/runtime/v1/api_grpc_pb.go - Paste the handler signature and implement it in a relevant file in
runtime/server/
- Add a new endpoint for the query by following the steps in the section above ("Adding a new endpoint")
- Implement the query in
runtime/queriesby following the instructions inruntime/queries/README.md
The following steps apply for macOS, but a similar approach should work for Linux.
- Download the latest DuckDB nightly from Github from the "Artifacts" section on the newest workflow run here)
- Unzip the downloaded archive and copy the
libduckdb.dylibfile in thelibduckdb-osx-universalfolder to/usr/local/lib
- You must use the command-line to copy the file. If you touch it using the Finder, macOS will quarantine it. To remove a quarantine, run:
xattr -d com.apple.quarantine libduckdb.dylib.
- DuckDB usually does not support older file formats, so delete the
stage.dbandstage.db.walfiles in yourdev-project - Add the flag
-tags=duckdb_use_libwhen runninggo runorgo buildto use the nightly build of DuckDB
- If testing the local frontend, you need to temporarily set it in the
dev-runtimescript inpackage.json - For details, see Linking DuckDB
Note: DuckDB often makes breaking changes to its APIs, so you may encounter other errors when using a dev version of DuckDB.