Skip to content

Commit 4b6363c

Browse files
committed
Improve documentation for the Buildbarn example
1 parent f93c040 commit 4b6363c

File tree

3 files changed

+42
-22
lines changed

3 files changed

+42
-22
lines changed

examples/remote_execution/buildbarn/.buckconfig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
root = .
33
prelude = prelude
44

5-
[buck2]
6-
digest_algorithms = SHA256
7-
85
[buck2_re_client]
9-
action_cache_address = http://localhost:8980
10-
engine_address = http://localhost:8980
11-
cas_address = http://localhost:8980
6+
action_cache_address = grpc://localhost:8980
7+
engine_address = grpc://localhost:8980
8+
cas_address = grpc://localhost:8980
129

1310
[build]
1411
execution_platforms = root//platforms:platforms
Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1-
## Remote execution integration with Build Barn
1+
## Remote execution integration with Buildbarn
22

3-
This project provides a small example of what a project that utilizes [Build Barn](https://github.com/buildbarn) for RE might look like.
3+
This project provides a small example of what a project that utilizes [Buildbarn](https://github.com/buildbarn).
44

55
In this document, we will go over the key configs used in this setup.
6+
Using a local docker-compose deployment from the [example deployment repo](https://github.com/buildbarn/bb-deployments)
67

7-
### Relevant configs in .buckconfig
8+
### Deploy Buildbarn
89

9-
First, the Build Barn endpoint and certificate should be configured as the following:
10+
This is mostly a turn-key solution, with just one modification.
11+
Buck2 does not yet support instance-name prefixes for different workers [issue link](https://github.com/facebook/buck2/issues/180).
12+
So we will remove that from the deployment.
1013

11-
```ini
12-
[buck2_re_client]
13-
engine_address = $BB_ENDPOINT
14-
action_cache_address = $BB_ENDPOINT
15-
cas_address = $BB_ENDPOINT
1614
```
15+
... $ git clone https://github.com/buildbarn/bb-deployments
16+
... $ cd bb-deployments
17+
.../bb-deployments # Temporary workaround for issue #180: Remove the instance-name prefix
18+
.../bb-deployments $ sed -i 's/instanceNamePrefix: \'fuse\'/instanceNamePrefix: \'\'/' docker-compose/config/worker-fuse-ubuntu22-04.jsonnet
19+
.../bb-deployments $ cd docker-compose
20+
.../bb-deployments/docker-compose $ ./run.sh
21+
```
22+
23+
This uses `docker-compose` to spin up the required Buildbarn services.
24+
Using FUSE based workers, those are generally the fastest as they can load action files on demand
25+
and avoids the overhead of setting up the full input root up front.
26+
In practice many actions do not read all the files in the input root.
27+
28+
If you do not want FUSE workers you can instead switch to hardlinking workers
29+
```
30+
.../bb-deployments $ sed -i 's/instanceNamePrefix: \'hardlinking\'/instanceNamePrefix: \'\'/' docker-compose/config/worker-hardlinking-ubuntu22-04.jsonnet
31+
```
32+
33+
More information is available in the [repo](https://github.com/buildbarn/bb-deployments).
34+
35+
### Relevant configs in .buckconfig
1736

18-
If you're using the Docker-compose setup, the endpoint would be `http://localhost:8980` for all 3 of those.
37+
First, the Buildbarn endpoint should be configured as the following:
1938

20-
Additionally, set the `digest_algorithm` config to `SHA256`.
2139
```ini
22-
[buck2]
23-
digest_algorithms = SHA256
40+
[buck2_re_client]
41+
engine_address = grpc://localhost:8980
42+
action_cache_address = grpc://localhost:8980
43+
cas_address = grpc://localhost:8980
2444
```
2545

26-
### Relevant configs in `ExecutionPlatformInfo`
46+
No TLS is used in this example (for history see this [issue](https://github.com/facebook/buck2/issues/156)).
2747

28-
Build Barn takes in a Docker image and OSFamily in its RE properties to select a worker.
48+
### Relevant configs in `ExecutionPlatformInfo`
2949

30-
The execution platform used in this project `root//platforms:platforms` do so.
50+
The Buildbarn workers take in a Docker image as their execution platform.
51+
The execution platform used in this project `root//platforms:platforms` uses the `container-image` key to set this up.

examples/remote_execution/buildbarn/platforms/defs.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def _platforms(ctx):
2121
# Set those up based on what workers you've registered with Build Barn.
2222
remote_execution_properties = {
2323
"OSFamily": "Linux",
24+
# This could be any Docker image.
25+
# This one is Ubuntu 22.04 with many common language tools installed.
2426
"container-image": "docker://ghcr.io/catthehacker/ubuntu:act-22.04@sha256:5f9c35c25db1d51a8ddaae5c0ba8d3c163c5e9a4a6cc97acd409ac7eae239448",
2527
},
2628
remote_execution_use_case = "buck2-default",

0 commit comments

Comments
 (0)