Skip to content

Commit

Permalink
Merge pull request #96 from depot/docs-add-cache-product
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegalbraith authored Dec 6, 2024
2 parents d6b15ec + 7c6537e commit e8a855d
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 0 deletions.
25 changes: 25 additions & 0 deletions content/cache/authentication.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Authentication
ogTitle: Authentication for Depot remote caching
description: Learn how to authenticate with Depot remote caching
---

Depot Cache supports authenticating with user tokens and organization tokens. Additionally, [Depot-managed GitHub Actions runners](/docs/github-actions/overview) are pre-configured with single-use job tokens.

## Token types

- **User tokens** are used to authenticate as a specific user and can be generated from your [user settings](/settings) page.

- **Organization tokens** are used to authenticate as an organization. These tokens can be generated from your organization's settings page.

- **Depot GitHub Actions runners** are pre-configured with single-use job tokens. If you are using the automatic Depot Cache integration with Depot runners, you do not need to manually configure authentication.

## Configuring build tools

For specific details on how to configure your build tools to authenticate with Depot Cache, refer to the following guides:

- [Bazel](/docs/cache/bazel)
- [Gradle](/docs/cache/gradle)
- [Pants](/docs/cache/pants)
- [sccache](/docs/cache/sccache)
- [Turborepo](/docs/cache/turborepo)
38 changes: 38 additions & 0 deletions content/cache/bazel.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Bazel
ogTitle: Remote caching for Bazel builds
description: Learn how to use Depot remote caching for Bazel builds
---

[**Bazel**](https://bazel.build/) is a build tool that builds code quickly and reliably. It is used by many large projects, including Google, and is optimized for incremental builds with advanced local and remote caching and parallel execution. Bazel supports many different languages and platforms, and is highly configurable, scaling to codebases of any size.

[**Depot Cache**](/docs/cache/overview) provides a remote cache service that can be used with Bazel, allowing you to incrementally cache and reuse parts of your builds. This cache is accessible from anywhere, both on your local machine and on CI/CD systems.

## Configuring Bazel to use Depot Cache

Depot Cache can be used with Bazel from Depot's managed GitHub Actions runners, from your local machine, or from any CI/CD system.

### From Depot-managed Actions runners

[Depot GitHub Actions runners](/docs/github-actions/overview) are pre-configured to use Depot Cache with Bazel - each runner is launched with a `$HOME/.bazelrc` file that is pre-populated with the connection details for Depot Cache.

If this automatic configuration is incompatible with your specific setup, you can disable automatic configuration in your organization settings page and manually configure Bazel to use Depot Cache as described below.

### From your local machine or any CI/CD system

To manually configure Bazel to use Depot Cache, you will need to set two build flags in your `.bazelrc` file. Configure Bazel to use the Depot Cache service endpoint and set API token as the `authorization` header:

```bash
build --remote_cache=https://cache.depot.dev
build --remote_header=authorization=DEPOT_TOKEN
```

If you are a member of multiple organizations, and you are authenticating with a user token, you must additionally specify which organization to use for cache storage with the `x-depot-org` header:

```bash
build --remote_header=x-depot-org=DEPOT_ORG_ID
```

## Using Depot Cache with Bazel

Once Bazel is configured to use Depot Cache, you can then run your builds as you normally would. Bazel will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
60 changes: 60 additions & 0 deletions content/cache/gradle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Gradle
ogTitle: Remote caching for Gradle builds
description: Learn how to use Depot remote caching for Gradle builds
---

[**Gradle**](https://gradle.org/) is the build tool of choice for Java, Android, and Kotlin. It is used in many large projects, including Android itself, and is optimized for incremental builds, advanced local and remote caching, and parallel execution. Gradle supports many different languages and platforms, and is highly configurable, scaling to codebases of any size.

[**Depot Cache**](/docs/cache/overview) provides a remote cache service that can be used with Gradle, allowing you to incrementally cache and reuse parts of your builds. This cache is accessible from anywhere, both on your local machine and on CI/CD systems.

## Configuring Gradle to use Depot Cache

Depot Cache can be used with Gradle from Depot's managed GitHub Actions runners, from your local machine, or from any CI/CD system.

### From Depot-managed Actions runners

[Depot GitHub Actions runners](/docs/github-actions/overview) are pre-configured to use Depot Cache with Gradle - each runner is launched with an `init.gradle` file that is pre-populated with the connection details for Depot Cache. You will need to verify that caching is enabled in your `gradle.properties` file.

```properties
org.gradle.caching=true
```

If this automatic configuration is incompatible with your specific setup, you can disable automatic configuration in your organization settings page and manually configure Gradle to use Depot Cache as described below.

### From your local machine or any CI/CD system

To manually configure Gradle to use Depot Cache, you will need to configure remote caching in your `settings.gradle` file. Configure Gradle to use the Depot Cache service endpoints and set your API token in the `Authorization` header:

`settings.gradle`:

```groovy
buildCache {
remote(HttpBuildCache) {
url = 'https://cache.depot.dev'
enabled = true
push = true
headers {
header 'Authorization', 'DEPOT_TOKEN'
}
}
}
```

If you are a member of multiple organizations, and you are authenticating with a user token, you must additionally specify which organization to use for cache storage with the `x-depot-org` header:

```groovy
buildCache {
remote(HttpBuildCache) {
...
headers {
header 'Authorization', 'DEPOT_TOKEN'
header 'x-depot-org', 'DEPOT_ORG_ID'
}
}
}
```

## Using Depot Cache with Gradle

Once Gradle is configured to use Depot Cache, you can then run your builds as you normally would. Gradle will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
38 changes: 38 additions & 0 deletions content/cache/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Depot Cache
ogTitle: Overview of Depot remote caching
description: Learn how to use Depot remote cache for exponentially faster builds for tools like Bazel, Turborepo, sccache, Pants, and Gradle.
---

import {CacheToolLogoGrid} from '~/components/docs/CacheToolLogoGrid'

**Depot Cache** is our remote caching service that speeds up your builds by providing incremental builds and accelerated tests, both locally and inside of your favorite CI provider.

One of the biggest benefits of adopting advanced build tools like Bazel is the ability to build only the parts of your codebase that have changed. Or, in other words, incremental builds. This is done by reusing previously built artifacts that have not changed via a build cache.

## Supported tools

Depot Cache integrates with build tools that support remote caching like Bazel, Turborepo, sccache, Pants, and Gradle. For information about how to configure each tool to use Depot Cache, see the tool documentation:

<CacheToolLogoGrid />

<small>
Don't see a tool that supports remote caching that you use? Let us know in our [Discord
Community](https://discord.gg/MMPqYSgDCg)!
</small>

## How does it work?

Supported build tools can be configured to use Depot Cache, so that they store and retrieve build artifacts from Depot's remote cache. That cache can then be used from local development environments, CI/CD systems, or anywhere else you run your builds.

This speeds up your builds and tests by orders of magnitude, especially for large codebases, as those builds and tests become incremental. Instead of always having to rebuild from scratch, only the parts of your codebase that have changed are rebuilt, and only affected tests are re-run.

## Where can I use Depot Cache?

Depot Cache is accessible anywhere you run your builds, in local development or from any CI/CD system. Additionally, all supported tools are pre-configured to use Depot Cache when using [Depot GitHub Actions Runners](/docs/github-actions/overview).

This means that build artifacts are shared between different members of your team and sequential CI/CD jobs, making these builds and tests incremental.

## Pricing

Depot Cache is available on all of our pricing plans. Each plan includes a block of cache storage. Each additional GB over the included amount is billed at **$0.20/GB/month**. See our [pricing page](/pricing) for more details.
46 changes: 46 additions & 0 deletions content/cache/pants.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Pants
ogTitle: Remote caching for Pants builds
description: Learn how to use Depot remote caching for Pants builds
---

[**Pants**](https://www.pantsbuild.org/) is an ergonomic build tool for codebases of all sizes and supports Python, Go, Java, Scala, Kotlin, Shell, and Docker. It is used in many large projects, including Coinbase, IBM, and Slack, and is optimized for fine-grained incremental builds with advanced local and remote cachin. Pants is highly configurable and can scale to codebases of any size.

[**Depot Cache**](/docs/cache/overview) provides a remote cache service that can be used with Pants, allowing you to incrementally cache and reuse parts of your builds. This cache is accessible from anywhere, both on your local machine and on CI/CD systems.

## Configuring Pants to use Depot Cache

Depot Cache can be used with Pants from Depot's managed GitHub Actions runners, from your local machine, or from any CI/CD system.

### From Depot-managed Actions runners

[Depot GitHub Actions runners](/docs/github-actions/overview) are pre-configured to use Depot Cache with Pants - each runner is launched with a `pants.toml` file that is pre-configured with the connection details for Depot Cache.

If this automatic configuration is incompatible with your specific setup, you can disable automatic configuration in your organization settings page and manually configure Pants to use Depot Cache as described below.

### From your local machine or any CI/CD system

To manually configure Pants to use Depot Cache, you will need to enable remote caching in your `pants.toml`. Configure Pants to use the Depot Cache service endpoints and set your API token in the `Authorization` header:

`pants.toml`:

```toml
[GLOBAL]
# Enable remote caching
remote_cache_read = true
remote_cache_write = true

# Point remote caching to Depot Cache
remote_store_headers = { "Authorization" = "DEPOT_TOKEN" }
remote_store_address = "grpcs://cache.depot.dev"
```

If you are a member of multiple organizations, and you are authenticating with a user token, you must additionally specify which organization to use for cache storage using the `x-depot-org` header:

```toml
remote_store_headers = { "x-depot-org" = "DEPOT_ORG_ID" }
```

## Using Depot Cache with Pants

Once Pants is configured to use Depot Cache, you can then run your builds as you normally would. Pants will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
38 changes: 38 additions & 0 deletions content/cache/sccache.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: sccache
ogTitle: Remote caching for sccache builds
description: Learn how to use Depot remote caching for sccache builds
---

[**sccache**](https://github.com/mozilla/sccache) is a ccache-like compiler caching tool that was created by Mozilla. It is a compiler wrapper that avoids compilation when possible and stores cached results locally or in remote storage. It supports caching the compilation of several languages including C, C++, and Rust. sccache is used in many large projects, including Firefox, and is optimized for incremental builds and advanced local and remote caching.

[**Depot Cache**](/docs/cache/overview) provides a remote cache service that can be used with sccache, allowing you to incrementally cache and reuse parts of your builds. This cache is accessible from anywhere, both on your local machine and on CI/CD systems.

## Configuring sccache to use Depot Cache

Depot Cache can be used with sccache from Depot's managed GitHub Actions runners, from your local machine, or from any CI/CD system.

### From Depot-managed Actions runners

[Depot GitHub Actions runners](/docs/github-actions/overview) are pre-configured to use Depot Cache with sccache - each runner is launched with a `SCCACHE_WEBDAV_ENDPOINT` environment variable and is pre-configured with the connection details for Depot Cache.

If this automatic configuration is incompatible with your specific setup, you can disable automatic configuration in your organization settings page and manually configure sccache to use Depot Cache as described below.

### From your local machine or any CI/CD system

To manually configure sccache to use Depot Cache, you will need to set two environment variables in your environment, representing the Depot Cache service endpoint and your API token:

```shell
export SCCACHE_WEBDAV_ENDPOINT=https://cache.depot.dev
export SCCACHE_WEBDAV_PASSWORD=DEPOT_TOKEN
```

If you are a member of multiple organizations, and you are authenticating with a user token, you must additionally specify which organization to use for cache storage as follows:

```shell
export SCCACHE_WEBDAV_USERNAME=DEPOT_ORG_ID
```

## Using Depot Cache with sccache

Once sccache is configured to use Depot Cache, you can then run your builds as you normally would. sccache will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.
33 changes: 33 additions & 0 deletions content/cache/turbo.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Turborepo
ogTitle: Remote caching for Turborepo builds
description: Learn how to use Depot remote caching for Turborepo builds
---

[**Turborepo**](https://turbo.build/) is a high-performance build system for JavaScript and TypeScript codebases, and is designed around scaling build performance for large monorepos. It is used by large projects at Netflix, AWS, and Disney, and supports incremental builds backed by local and remote cache options.

[**Depot Cache**](/docs/cache/overview) provides a remote cache service that can be used with Turborepo, allowing you to incrementally cache and reuse parts of your builds. This cache is accessible from anywhere, both on your local machine and on CI/CD systems.

## Configuring Turborepo to use Depot Cache

Depot Cache can be used with Turborepo from Depot's managed GitHub Actions runners, from your local machine, or from any CI/CD system.

### From Depot-managed Actions runners

[Depot GitHub Actions runners](/docs/github-actions/overview) are pre-configured to use Depot Cache with Turborepo - each runner is launched with a `TURBO_API` environment variable and is pre-configured with the connection details for Depot Cache.

If this automatic configuration is incompatible with your specific setup, you can disable automatic configuration in your organization settings page and manually configure Turborepo to use Depot Cache as described below.

### From your local machine or any CI/CD system

To manually configure Turborepo to use Depot Cache, you will need to set three environment variables in your environment. These represent the Depot Cache service endpoint, your API token, and your Depot organization id:

```shell
export TURBO_API=https://cache.depot.dev
export TURBO_TOKEN=DEPOT_TOKEN
export TURBO_TEAM=DEPOT_ORG_ID
```

## Using Depot Cache with Turborepo

Once Turborepo is configured to use Depot Cache, you can then run your builds as you normally would. Turborepo will automatically communicate with Depot Cache to fetch and reuse any stored build artifacts from your previous builds.

0 comments on commit e8a855d

Please sign in to comment.