Buildless + SCCache
Build caching with SCCache and Buildless
Using SCache with Buildless
SCCache is the spiritual successor to CCache, rewritten in Rust with an emphasis on distributed compile execution as well as caching. It is primarily used with the Rust toolchain, but can be used with nearly any C-like toolchain, like CCache.
Selecting a backend
SCCache supports many backends, including an HTTP-based backend and direct use of Redis.
HTTP ("Webdav") backend
SCCache provides the WebDAV adapter for plain HTTP or HTTP+TLS remote backends; it uses the SCCACHE_WEBDAV_*
set of variables, which should be set as demonstrated below:
Variable | Value |
---|---|
SCCACHE_WEBDAV_ENDPOINT | https://sccache.less.build/cache/generic |
SCCACHE_WEBDAV_USERNAME | apikey (Literal value) |
SCCACHE_WEBDAV_PASSWORD | Your API key |
The HTTP backend is great because it is easy to understand, monitor, and diagnose; in some cases, though, the Redis-based adapter may perform better.
Redis backend
SCCache also supports caching via Redis-compliant backends. Buildless API endpoints natively speak Redis protocol. To configure this backend, you'll use the SCCACHE_REDIS
variable, which specifies a formatted connection URL. Here's an example:
Variable | Value |
---|---|
SCCACHE_REDIS | rediss://apikey:{your key}@redis.less.build:6379 |
Let's break this URL down into components:
Component | Meaning | Notes |
---|---|---|
rediss:// | Activate TLS | Buildless uses TLS with publicly-verifiable certificates. |
apikey | Redis username | The literal string apikey , or a specific org tenant ID. |
{your key} | Redis password | Your API key should be used in this field. |
redis.less.build | Endpoint | Traffic endpoint. |
6379 | Port | Buildless uses the standard Redis port, 6379 . |
For more information about using Redis with Buildless, see our Buildless + Redis guide.
S3 backend
SCCache can also use S3-compatible APIs as remote storage. Buildless provides support for S3 on a dedicated endpoint. To configure this backend, set the following variable values on your environment:
Variable | Value | Notes |
---|---|---|
SCCACHE_ENDPOINT | https://sccache.less.build/cache/s3 | - |
SCCACHE_BUCKET | <Your bucket name> | The name should be unique within your account. |
AWS_ACCESS_KEY_ID | <API Key ID> | The public ID for your API Key should be used. |
AWS_SECRET_ACCESS_KEY | <API Key value> | The literal API Key value should be used in this field. |
See our S3 REST API documentation for a full compatibility guide.
Updated about 1 year ago