feat(backup): add MinIO snapshot backups via CLI and scheduler

This commit is contained in:
William Valentin
2026-02-16 13:16:29 -08:00
parent 8bed99c770
commit 01ee6ba53f
13 changed files with 416 additions and 1 deletions
+48
View File
@@ -196,6 +196,54 @@ describe('configSchema — server', () => {
});
});
describe('configSchema — backup', () => {
const minimalConfig = {
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
models: { default: { provider: 'anthropic', model: 'claude-3' } },
};
it('defaults backup settings', () => {
const result = configSchema.parse(minimalConfig);
expect(result.backup.enabled).toBe(false);
expect(result.backup.interval).toBe('24h');
expect(result.backup.include_vectors).toBe(true);
expect(result.backup.minio.enabled).toBe(false);
expect(result.backup.minio.prefix).toBe('flynn');
expect(result.backup.minio.secure).toBe(true);
});
it('accepts custom backup settings', () => {
const result = configSchema.parse({
...minimalConfig,
backup: {
enabled: true,
interval: '12h',
local_dir: '/tmp/flynn-backups',
include_vectors: false,
minio: {
enabled: true,
endpoint: 'localhost:9000',
access_key: 'key',
secret_key: 'secret',
bucket: 'flynn-backups',
prefix: 'daily',
secure: false,
},
},
});
expect(result.backup.enabled).toBe(true);
expect(result.backup.interval).toBe('12h');
expect(result.backup.local_dir).toBe('/tmp/flynn-backups');
expect(result.backup.include_vectors).toBe(false);
expect(result.backup.minio.enabled).toBe(true);
expect(result.backup.minio.endpoint).toBe('localhost:9000');
expect(result.backup.minio.bucket).toBe('flynn-backups');
expect(result.backup.minio.prefix).toBe('daily');
expect(result.backup.minio.secure).toBe(false);
});
});
describe('configSchema — agent_configs', () => {
const minimalConfig = {
telegram: { bot_token: 'test', allowed_chat_ids: [1] },