Skip to content

Storage configuration

Media bytes never go into Git. freeze stores each new file through a storage provider and records the returned URI in rereel.lock.json. hydrate and build resolve those URIs back to files. Providers are configured in rereel.storage.json. For walkthroughs, see the Storage providers guide.

The configuration is loaded once per CLI invocation (for every command). The first file that exists among these candidates is used:

  1. --storage-config <path>
  2. $REREEL_STORAGE_CONFIG
  3. ./rereel.storage.json (current working directory, not the bundle directory)
  4. ~/.config/rereel/storage.json

Relative paths are resolved against the current working directory. If no candidate exists, the built-in default is used.

{
"defaultProvider": "local-cache",
"providers": {
"local-cache": { "type": "local-cache", "cacheDir": "~/.cache/rereel/cas" },
"http": { "type": "http" }
}
}

The loaded file is shallow-merged over the default:

  • defaultProvider from the file, else local-cache.
  • providers = default providers plus your providers. A provider with the same name (local-cache, http) replaces the default entry entirely.

So local-cache and http are always available unless you redefine them.

{
"defaultProvider": "r2",
"providers": {
"<name>": { "type": "local-cache" | "s3" | "http" | "command", "...": "type-specific fields" }
}
}
Field Type Description
defaultProvider string Provider used by freeze when --provider is omitted, by hydrate for lock items without provider, and for templates without template.provider.
providers Record<string, StorageProviderConfig> Named providers.
  • Storing (freeze): --provider <name>, else defaultProvider. The provider name is written into each new lock item’s provider.
  • Resolving (hydrate/build): each lock item’s provider, else defaultProvider. Every machine that hydrates must therefore define a provider with that name. An unknown name fails with exit 2 and an available list in the error JSON.

A content-addressed store on the local filesystem.

Field Type Default Description
type "local-cache" —
cacheDir string ~/.cache/rereel/cas Cache root.
  • Store: copies (copy-on-write clone where supported) the file to <cacheDir>/<sha256[0:2]>/<sha256><ext> if it is not there yet. Returns cas://<sha256><ext> (extension lower-cased).
  • Resolve: strips cas://, copies <cacheDir>/<first 2 chars>/<key> to the destination. Missing object → exit 1.
{
"defaultProvider": "team-nas",
"providers": {
"team-nas": { "type": "local-cache", "cacheDir": "/Volumes/video/rereel-cas" }
}
}

S3-compatible object storage (AWS S3, Cloudflare R2, Google Cloud Storage XML API, MinIO, …) using built-in SigV4 signing and fetch, with no SDK dependency.

Field Type Default Description
type "s3" —
bucket string — (required) Bucket for uploads. Missing → exit 2 when the provider is first used.
endpoint string https://s3.<region>.amazonaws.com Service endpoint. Trailing slashes are removed.
region string us-east-1 for AWS, auto for a custom endpoint SigV4 signing region. A regional AWS endpoint supplies its region if omitted.
prefix string rereel Key prefix (leading/trailing slashes trimmed).
accessKeyEnv string AWS_ACCESS_KEY_ID Name of the env var holding the access key.
secretKeyEnv string AWS_SECRET_ACCESS_KEY Name of the env var holding the secret key.
  • Requests use path-style URLs: <endpoint>/<bucket>/<key>.
  • Store: PUT to key <prefix>/<sha256[0:2]>/<sha256><ext>. Returns s3://<bucket>/<key>.
  • Resolve: parses s3://<bucket>/<key> (anything else → exit 2) and GETs <endpoint>/<bucket>/<key>. The bucket comes from the URI, the endpoint and credentials from the provider config.
  • Credentials are read at request time. Missing env vars → exit 2. Non-2xx responses → exit 4.

Set the bucket’s region explicitly when using AWS S3 outside us-east-1. For R2 and other compatible endpoints that expect it, use auto.

Cloudflare R2

{
"defaultProvider": "r2",
"providers": {
"r2": {
"type": "s3",
"bucket": "my-video-assets",
"endpoint": "https://<account-id>.r2.cloudflarestorage.com",
"region": "auto",
"prefix": "rereel",
"accessKeyEnv": "R2_ACCESS_KEY_ID",
"secretKeyEnv": "R2_SECRET_ACCESS_KEY"
}
}
}

AWS S3

{
"providers": {
"s3": {
"type": "s3",
"bucket": "my-video-assets",
"region": "ap-northeast-1"
}
}
}

Google Cloud Storage (XML API with HMAC keys)

{
"providers": {
"gcs": {
"type": "s3",
"bucket": "my-video-assets",
"endpoint": "https://storage.googleapis.com",
"region": "auto",
"accessKeyEnv": "GCS_HMAC_ACCESS_ID",
"secretKeyEnv": "GCS_HMAC_SECRET"
}
}
}

Read-only HTTP(S) download.

Field Type Default Description
type "http" —
baseUrl string — Prefix for non-URL URIs (trailing slashes removed).
  • Store: always fails with exit 2 (read-only). Do not use it as the freeze provider.
  • Resolve: if the URI starts with http:// or https:// it is fetched as-is. Otherwise <baseUrl>/<uri without leading slashes> is fetched (or the URI as-is if there is no baseUrl). Non-2xx → exit 4. No authentication headers are sent.

Use it for public CDNs or lock entries that you write by hand:

{
"providers": {
"cdn": { "type": "http", "baseUrl": "https://cdn.example.com/rereel" }
}
}
"media/intro_1a2b3c4d.mp4": {
"source": "storage",
"provider": "cdn",
"uri": "intro/1a2b3c4d.mp4",
"sha256": "1a2b3c4d…",
"bytes": 1048576,
"kind": "video"
}

Delegates storing and resolving to any shell command, so rereel can integrate with an existing asset database, DVC, rclone, gsutil, or similar tools.

Field Type Default Description
type "command" —
storeCommand string — Template run by freeze. Missing → exit 2 on store.
resolveCommand string — Template run by hydrate/build. Missing → exit 2 on resolve.
defaultTags string rereel Value of {tags} when freeze --tags is not given.

Commands run with /bin/sh -c with a 300-second timeout. The working directory and environment are inherited.

Every {name} placeholder is replaced with a single-quoted, shell-escaped value, so do not add quotes around placeholders. Unknown placeholders become an empty string.

Placeholder storeCommand resolveCommand
{path} Absolute local file path —
{kind} Media kind (image, video, audio, font, svg, archive, other) —
{sha256} File SHA-256 Expected SHA-256 from the lockfile (empty for template archives)
{tags} --tags or defaultTags —
{uri} — URI from the lockfile
{dest} — Absolute destination path to write

stdout is examined in this order:

  1. The last line of stdout that parses as a JSON object (falling back to parsing the whole stdout):
    • uri or asset_uri → used as the URI.
    • else id or asset_id → used as-is if it contains ://, otherwise becomes asset://<id>.
  2. Otherwise, the last non-empty stdout line, as plain text.
  3. Empty output → exit 4.

A non-zero exit status → exit 4 (exit 3 if /bin/sh cannot be spawned).

After the command exits with status 0:

  1. If {dest} now exists, it is used.
  2. Else if the last JSON-object line has localPath, local_path, or path pointing to an existing file, that file is copied to {dest}.
  3. Else if the last stdout line is an existing file path, that file is copied.
  4. Otherwise, exit 4 (resolveCommand did not produce a valid file for <uri>).

The file is then SHA-256-verified by hydrate.

{
"defaultProvider": "assetdb",
"providers": {
"assetdb": {
"type": "command",
"storeCommand": "my-asset-cli add {path} --kind {kind} --tags {tags} --json",
"resolveCommand": "my-asset-cli get {uri} --out {dest}",
"defaultTags": "rereel,video"
},
"rclone": {
"type": "command",
"storeCommand": "rclone copyto {path} remote:videos/$(basename {path}) && echo rclone://videos/$(basename {path})",
"resolveCommand": "rclone copyto \"remote:$(echo {uri} | sed 's#^rclone://##')\" {dest}"
}
}
}

The URI in a lock item is opaque to rereel. Only the provider named in provider interprets it.

Scheme Produced by Resolved by
cas://<sha256><ext> local-cache store local-cache
s3://<bucket>/<prefix>/<xx>/<sha256><ext> s3 store s3 (any S3-compatible endpoint configured on the resolving machine)
https://…, http://…, or a relative path hand-written http
asset://<id> command store returning id / asset_id command
anything else command store command

Template archives (template.source: "storage") use the same providers via template.uri / template.provider.

  • freeze hashes every media file and stores sha256 and bytes in the lockfile.
  • hydrate (and therefore build) skips files whose on-disk SHA-256 already matches. Otherwise it resolves the file and re-hashes it after download. A mismatch fails with exit 1 and error details {relPath, uri, expected, actual}. The mismatched file stays on disk and will be re-fetched on the next run.
  • Providers themselves do not verify. Verification is centralized in hydrate, so custom command providers get it for free.
  • validate --check-media re-hashes all hydrated storage items without fetching.
  • Not verified: source: "template" items (copied from the template directory) and template archives downloaded for template.source: "storage".