Git Product home page Git Product logo

bb-remote-asset's Introduction

Buildbarn Remote Asset - Prototype Build status Go Report CardDocker Pulls

N.B This repository provides tools which are in early development and may be subject to regular changes to functionality and/or configuration definitions.

This repository provides a service for the remote asset protocol. This protocol is used by tools such as bazel / buildstream to provide a mapping between URIs and qualifiers to digests which can be used by the remote execution (REv2) protocol.

The remote asset daemon can be configured with bb-storage blobstore backends to enable a scalable remote asset service which can be integrated with any REv2 compatible GRPC cache.

Setting up the Remote Asset daemon

With Action Cache

$ cat config/bb_remote_asset.jsonnet
{
  fetcher: {
    caching: {
      fetcher: {
        http: {
          allowUpdatesForInstances: ['foo'],
          contentAddressableStorage: common.blobstore.contentAddressableStorage,
        },
      },
    },
  },
  assetCache: {
    actionCache: {
      blobstore: common.blobstore,
    },
  },
  global: common.global,
  grpcServers: [{
    listenAddresses: [':8981'],
    authenticationPolicy: { allow: {} },
  }],
  allowUpdatesForInstances: ['foo'],
  maximumMessageSizeBytes: 16 * 1024 * 1024 * 1024,
}

With Blob Access cache

$ cat config/bb_remote_asset.jsonnet
{
  fetcher: {
    caching: {
      fetcher: {
        http: {
          allowUpdatesForInstances: ['foo'],
          contentAddressableStorage: common.blobstore.contentAddressableStorage,
        },
      },
    },
  },

  assetCache: {
    blobAccess: {
      assetStore: {
        'local': {
          keyLocationMapOnBlockDevice: {
            file: {
              path: '/storage/key_location_map',
              sizeBytes: 1024 * 1024,
            },
          },
          keyLocationMapMaximumGetAttempts: 8,
          keyLocationMapMaximumPutAttempts: 32,
          oldBlocks: 8,
          currentBlocks: 24,
          newBlocks: 3,
          blocksOnBlockDevice: {
            source: {
              file: {
                path: '/storage/blocks',
                sizeBytes: 100 * 1024 * 1024,
              },
            },
            spareBlocks: 3,
          },
          persistent: {
            stateDirectoryPath: '/storage/persistent_state',
            minimumEpochInterval: '5m',
          },
        },
      },
      contentAddressableStorage:
        common.blobstore.contentAddressableStorage,
    },
  },
  global: common.global,
  grpcServers: [{
    listenAddresses: [':8981'],
    authenticationPolicy: { allow: {} },
  }],
  allowUpdatesForInstances: ['foo'],
  maximumMessageSizeBytes: 16 * 1024 * 1024 * 1024,
}

Both of the above configs rely on there being a common.libsonnet file.

$ docker run \
    -p 8981:8981 \
    -v $(pwd)/config:/config \
    -v $(pwd)/storage-asset:/storage-asset \
    bazel/cmd/bb_remote_asset:bb_remote_asset_container \
    /config/bb_remote_asset.jsonnet

In the example above, the daemon is configured to store asset references within a disk backed circular storage backend. The fetcher is configured to support fetching via HTTP when a reference is not found matching the request URI/Qualifier criteria, these fetched blobs are placed into a REv2 compatible GRPC cache and the digest returned to the remote asset client. HTTP Fetched blobs are configured to be cached references to newly fetched blobs in the asset store for future fetches.

Bazel can be configured to use this service as a remote uploader as follows:

$ bazel build --remote_cache=grpc://<cache_address>:<cache grpc port> --remote_instance_name=foo --experimental_remote_downloader="grpc://localhost:8981" //...

bb-remote-asset's People

Contributors

arlyon avatar edschouten avatar jlaxson avatar minor-fixes avatar mortenmj avatar qinusty avatar sdclarke avatar tomcoldrick-ct avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.