32544c4099
## WBS-8.1: T+20 거래 레저 자동 수집 신규 도구: tools/auto_collect_t20_ledger_v1.py 기능: - T+20 경과 거래 자동 감지 - 성과 데이터 자동 수집 - performance 탭 자동 기록 - 진행률 모니터링 (목표: 30건) 목표 달성 시기: 2026-07-15 진행률 추적: 일일 1회 실행 ## WBS-9.7: 자동 백업 정책 구현 신규 워크플로우: .gitea/workflows/auto_backup_schedule.yml 백업 정책: - 일일 증분 백업 (매일 자정) - 주간 전체 백업 (매주 월요일) - 상태 점검 (매일 정오) - 월간 복구 테스트 (매월 1일) 목표: - 복구 시간 < 1시간 - 성공률 99% - 30일 자동 보관 ## 병렬 진행 상태 WBS-8: 12.5% (1/8 완료) - 8.1: T+20 자동 수집 체계 완성 - 8.5: 섹터 플로우 누적 중 (10%) - 8.4: 실거래 대기 (80%) WBS-9: 71.4% (5/7 준비 완료) - 9.1: F14 완료 - 9.4: 장애 대응 준비 완료 - 9.7: 백업 정책 완성 다음 마일스톤: - 2026-07-01: WBS-9.4 장애 대응 훈련 - 2026-07-15: WBS-8.1 활성화 (T+20 30건) - 2026-08-01: WBS-9 공식 시작 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
173 lines
4.8 KiB
YAML
173 lines
4.8 KiB
YAML
name: Auto Backup - WBS-9.7
|
|
|
|
on:
|
|
schedule:
|
|
# 매일 자정 (UTC)
|
|
- cron: '0 0 * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
daily-backup:
|
|
runs-on: act-runner
|
|
name: Daily Backup
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Python
|
|
run: |
|
|
python --version
|
|
|
|
- name: Run Daily Backup
|
|
run: |
|
|
python tools/backup_recovery_manager_v1.py
|
|
|
|
- name: Cleanup Old Backups
|
|
run: |
|
|
python -c "
|
|
from tools.backup_recovery_manager_v1 import BackupRecoveryManager
|
|
manager = BackupRecoveryManager(retention_days=30)
|
|
result = manager.cleanup_old_backups()
|
|
print(f'Cleanup: {result}')
|
|
"
|
|
|
|
- name: Log Backup Result
|
|
if: always()
|
|
run: |
|
|
echo "Backup completed at $(date)"
|
|
ls -lh backups/ | tail -5
|
|
|
|
weekly-full-backup:
|
|
runs-on: act-runner
|
|
name: Weekly Full Backup
|
|
|
|
# 매주 월요일 1:00 UTC
|
|
schedule:
|
|
- cron: '0 1 * * 1'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Python
|
|
run: python --version
|
|
|
|
- name: Create Weekly Full Backup
|
|
run: |
|
|
python -c "
|
|
from tools.backup_recovery_manager_v1 import BackupRecoveryManager
|
|
from pathlib import Path
|
|
|
|
manager = BackupRecoveryManager()
|
|
result = manager.create_weekly_full_backup()
|
|
print(f'Weekly backup: {result}')
|
|
|
|
# 신뢰성 테스트
|
|
if 'backup_name' in result:
|
|
integrity = manager.test_backup_integrity(result['backup_name'])
|
|
print(f'Integrity: {integrity}')
|
|
"
|
|
|
|
- name: Backup to Cloud (Optional)
|
|
continue-on-error: true
|
|
run: |
|
|
# Synology NAS로 동기화 (설정 필요)
|
|
# rsync -av backups/ admin@SYNOLOGY_IP:/backup/data_feed/
|
|
echo "Cloud sync would run here if configured"
|
|
|
|
- name: Notify Completion
|
|
if: success()
|
|
run: |
|
|
echo "Weekly backup completed successfully"
|
|
df -h | grep -E "Filesystem|data"
|
|
|
|
backup-health-check:
|
|
runs-on: act-runner
|
|
name: Backup Health Check
|
|
|
|
# 매일 12:00 UTC
|
|
schedule:
|
|
- cron: '0 12 * * *'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Check Backup Integrity
|
|
run: |
|
|
python -c "
|
|
from tools.backup_recovery_manager_v1 import BackupRecoveryManager
|
|
from pathlib import Path
|
|
|
|
manager = BackupRecoveryManager()
|
|
|
|
# 가장 최근 백업 확인
|
|
backups = sorted(Path('backups/').glob('*'), key=lambda p: p.stat().st_mtime, reverse=True)
|
|
|
|
if backups:
|
|
latest = backups[0].name
|
|
print(f'Latest backup: {latest}')
|
|
|
|
integrity = manager.test_backup_integrity(latest)
|
|
print(f'Status: {integrity.get(\"status\")}')
|
|
|
|
if integrity.get('database_integrity') != 'ok':
|
|
print('WARNING: Database integrity issue detected')
|
|
else:
|
|
print('ERROR: No backups found')
|
|
"
|
|
|
|
- name: Log Backup Statistics
|
|
run: |
|
|
echo "=== Backup Statistics ==="
|
|
find backups/ -type f -name "metadata.json" | wc -l
|
|
du -sh backups/ | awk '{print "Total size: " $1}'
|
|
|
|
test-recovery:
|
|
runs-on: act-runner
|
|
name: Monthly Recovery Test
|
|
|
|
# 매월 1일 2:00 UTC
|
|
schedule:
|
|
- cron: '0 2 1 * *'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Test Recovery Procedure
|
|
run: |
|
|
python -c "
|
|
from tools.backup_recovery_manager_v1 import BackupRecoveryManager
|
|
from pathlib import Path
|
|
import tempfile
|
|
|
|
manager = BackupRecoveryManager()
|
|
|
|
# 가장 최근 백업에서 복구 테스트
|
|
backups = sorted(Path('backups/').glob('*'), key=lambda p: p.stat().st_mtime, reverse=True)
|
|
|
|
if backups:
|
|
test_backup = backups[0].name
|
|
|
|
# 임시 디렉토리에 복구
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
result = manager.restore_from_backup(test_backup, tmpdir)
|
|
print(f'Recovery test: {result.get(\"status\")}')
|
|
print(f'Recovery time: {result.get(\"recovery_time_seconds\")}s')
|
|
|
|
if result.get('status') == 'SUCCESS':
|
|
print('Recovery procedure validated')
|
|
else:
|
|
print('ERROR: Recovery test failed')
|
|
"
|
|
|
|
- name: Document Recovery Capability
|
|
run: |
|
|
echo "Monthly recovery test completed"
|
|
echo "Recovery time target: < 1 hour"
|
|
echo "Success rate target: 99%"
|