Skip to content

[NO-ISSUE] DB 백업을 최근 7개만 보관(개수 기준)하도록 변경#269

Merged
Develop-KIM merged 2 commits into
developfrom
chore/NO-ISSUE-backup-retention
Jun 14, 2026
Merged

[NO-ISSUE] DB 백업을 최근 7개만 보관(개수 기준)하도록 변경#269
Develop-KIM merged 2 commits into
developfrom
chore/NO-ISSUE-backup-retention

Conversation

@Develop-KIM

@Develop-KIM Develop-KIM commented Jun 14, 2026

Copy link
Copy Markdown
Member

변경

DB 백업 보관 정책을 **최근 7개만 보관(개수 기준)**으로 변경합니다.

기존 날짜 기준(30일)에서, 백업 주기와 무관하게 항상 최신 7개만 유지하도록 바꿉니다.

deploy/shared/db-backup.sh:

  • RETENTION_DAYSRETENTION_COUNT (=7)
  • 로컬: ls -1t로 최신순 정렬 후 7개 초과분 삭제
  • Object Storage: 파일명(날짜순) 정렬 후 (전체-7)개의 오래된 파일 삭제
    • GNU 전용 head -n -N 대신 양수 head로 처리해 견고함

검증

  • bash -n 문법 검사 통과
  • 로컬/오브젝트 스토리지 로직 각각 시뮬레이션으로 동작 확인
    (10개 → 오래된 3개 삭제·최신 7개 보관 / 7개 이하 → 삭제 스킵)

참고

  • 백업이 하루 1번이면 "최근 7일"과 사실상 동일하지만, 더 자주 돌아도 항상 7개만 유지됩니다.
  • 서버에 스크립트 배포 후 다음 백업 실행부터 적용됩니다.

🤖 Generated with Claude Code

RETENTION_DAYS 값만 조정하면 로컬 백업 삭제(find -mtime)와
Object Storage 백업 삭제(s3cmd) 양쪽에 동일하게 적용됩니다.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

deploy/shared/db-backup.shRETENTION_DAYS 상수가 30에서 7로 변경되었습니다. 이로 인해 로컬 덤프 파일 삭제(find) 및 Object Storage 내 오래된 백업 삭제의 만료 기준이 7일로 단축됩니다.

Changes

DB 백업 보관 기간 단축

Layer / File(s) Summary
RETENTION_DAYS 상수 변경
deploy/shared/db-backup.sh
RETENTION_DAYS30에서 7로 변경하여 로컬 및 Object Storage 백업의 보관 기간 기준을 단축.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • souzip/souzip-api#259: 동일한 deploy/shared/db-backup.sh 파일의 RETENTION_DAYS 보관 기간 로직을 수정한 PR으로, 이번 변경과 직접적으로 연관됩니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning PR 제목은 데이터베이스 백업 보관 개수를 7개로 변경하는 내용을 명시하고 있으나, 실제 변경사항은 보관 기간을 30일에서 7일로 단축한 것입니다. 제목을 실제 변경사항을 정확히 반영하도록 수정하세요. 예: '[NO-ISSUE] DB 백업 보관 기간을 30일에서 7일로 단축' 또는 유사한 표현으로 변경 권장.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/NO-ISSUE-backup-retention

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

백업 주기와 무관하게 항상 최신 7개만 유지하도록 변경합니다.

- RETENTION_DAYS → RETENTION_COUNT (=7)
- 로컬: ls -1t 로 최신순 정렬 후 7개 초과분 삭제
- Object Storage: 파일명(날짜순) 정렬 후 (전체-7)개의 오래된 파일 삭제
  (GNU 전용 head -n -N 대신 양수 head 로 견고하게 처리)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Develop-KIM Develop-KIM changed the title chore: DB 백업 보관 기간 30일 → 7일로 단축 chore: DB 백업을 최근 7개만 보관(개수 기준)하도록 변경 Jun 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56babc6c44

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

fi
fi
# 로컬 백업은 최신순으로 RETENTION_COUNT 개만 보관하고 나머지 삭제
ls -1t $BACKUP_DIR/souzip-*.dump 2>/dev/null | tail -n +$((RETENTION_COUNT + 1)) | while read -r file; do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 7일 보관 정책을 개수 기준으로 바꾸지 마세요

medium: 커밋 설명은 백업을 7일 보관하는 변경인데, 여기서는 실행 주기와 무관하게 최신 7개만 남깁니다. 서버 crontab이 하루 1회보다 자주 돌거나 운영자가 같은 날 수동 재실행하면 7일이 지나지 않은 백업까지 삭제되어 복구 지점이 의도보다 빠르게 사라질 수 있으니, 기존처럼 날짜/mtime 기준으로 RETENTION_DAYS=7을 적용하는 방식으로 유지하는 것을 권장합니다.

Useful? React with 👍 / 👎.

@Develop-KIM Develop-KIM changed the title chore: DB 백업을 최근 7개만 보관(개수 기준)하도록 변경 [NO-ISSUE] DB 백업을 최근 7개만 보관(개수 기준)하도록 변경 Jun 14, 2026
@Develop-KIM Develop-KIM merged commit bea0ee8 into develop Jun 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant