Documentation
¶
Overview ¶
Package scheduledbackup provides scheduled PostgreSQL backups with pg_dump. It supports cron-based scheduling and manual backup via HTTP API and CLI commands, and records backup history in PostgreSQL. Dumps are written to local disk only -- there is no restore path and no off-host upload.
Package scheduledbackup provides scheduled PostgreSQL backups with pg_dump. It supports cron-based scheduling and manual backup via HTTP API and CLI commands, and records backup history in PostgreSQL. Dumps are written to local disk (Config.DumpDir) only -- there is no restore path and no off-host upload; see the s3_bucket/s3_prefix doc comments on backupConfig in routes.go before relying on either.
Index ¶
- func New() plugin.Plugin
- type Config
- type Plugin
- func (p *Plugin) Info() plugin.PluginInfo
- func (p *Plugin) Init(ctx context.Context, env *plugin.Environment) error
- func (p *Plugin) Migrations() []plugin.Migration
- func (p *Plugin) RegisterCommands() []plugin.Command
- func (p *Plugin) RegisterRoutes(mux *http.ServeMux) error
- func (p *Plugin) Run(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// DSN is the PostgreSQL connection string pg_dump backs up. It commonly
// embeds a password, so it is a plugin.Secret: never marshaled in the
// clear, and passed to pg_dump via runPgDump (background.go), which
// puts any password in the child process's PGPASSWORD environment
// variable rather than its argv -- argv is visible to any co-resident
// user via ps and /proc/*/cmdline, unlike the environment of a process
// you do not own.
DSN plugin.Secret `json:"dsn"`
DumpDir string `json:"dump_dir"` // Directory for dump output files
}
Config controls backup storage and pg_dump output location.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements scheduled PostgreSQL backups with tenant isolation.
func (*Plugin) Info ¶
func (p *Plugin) Info() plugin.PluginInfo
Info returns plugin metadata for discovery and documentation.
func (*Plugin) Migrations ¶
Migrations returns the database schema for backup configuration and history. Tables are idempotent (IF NOT EXISTS) and safe to run multiple times.
func (*Plugin) RegisterCommands ¶
RegisterCommands returns CLI subcommands for the scheduled-backup plugin.