CAS server

It is possible to configure BuildGrid with just a Content Addressable Storage service.

Note

This service can be equivalent to BuildStream’s Artifact Server if the Reference Storage Service is included.

Configuration

Here is an example project configuration. It also implements an optional API called the Reference Storage Service, which if used, allows the user to store a Digest behind a user defined key.

server:
  - !channel
    address: localhost:50051
    insecure_mode: true

instances:
  - name: main

    storages:
      - !disk-storage &main-storage
        path: !expand-path $HOME/cas

    services:
      - !cas
        storage: *main-storage

      - !bytestream
        storage: *main-storage

      - !reference-cache
        storage: *main-storage
        max-cached-refs: 512

Hint

Use - name: "" if using with BuildStream, as instance names are not supported for that tool yet.

This defines a single main instance of the CAS, Bytestream and Reference Storage service on port 55051. It is backed onto disk storage and will populate the folder $HOME/cas. To start the server, simply type into your terminal:

bgd server start data/config/artifacts.yml

The server should now be available to use.

Note

According to the Remote Execution API, when receiving a ByteStream.Write() request for a digest that was already uploaded, the server should immediately return a response with commited_size equal to the size of the blob.

However, half-closing a gRPC ByteStream can cause issues with some proxies. 1 In order to work around those limitations, the bytestream service provides an option to slightly alter its behavior:

- !bytestream
      storage: *cas-storage
      disable-overwrite-early-return: true

When enabled, the server will read all the client’s WriteRequest messages from the stream and return successfully without performing an actual write to the storage.

1

https://github.com/haproxy/haproxy/issues/1219