-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add script to create s3 snapshots #659
Conversation
WalkthroughThe changes introduce a new script, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SnapshotScript
participant Docker
participant S3
User->>SnapshotScript: Run snapshot.sh
SnapshotScript->>Docker: Check container status
Docker-->>SnapshotScript: Container running
SnapshotScript->>SnapshotScript: Verify synchronization
SnapshotScript->>SnapshotScript: Check disk space
SnapshotScript->>Docker: Prune blockchain data
SnapshotScript->>SnapshotScript: Create compressed snapshot
SnapshotScript->>S3: Upload snapshot
SnapshotScript->>S3: Upload MD5 checksum
SnapshotScript->>S3: Manage old snapshots
SnapshotScript->>Docker: Reset data directory
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- contrib/scripts/snapshot.sh (1 hunks)
Additional comments not posted (22)
contrib/scripts/snapshot.sh (22)
1-4
: LGTM!The shebang and initial comments are appropriate and provide useful information.
6-6
: LGTM!Using
set -euo pipefail
is a best practice for bash scripts to ensure robustness.
8-14
: LGTM!The environment variable exports and debug setting are appropriate and provide flexibility.
16-22
: LGTM!The S3 bucket ACL retrieval and variable initializations are appropriate and necessary for the script's functionality.
23-24
: LGTM!The OS check for Linux is necessary to ensure compatibility with the script's requirements.
26-31
: LGTM!The installation of required tools (jq, curl, unzip) ensures that the necessary tools are available for the script to function correctly.
33-39
: LGTM!The installation of AWS CLI ensures that the AWS CLI is available for interacting with S3.
41-43
: LGTM!The disk space check ensures that there is enough disk space for the snapshot process.
45-46
: LGTM!The Docker container existence check ensures that the Docker container is available for the snapshot process.
48-49
: LGTM!The node catching up check ensures that the node is fully synchronized before creating a snapshot.
51-52
: LGTM!The upgrade-info.json existence check ensures that the upgrade information is available before creating a snapshot.
54-57
: LGTM!The recreation of the S3 directory ensures that it is clean and available for the snapshot process.
61-70
: LGTM!The Docker container stop and wait logic ensures that the Docker container is properly stopped before proceeding with the snapshot process.
72-86
: LGTM!The data pruning and compression logic ensures that the snapshot size is minimized and the data is in a consistent state.
88-89
: LGTM!The MD5 checksum calculation ensures that the integrity of the snapshot can be verified.
91-93
: LGTM!The S3 upload logic ensures that the snapshot is stored in S3 for later retrieval.
95-97
: LGTM!The S3 ACL setting logic ensures that the appropriate permissions are set for the uploaded files.
99-107
: LGTM!The old snapshot cleanup logic ensures that old snapshots are removed to save storage space.
109-113
: LGTM!The data reset logic ensures that the data directory is clean and ready for the next snapshot process.
115-121
: LGTM!The state sync configuration update logic ensures that the state sync configuration is up-to-date for the next run.
123-124
: LGTM!The Docker container restart logic ensures that the Docker container is running and ready for the next run.
126-126
: LGTM!The completion message provides a clear indication that the script has completed successfully.
Summary by CodeRabbit
New Features
Improvements