# Air-gapped installation (/self-hosting/deployment/air-gapped)

Toucan AI runs without internet access. At runtime it calls none of our services and loads no CDN
script or web font: it only calls the services you configure.

Follow the [deployment steps](./deployment-steps.mdx), with the changes below.

## What you provide [#what-you-provide]

The [required components](../architecture/required-components.mdx), all inside your network: the LLM
and the embeddings run on your own endpoints, such as vLLM, Ollama or LiteLLM. You also need a
container registry the cluster can pull from.

If their certificates come from your own certificate authority, give the chart
[its bundle](../authentication-and-networking/network-requirements.mdx#internal-certificate-authority).

## Mirror the chart and the images [#mirror-the-chart-and-the-images]

From a machine with internet access, log in to our registry with your access token, then pull the
chart:

```sh
helm registry login registry.distr.sh -u - --password-stdin <<< "$DISTR_TOKEN"
helm pull oci://registry.distr.sh/toucantoco/toucan-ai-chart --version <version>
```

Then copy the images your values use into your registry. Ours go at its root:
`registry.distr.sh/toucantoco/backend:<tag>` becomes `registry.example.com/backend:<tag>`.
Third-party images keep their path minus the registry host: `docker.io/library/redis:8.8.1` becomes
`registry.example.com/library/redis:8.8.1`.

For instance with [skopeo](https://github.com/containers/skopeo), which copies images between
registries without Docker: log in to both with `skopeo login registry.distr.sh` and
`skopeo login registry.example.com`, then run the script below. It empties `global.imageRegistry` so
that `helm template` shows where each image comes from.

```sh
helm template toucan-ai toucan-ai-chart-<version>.tgz -f values.yaml --set global.imageRegistry= \
  | sed -nE "s/^[ -]*image: *['\"]?([^'\" ]+).*/\1/p" | sort -u \
  | while read -r src; do
      dst=${src#registry.distr.sh/toucantoco/}
      skopeo copy --all "docker://$src" "docker://registry.example.com/${dst#*/}"
    done
```

This command does not list the AI Crew's image, because the chart passes it to the worker as
configuration. If you enable `backend.aiCrew`, also copy `registry.distr.sh/toucantoco/ai-crew`, with
the backend's tag.

If your registry is not reachable from that machine, copy each image the same way to an archive
(`oci-archive:redis.tar`), carry the archives over, then copy them to your registry.

## Configure the chart [#configure-the-chart]

Set `global.imageRegistry` in your values to the registry you copied the images to: it applies to
every image, the bundled PostgreSQL, Redis and Garage included. If your registry requires
authentication, list the secret of its credentials under `global.imagePullSecrets`, in place of
`distr`:

```yaml
global:
  imageRegistry: registry.example.com
  imagePullSecrets:
    - name: registry-credentials
```

With the AI Crew enabled, its runs call your LLM endpoint directly. Its network policy only lets them
reach public addresses, so add your endpoint to `backend.aiCrew.networkPolicy.extraEgress`, and
`PUBLIC_URL` if it resolves to a private address. See
[AI Crew variables](../architecture/helm-chart.mdx#ai-crew-variables).

## Install the chart [#install-the-chart]

Install from the archive you pulled:

```sh
helm upgrade --install toucan-ai toucan-ai-chart-<version>.tgz -f values.yaml
```

## Custom fronts [#custom-fronts]

An agent building a custom front imports the chart libraries it needs from a CDN, which your users'
browsers cannot reach. When you [build a front with an agent](../../core/build/build-with-an-agent.mdx),
ask it to ship them as files of the front, and check the front from a browser inside your network.
