Deploying a BuildBuddy cluster
First you’ll need to deploy the BuildBuddy app which serves the BuildBuddy UI, acts as a scheduler, and handles caching - which we still recommend deploying to a Linux Kubernetes cluster.Enterprise RBE Setup
Follow the standard Enterprise RBE Setup instructions to get your cluster up and running.
Mac environment setup
Once you have a BuildBuddy cluster deployed with RBE enabled, you can start setting up your Mac executors.Downloading Xcode
When starting with a clean Mac, you’ll first need to make sure Xcode is installed. You can download Xcode from Apple’s Developer Website (you’ll need an Apple Developer account).We recommend installing at least Xcode 12.2 (which is the default Xcode version used if no
--xcode_version Bazel flag is specified).Installing Xcode
Once your .xip file is downloaded, you can expand it with the following command.Applications directory with the version number as a suffix (so multiple Xcode versions can be installed together and selected between using the --xcode_version Bazel flag).
Installing Homebrew
You’ll likely want to install Homebrew on your fresh executor to make installing other software easier. You can install it with the following line:Installing the BuildBuddy Mac executor
Now that the environment is configured, we can download and install the BuildBuddy Mac executor.Download the BuildBuddy executor
The BuildBuddy executor binary can be downloaded withcurl. Make sure to update the version number in the curl command to the lastest release, and download the correct binary for the target CPU architecture:
- AMD64
- Arm64
Make the executor executable
In order to run the executor binary, we must first make it executable with:Create directories
If you don’t already have any launch agents installed, you’ll need to make sure the~/Library/LaunchAgents/ directory exits with:
/tmp directory since this is periodically cleaned up.
Create config file
You’ll need to create aconfig.yaml with the following contents:
config.yaml
Create a Launch Agent .plist file
Now that everything is in place, we can create a LaunchAgent .plist file that tells Mac OS to keep the executor binary running on launch, and restart it if ever stops. You can place this file in~/Library/LaunchAgents/buildbuddy-executor.plist.
~/Library/LaunchAgents/buildbuddy-executor.plist
Update Launch Agent plist permissions
You may need to update the file’s permissions with:Start the Launch Agent
You can load the Launch Agent with:Verify installation
You can verify that your BuildBuddy Executor successfully connected to the cluster by live tailing the stdout file:Updating
You can check that an executor has successfully started by checking that itsreadyz endpoint returns the string OK:
Optional setup
Optional: Enable Autologin
If your Mac executor restarts for whatever reason, you’ll likely want to enable auto login so the executor will reconnect after rebooting instead of getting stuck on a login screen. There’s a convenientbrew package called kcpassword that makes this easy.
Optional: Install Java
If you’re doing a lot of Java builds on your Mac executors that are not fully hermetic (i.e. rely on the system installed Java rather than the remote Java SDK shipped by Bazel), you can install the JDK with:Optional: Increase the maximum number of open files
Some builds will exceed the default maximum number of open files on the Mac executor (which is relatively low). You’ll know if you’re hitting this limit if you see an error message that looks liketoo many open files in system.
You can increase this limit by running the following command:
Optional: Log rotation
If you find your logs are taking up too much space on disk, you may wish to implement log rotation. For this, we recommendmultilog from daemontools:
multilog is installed, in ~/Library/LaunchAgents/buildbuddy-executor.plist change:
~/Library/LaunchAgents/buildbuddy-executor.plist
~/Library/LaunchAgents/buildbuddy-executor.plist
~/Library/LaunchAgents/buildbuddy-executor.plist
This will produce automatically rotated log files with stdout and stderr interleaved. If you wish to preserve the separation of the out and error streams, you may use a more complex configuration, though generally this is not recommended, as the streams are more clear when left chronologically interleaved.
Learn more about multilog
Read the full multilog documentation