Rclone Repository Backend#
The rclone backend lets zerobyte use restic to back up to any of the 40+ cloud storage providers that rclone supports (Google Drive, Dropbox, OneDrive, Box, pCloud, Mega, etc.). Rather than handling cloud-specific auth itself, restic delegates to a locally configured rclone remote for transport.
Configuration Schema#
The schema is defined in packages/core/src/restic/schemas.ts and requires three fields:
| Field | Type | Description |
|---|---|---|
backend | "rclone" (literal) | Discriminates this config from other backends |
remote | string (min 1) | Name of the rclone remote as configured in rclone.conf |
path | string (min 1) | Path within the remote |
It also inherits the shared baseRepositoryConfigSchema fields, including the optional insecureTls flag, custom password, CA cert, and bandwidth limits.
Repository URL#
buildRepoUrl() produces the restic repository URL in the form:
rclone:<remote>:<path>
This matches the native restic rclone URL format. No normalization (trimming, protocol stripping) is applied β unlike S3 or R2 β because the remote and path values come directly from the rclone config name and are not user-typed endpoint URLs.
Environment Variables#
buildEnv() sets only two environment variables for the rclone backend:
| Variable | Value | Condition |
|---|---|---|
RCLONE_CONFIG | Path to rclone.conf | Always set |
RCLONE_NO_CHECK_CERTIFICATE | "true" | Only when insecureTls: true |
RCLONE_CONFIG is populated from deps.rcloneConfigFile , which is resolved at agent startup as:
path.join(RCLONE_CONFIG_DIR, "rclone.conf")
RCLONE_CONFIG_DIR defaults to /root/.config/rclone .
Unlike other backends (S3, GCS, Azure, SFTP), the rclone backend writes no temporary credential files β all auth is managed by rclone itself via its own config file. The common RESTIC_PASSWORD_FILE and optional RESTIC_CACERT / _INSECURE_TLS env vars are still set by the shared logic in buildEnv() .
Key Source Files#
| File | Purpose |
|---|---|
build-repo-url.ts | Constructs rclone:<remote>:<path> URL |
build-env.ts | Sets RCLONE_CONFIG and optional RCLONE_NO_CHECK_CERTIFICATE |
schemas.ts | rcloneRepositoryConfigSchema definition |
types.ts | ResticDeps.rcloneConfigFile property |
apps/agent/src/restic/deps.ts | Provides rcloneConfigFile path from env at runtime |