blob: 1ca3887d6eea4abada68b02c4b1944f4970fb013 [file] [log] [blame]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
.. _cache_servers:
Configuring Cache Servers
BuildStream caches the results of builds in a local artifact cache, and will
avoid building an element if there is a suitable build already present in the
local artifact cache. Similarly it will cache sources and avoid pulling them if
present in the local cache. See :ref:`caches <caches>` for more details.
In addition to the local caches, you can configure one or more remote caches and
BuildStream will then try to pull a suitable object from one of the remotes,
falling back to performing a local build or fetching a source if needed.
On the client side, cache servers are declared and configured in
:ref:`user configuration <config_cache_servers>`, and since it is typical
for projects to maintain their own cache servers, it is also possible for
projects to provide recommended :ref:`artifact cache servers <project_artifact_cache>`
and :ref:`source cache servers <project_source_cache>` through project
configuration, so that downstream users can download from services
provided by upstream projects by default.
Setting up a remote cache
BuildStream relies on the `ContentAddressableStorage protocol
in order to exchange data with remote services, in concert with the `remote asset protocol
in order to assign symbolic labels (such as :ref:`artifact names <artifact_names>`) to identify
stored content. As such, BuildStream is able to function with any implementations of these
two services.
Known implementations
Here are some details about known open source implementations of the required protocols
The `Buildbarn <>`_ project provides a remote execution
service implementation for use in build tooling such as BuildStream, `Bazel <>`_
and `recc <>`_, the `bb-storage <>`_
and `bb-remote-asset <>`_ services are tested
to work as cache service for BuildStream's artifact and source caches.
A simple configuration to spin up the service using `docker compose <>`_ follows:
.. literalinclude:: ../../.github/compose/ci.buildbarn.yml
:language: yaml
Visit the `bb-storage <>`_ and
`bb-remote-asset <>`_ project pages to
find more documentation about setting up services with authentication enabled.