Skip to content

Commit

Permalink
Use BuildFarm for "local" remote execution.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbreen committed Nov 4, 2023
1 parent 61e2902 commit d6a72c7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 58 deletions.
11 changes: 6 additions & 5 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ build:docker --experimental_docker_use_customized_images
build:docker --strategy=CppCompile=docker --strategy=CppLink=docker --strategy=CcStrip=docker --strategy=MakeRpm=docker --strategy=MakeDeb=docker
build:docker --experimental_docker_privileged

build:remote --bes_results_url=http://localhost:8080/invocation/
build:remote --bes_backend=grpc://localhost:1985
build:remote --remote_cache=grpc://localhost:1985
build:remote --remote_timeout=120
build:remote --remote_executor=grpc://localhost:1985
build:bf --bes_results_url=http://localhost:8080/invocation/
build:bf --bes_backend=grpc://localhost:8980
build:bf --remote_cache=grpc://localhost:8980
build:bf --remote_timeout=120
build:bf --remote_executor=grpc://localhost:8980
build:bb --remote_upload_local_results

build:bb --bes_results_url=https://app.buildbuddy.io/invocation/
build:bb --bes_backend=grpcs://remote.buildbuddy.io
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ Emulate remote builds with the experimental docker strategy:
( cd executors; docker buildx bake )
bazel test --config docker //:platform-{hello,tar,deb,rpm}-test-suite

Start a local instance of BuildBuddy with remote execution enabled and your API
Key configured in `~/.bazelrc`
as `build:remote --remote_header=x-buildbuddy-api-key=[REDACTED]`:
Start a local instance of BuildFarm:

docker compose up -d
bazel test --config remote //:platform-{hello,tar,deb,rpm}-test-suite
bazel test --config bf //:platform-{hello,tar,deb,rpm}-test-suite

Use BuildBuddy Cloud and your API Key configured in `~/.bazelrc`
as `build:bb --remote_header=x-buildbuddy-api-key=[REDACTED]`:
Expand Down Expand Up @@ -118,7 +116,7 @@ What next?

Problems...

1. Failures on Ubuntu 23.04/lunar with docker provided by Ubuntu's docker.io package.
1. Failures on Ubuntu 23.04/lunar with docker provided by Ubuntu's docker snap:

bazel test --config docker //:platform-{hello,tar,deb,rpm}-test-suite --keep_going

Expand All @@ -131,7 +129,7 @@ Problems...
> sudo: /bin/sudo must be owned by uid 0 and have the setuid bit set
> ================================================================================
and similar for all DEB and RPM tests. Does not happen in GitHub Actions nor remotely.
and similar for all DEB and RPM tests. Does not happen in GitHub Actions nor remotely.

2. Excluding `exec_platforms` from `//:tars` theoretically means it should
declare that it is executable on the host: that seems to propagate to being
Expand Down
10 changes: 10 additions & 0 deletions buildfarm.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
backplane:
queues:
- name: "cpu"
properties:
- name: "min-cores"
value: "*"
- name: "max-cores"
value: "*"
worker:
allowBringYourOwnContainer: true
72 changes: 25 additions & 47 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,62 +1,40 @@
volumes:
mysql:
redis:

configs:
buildfarm:
file: ./buildfarm.config.yaml

services:
mysql:
image: mariadb:latest
environment:
MYSQL_RANDOM_ROOT_PASSWORD: yes
MYSQL_USER: buildbuddy
MYSQL_PASSWORD: buildbuddy
MYSQL_DATABASE: buildbuddy
volumes:
- mysql:/var/lib/mysql
healthcheck:
test: [CMD-SHELL, "mariadb -u$${MYSQL_USER?} -p$${MYSQL_PASSWORD?} $${MYSQL_DATABASE?}"]
redis:
image: redis:latest
backplane:
image: redis
volumes:
- redis:/data
healthcheck:
test: [CMD, redis-cli, ping]
app:
server:
depends_on:
mysql:
backplane:
condition: service_healthy
redis:
condition: service_healthy
image: gcr.io/flame-public/buildbuddy-app-enterprise:latest
image: bazelbuild/buildfarm-server
configs:
- buildfarm
environment:
ENV: onprem
CONFIG_PATH: /buildfarm
REDIS_URI: "redis://backplane:6379"
ports:
- 8080:8080
- 1985:1985
command:
- "--app.build_buddy_url=http://localhost:8080"
- "--app.events_api_url=grpc://localhost:1985"
- "--app.cache_api_url=grpc://localhost:1985"
- "--app.remote_execution_api_url=grpc://localhost:1985"
- "--app.default_redis_target=redis:6379"
- "--auth.enable_anonymous_usage=true"
- "--auth.enable_self_auth=true"
- "--cache.redis.redis_target=redis:6379"
- "--cache.redis_target=redis:6379"
- "--database.data_source=mysql://buildbuddy:buildbuddy@tcp(mysql)/buildbuddy"
- "--remote_execution.enable_remote_exec=true"
- "--storage.disk.root_directory=/var/cache/buildbuddy"
volumes:
- /var/cache/buildbuddy
executor:
- 8980:8980
worker:
ports:
- 8981:8981
depends_on:
- app
image: gcr.io/flame-public/buildbuddy-executor-enterprise:latest
- server
image: bazelbuild/buildfarm-worker
privileged: true
command:
- "--executor.app_target=grpc://app:1985"
- "--executor.local_cache_size_bytes=5368709120"
- "--executor.docker_socket=/var/run/docker.sock"
- "--executor.root_directory=/var/tmp/buildbuddy"
- "--executor.disable_local_cache=true"
configs:
- buildfarm
environment:
CONFIG_PATH: /buildfarm
REDIS_URI: "redis://backplane:6379"
volumes:
- /var/tmp/buildbuddy:/var/tmp/buildbuddy:rw
- /var/run/docker.sock:/var/run/docker.sock

0 comments on commit d6a72c7

Please sign in to comment.