Files
buildkit/hack/composefiles/README.md
Jonathan A. Sternberg e1c4fda48c hack: configure the otel-collector for hack/compose
Configure the otel-collector for `hack/compose` to use it for processing
traces and forwarding to jaeger. This simplifies the configuration and
also opens up the ability to configure additional behavior around traces
and metrics for debugging.

This also removes the automatic override file and the gitignore file. It
wasn't really working well for me and made it difficult to share
extensions to the development environment. I'm going to try something
different for that in a different change.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-03-13 11:01:30 -05:00

2.3 KiB

Buildkit Docker Compose

The hack/compose script provides a convenient development environment for building and testing buildkit with some useful supporting services and configuration using docker compose to assemble the environment. This configuration is not meant for production deployments.

Usage

The primary way to use the script is as a substitute to docker compose.

$ hack/compose up -d

All arguments to this script will be forwarded to docker compose. This will use the moby/buildkit:local image to create a buildkit container. The image can be either built with make images or the --build flag can be used.

$ hack/compose up -d --build

To access the newly created development buildkit, use either:

$ buildctl --addr docker-container://buildkit-dev ...

or alternatively configure a new builder with buildx.

$ docker buildx create \
    --bootstrap \
    --name dev \
    --driver remote \
    docker-container://buildkit-dev

Extending Configuration

The compose definition can be extended by using -f $COMPOSE_FILE to extend the configuration. These files are in the extensions folder.

As an example, an extension can be used for aiding with buildx metrics development:

$ hack/compose -f hack/composefiles/extensions/buildx.yaml up -d --build

This will modify the otel-collector configuration to emit buildx metrics to the debug exporter.

Some of the files in this directory can be combined and some conflict with each other. In particular, configurations that modify the otel-collector probably conflict with each other.

Running the debugger

The debugger is exposed for the local buildkit when --build is used to build the local image. This can be accessed using delve or any GUI client that uses delve (such as JetBrains GoLand).

$ dlv connect localhost:5000

More detailed documentation on remote debugging is here.

OpenTelemetry

OpenTelemetry is automatically configured for traces. These can be visualized through Jaeger.

Traces

Traces are sent to Jaeger. Traces that happen in buildctl and buildx are automatically sent to buildkit which forwards them to Jaeger.