Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose: Add bb-remote-asset to setup #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

minor-fixes
Copy link

This change adds a bb-remote-asset setup to the docker-compose deployment example, which allows for:

  • easier local testing of bb-remote-asset with the other buildbarn components
  • a working example of how bb-remote-asset should be configured*

Tested: Started locally via docker-compose/run.sh; ran:

bazel clean --expunge && \
  rm -rf ~/.cache/bazel/_bazel_$USER/cache/ && \
  bazel build \
    --remote_executor=grpc://localhost:8980 \
    --remote_instance_name=fuse \
    --experimental_remote_downloader=grpc://localhost:8984 \
    //...

Build completed successfully, and remote-asset logs showed blobs being downloaded.

Ran the following twice:

grpc_cli call localhost:8984 \
  build.bazel.remote.asset.v1.Fetch.FetchBlob \
  'instance_name: "fuse" uris: "https:/bazelbuild/remote-apis/raw/main/build/bazel/remote/asset/v1/remote_asset.proto" qualifiers { name: "checksum.sri" value: "sha256-e8wR0NA0I8XHMeF8Fzk7EjHrLYQp4zUpZtXZIe3c3Fs=" }'

and got the following responses:

connecting to localhost:8984
status {
  message: "Blob fetched successfully!"
}
uri: "https:/bazelbuild/remote-apis/raw/main/build/bazel/remote/asset/v1/remote_asset.proto"
qualifiers {
  name: "checksum.sri"
  value: "sha256-e8wR0NA0I8XHMeF8Fzk7EjHrLYQp4zUpZtXZIe3c3Fs="
}
blob_digest {
  hash: "7bcc11d0d03423c5c731e17c17393b1231eb2d8429e3352966d5d921eddcdc5b"
  size_bytes: 21947
}
Rpc succeeded with OK status
connecting to localhost:8984
status {
  message: "Blob fetched successfully from asset cache"
}
uri: "https:/bazelbuild/remote-apis/raw/main/build/bazel/remote/asset/v1/remote_asset.proto"
qualifiers {
  name: "checksum.sri"
  value: "sha256-e8wR0NA0I8XHMeF8Fzk7EjHrLYQp4zUpZtXZIe3c3Fs="
}
blob_digest {
  hash: "7bcc11d0d03423c5c731e17c17393b1231eb2d8429e3352966d5d921eddcdc5b"
  size_bytes: 21947
}
Rpc succeeded with OK status

which indicates that caching functionality works as well.


*I don't actually know the best way to configure bb-remote-asset

This change adds a bb-remote-asset setup to the docker-compose
deployment example, which allows for:

* easier local testing of bb-remote-asset with the other buildbarn
  components
* a working example of how bb-remote-asset should be configured*

Tested: Started locally via `docker-compose/run.sh`; ran:

```
bazel clean --expunge && \
  rm -rf ~/.cache/bazel/_bazel_$USER/cache/ && \
  bazel build \
    --remote_executor=grpc://localhost:8980 \
    --remote_instance_name=fuse \
    --experimental_remote_downloader=grpc://localhost:8984 \
    //...
```

Build completed successfully, and remote-asset logs showed blobs being
downloaded.

Ran the following twice:

```
grpc_cli call localhost:8984 \
  build.bazel.remote.asset.v1.Fetch.FetchBlob \
  'instance_name: "fuse" uris: "https:/bazelbuild/remote-apis/raw/main/build/bazel/remote/asset/v1/remote_asset.proto" qualifiers { name: "checksum.sri" value: "sha256-e8wR0NA0I8XHMeF8Fzk7EjHrLYQp4zUpZtXZIe3c3Fs=" }'
```

and got the following responses:

```
connecting to localhost:8984
status {
  message: "Blob fetched successfully!"
}
uri: "https:/bazelbuild/remote-apis/raw/main/build/bazel/remote/asset/v1/remote_asset.proto"
qualifiers {
  name: "checksum.sri"
  value: "sha256-e8wR0NA0I8XHMeF8Fzk7EjHrLYQp4zUpZtXZIe3c3Fs="
}
blob_digest {
  hash: "7bcc11d0d03423c5c731e17c17393b1231eb2d8429e3352966d5d921eddcdc5b"
  size_bytes: 21947
}
Rpc succeeded with OK status
```

```
connecting to localhost:8984
status {
  message: "Blob fetched successfully from asset cache"
}
uri: "https:/bazelbuild/remote-apis/raw/main/build/bazel/remote/asset/v1/remote_asset.proto"
qualifiers {
  name: "checksum.sri"
  value: "sha256-e8wR0NA0I8XHMeF8Fzk7EjHrLYQp4zUpZtXZIe3c3Fs="
}
blob_digest {
  hash: "7bcc11d0d03423c5c731e17c17393b1231eb2d8429e3352966d5d921eddcdc5b"
  size_bytes: 21947
}
Rpc succeeded with OK status
```

which indicates that caching functionality works as well.

---

*I don't actually know the best way to configure bb-remote-asset

remote-asset:
# TODO(minor-fixes): Replace with actual container once pushed to ghcr
image: bazel/cmd/bb_remote_asset:bb_remote_asset_container
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't be merged as-is until this image is put somewhere public (ghcr.io?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind updating the image reference now when ghcr.io/buildbarn/bb-remote-asset:20230910T205857Z-52b25db is available?

minor-fixes added a commit to buildbarn/bb-remote-asset that referenced this pull request Sep 10, 2023
This change brings bb-remote-asset up-to-date with bb-storage/bb-remote-execution, so that nominally they may be able to use compatible configs, and likely inherit the other benefits (more recent toolchain, better bazel integration, etc.)

This is done largely by copying `WORKSPACE` from bb-storage, making sure to match versions and orderings to ensure that the same versions of dependencies are loaded.

Other transforms/migrations that proved necessary:0000
* `HTTPClient` was eliminated from bb-storage; mocking had to be done on a `http.RoundTripper` instead, in the same manner as buildbarn/bb-storage@b9951ac
* Addition of structured concurrency to main, similar to buildbarn/bb-storage@4f243ea
* Addition of `http.ClientConfiguration` proto options to `HttpFetcherConfiguration`
* `bazel.canonical_id` added to the list of supported qualifiers, which prevents errors in some (most?) WORKSPACE configurations

Tested: 
* `bazel test //...` with buildbarn/bb-storage#170 works on my system
* Seems to work as expected when integrated with the bb-deployments docker-compose setup as in buildbarn/bb-deployments#91
@moroten
Copy link
Collaborator

moroten commented Sep 12, 2023

See comment in the code. Shall some test execution also be updated to run with --experimental_remote_downloader?


remote-asset:
# TODO(minor-fixes): Replace with actual container once pushed to ghcr
image: bazel/cmd/bb_remote_asset:bb_remote_asset_container
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind updating the image reference now when ghcr.io/buildbarn/bb-remote-asset:20230910T205857Z-52b25db is available?

ports:
- 8984:8984
volumes:
- ./config:/config
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Please add an empty line at the end of file.

listenAddresses: [':8984'],
authenticationPolicy: { allow: {} },
}],
allowUpdatesForInstances: ['foo'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a more descriptive name, or just a comment, about what this instance name refers to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants