Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 86 additions & 14 deletions docs/dir/scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,92 @@ EOF

## Store

This example demonstrates the interaction with the local storage layer using the CLI client.
The storage layer uses an OCI-compliant registry (powered by [Zot](https://github.com/project-zot/zot)) to store records as OCI
artifacts with [content-addressable identifiers](https://github.com/multiformats/cid) (CIDs).
When a record is pushed, it is stored as an OCI blob and the CID is calculated by converting
the SHA256 OCI digest into a CIDv1 format using CID multihash encoding. Each record is then
tagged with its CID in the registry, enabling direct lookup and ensuring content
integrity through cryptographic addressing.
This example demonstrates the interaction with the storage layer using the CLI client.
The storage layer uses an OCI-compliant registry to store records as OCI artifacts with
[content-addressable identifiers](https://github.com/multiformats/cid) (CIDs). When a record
is pushed, it is stored as an OCI blob and the CID is calculated by converting the SHA256
OCI digest into a CIDv1 format using CID multihash encoding. Each record is then tagged with
its CID in the registry, enabling direct lookup and ensuring content integrity through
cryptographic addressing.

### Supported Registries

The Directory supports multiple OCI-compatible registry backends:

| Registry Type | Description |
|---------------|-------------|
| `zot` | [Zot](https://github.com/project-zot/zot) OCI registry (default) |
| `ghcr` | GitHub Container Registry |
| `dockerhub` | Docker Hub |

#### Synchronization Requirements for Non-Zot Registries

Synchronization between non-Zot registries (GHCR, DockerHub) requires the following:

- PostgreSQL as the database backend
- The reconciler component enabled
- The regsync task enabled (`RECONCILER_REGSYNC_ENABLED=true`)

The reconciler uses [regsync](https://github.com/regclient/regclient) to handle cross-registry synchronization when either the local or remote registry is not Zot.

### Registry Configuration

The registry backend is configured via environment variables on the Directory server:

| Environment Variable | Description | Default |
|---------------------|-------------|---------|
| `DIRECTORY_SERVER_STORE_OCI_TYPE` | Registry type (`zot`, `ghcr`, `dockerhub`) | `zot` |
| `DIRECTORY_SERVER_STORE_OCI_REGISTRY_ADDRESS` | Registry address | `127.0.0.1:5000` |
| `DIRECTORY_SERVER_STORE_OCI_REPOSITORY_NAME` | Repository name | `dir` |

### Authentication Configuration

Credentials for the registry are configured via environment variables:

| Environment Variable | Description |
|---------------------|-------------|
| `DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_USERNAME` | Username for basic authentication |
| `DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_PASSWORD` | Password for basic authentication |
| `DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_ACCESS_TOKEN` | Access token for token-based authentication |
| `DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_INSECURE` | Skip TLS verification (default: `true`) |

### Configuration Examples

**Zot (Local Development)**

```bash
export DIRECTORY_SERVER_STORE_OCI_TYPE=zot
export DIRECTORY_SERVER_STORE_OCI_REGISTRY_ADDRESS=localhost:5000
export DIRECTORY_SERVER_STORE_OCI_REPOSITORY_NAME=dir
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_INSECURE=true
```

**GitHub Container Registry (GHCR)**

```bash
export DIRECTORY_SERVER_STORE_OCI_TYPE=ghcr
export DIRECTORY_SERVER_STORE_OCI_REGISTRY_ADDRESS=ghcr.io
export DIRECTORY_SERVER_STORE_OCI_REPOSITORY_NAME=your-org/dir
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_USERNAME=your-github-username
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_PASSWORD=your-github-token
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_INSECURE=false
```

**Docker Hub**

```bash
export DIRECTORY_SERVER_STORE_OCI_TYPE=dockerhub
export DIRECTORY_SERVER_STORE_OCI_REGISTRY_ADDRESS=docker.io
export DIRECTORY_SERVER_STORE_OCI_REPOSITORY_NAME=your-username/dir
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_USERNAME=your-dockerhub-username
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_PASSWORD=your-dockerhub-token
export DIRECTORY_SERVER_STORE_OCI_AUTH_CONFIG_INSECURE=false
```

### Basic Operations

Once the server is configured, the CLI operations work the same regardless of the underlying
registry backend:

```bash
# Push the record and store its CID to a file
Expand Down Expand Up @@ -312,16 +391,9 @@ dirctl search --version "v1.0.?" # Find version v1.0.x (single dig
dirctl search --name "???api" # Find 3-character names ending in "api"
dirctl search --skill "Pytho?" # Find skills with single character variations

# List wildcards ([]) - matches any character within brackets
dirctl search --name "agent-[0-9]" # Find agents with numeric suffixes
dirctl search --version "v[0-9].*" # Find versions starting with v + digit
dirctl search --skill "[a-m]*" # Find skills starting with a-m
dirctl search --locator "[hf]tt[ps]*" # Find HTTP/HTTPS/FTP locators

# Complex wildcard combinations
dirctl search --name "api-*-service" --version "v2.*"
dirctl search --skill "*machine*learning*"
dirctl search --name "web-[0-9]?" --version "v?.*.?"
```

**Available Search Flags:**
Expand Down
Loading