Documentation
¶
Overview ¶
Package backup makes encrypted backups of the controller (§13) and ships them to S3. A bundle holds a consistent SQLite snapshot (VACUUM INTO) and the key material in the data directory (CA, registry token key, …), sealed with the master key. The header carries the master key wrapped by the recovery key, so restoring needs the bundle plus the recovery key only.
Index ¶
- Constants
- Variables
- func Create(ctx context.Context, st *store.Store, box *secrets.Box, dataDir string, ...) error
- func Download(ctx context.Context, cfg Config, name string) ([]byte, string, error)
- func Restore(bundle []byte, recoveryKey, dataDir string, force bool) ([]string, error)
- type Config
- type Manager
- func (m *Manager) Config() (Config, bool)
- func (m *Manager) Disable(ctx context.Context) error
- func (m *Manager) List(ctx context.Context) ([]Object, error)
- func (m *Manager) Load(ctx context.Context) error
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) RunNow(ctx context.Context) (Object, error)
- func (m *Manager) SetConfig(ctx context.Context, c Config) error
- func (m *Manager) Status() Status
- func (m *Manager) WriteBundle(ctx context.Context, w io.Writer) error
- type Object
- type Status
Constants ¶
const (
// Ext is the bundle file extension.
Ext = ".synbak"
)
const (
// TopicUpdated carries Status after every backup run.
TopicUpdated = "backup.updated"
)
Variables ¶
var ErrNotConfigured = errors.New("backups are not configured")
ErrNotConfigured is returned when no S3 destination is set.
Functions ¶
func Create ¶
func Create(ctx context.Context, st *store.Store, box *secrets.Box, dataDir string, w io.Writer) error
Create writes an encrypted bundle of dataDir to w.
Types ¶
type Config ¶
type Config struct {
Endpoint string `json:"endpoint"` // e.g. https://s3.eu-central-1.amazonaws.com, http://10.0.0.5:9000
Region string `json:"region"`
Bucket string `json:"bucket"`
Prefix string `json:"prefix"`
AccessKeyID string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey,omitempty"`
IntervalMinutes int `json:"intervalMinutes"`
Retain int `json:"retain"`
}
Config is where and how often backups go. The secret is stored sealed.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}