Development Environment Setup

BuildGrid comes with Docker support for local development use-cases.

Caution

The Docker manifests are intended to be use for local development only. Do not use them in production.

Please consult the Get Started with Docker guide if you are looking for instructions on how to setup Docker on your machine.

Docker build

BuildGrid ships a Dockerfile manifest for building images from source using docker build. In order to produce a buildgrid:local base image, run:

git clone https://gitlab.com/BuildGrid/buildgrid.git
cd buildgrid
docker build --tag buildgrid:local .

Note

The image built will contain the Python sources, including example configuration files. The main endpoint is the bgd CLI tools and the default command shall run the BuildGrid server loading default configuration.

Once completed, you can check that build succeed by locally starting in a container the BuildGrid server with default configuration. Simply run:

docker run --interactive --publish 50051:50051 buildgrid:local

Hint

You can run any of the BuildGrid CLI tool using that image, simply pass extra arguments to docker run the same way you would pass them to bgd.

Bear in mind that whenever the source code or the configuration files are updated, you must re-build the image.

Docker Compose

BuildGrid ships a docker-compose.yml manifest for building and running a grid locally using docker-compose. This is the recommended way of running a simple demo grid.

In order to produce a buildgrid:local base image, run:

git clone https://gitlab.com/BuildGrid/buildgrid.git
cd buildgrid
docker-compose build

Once completed, you can start a simple grid by running:

docker-compose up

Note

The grid is composed of five containers: - A PostgreSQL database available at localhost:5432. - An execution service available at http://localhost:50051. - A CAS service available at http://localhost:50052. - An ActionCache service available at http://localhost:50053. - A single unnamed instance with one host-tools based worker bot attached.

Hint

You can spin up more bots by using docker-compose scaling capabilities:

docker-compose up --scale bots=12

Hint

The contained services configuration files are bind mounted into the container, no need to rebuild the base image on configuration update. Configuration files are read from:

  • data/config/controller.conf for the Execution service.

  • data/config/storage.conf for the CAS service.

  • data/config/cache.conf for the ActionCache service

Minimal Docker Compose

BuildGrid also provides a docker-compose-bazel.yml manifest, which deploys a minimal BuildGrid that is easy to get working with Bazel. To use it, first build the buildgrid:local base image as above:

git clone https://gitlab.com/BuildGrid/buildgrid.git
cd buildgrid
docker-compose -f docker-compose-bazel.yml build

Once completed, you can start a simple grid by running:

docker-compose -f docker-compose-bazel.yml up

Note

The grid is composed of three containers:

  • A PostgreSQL database available at localhost:5432.

  • Execution, CAS, and ActionCache services available at http://localhost:50051.

  • A single unnamed instance with one host-tools based worker bot attached.

Hint

You can spin up more bots by using docker-compose scaling capabilities:

docker-compose -f docker-compose-bazel.yml up --scale bots=12

Hint

The configuration file is bind mounted into the container, no need to rebuild the base image on configuration update. Configuration files are read from:

  • data/config/bazel.conf for the BuildGrid services.