Plugins and SDK
Every source in Sard is an agent plugin that implements one interface. The SDK is a separate Go module under Apache-2.0, so plugins, proprietary ones included, can be written without AGPL obligations.
The interface
A plugin implements the Prepare, Dump and Stream steps. Restore verification is a separate optional Verifier interface: the verify action is declared only by plugins that implement it.
Two ways to hand data to restic
- Paths: Dump returns files and directories, and restic backs them up itself.
- A stream: Dump returns a file name, and Stream writes the bytes that restic saves from stdin as one file. This is how pg_dump works.
Config and secrets
A source config is described by JSON Schema 2020-12 and the agent validates it before Prepare: an error names the violations with the path to each field. A secret field is marked sard-secret in the schema. The plugin reads the value from a file on the host on every call, so a secret can change without a restart, and it never reaches errors or logs.
Licenses
The plugin SDK and the gRPC contracts are Apache-2.0 and import no AGPL code. The server, agent, CLI and console are AGPL-3.0.
What is built in today
The agent’s built-in registry has two plugins: files and PostgreSQL. A plugin enters a release only when it can both back up and restore and is described in the documentation. The planned sources (1C on PostgreSQL, MikroTik, Eltex, MySQL) will arrive with working plugins.