Skip to content
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

i think it was for backup for cockroach db #32

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions staging/backup/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Load environment variables from the .env file
export $(grep -v '^#' /path/to/.env | xargs)

# Backup filename with timestamp
TIMESTAMP=$(date +"%F")
BACKUP_FILE="$BACKUP_PATH/db_backup_$TIMESTAMP.sql"

# Dump the database
mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_FILE

# Upload the backup to Bunny Storage
curl -T $BACKUP_FILE -u $BUNNY_ACCESS_KEY: $BUNNY_STORAGE_URL$(basename $BACKUP_FILE)

# Remove local backup file after upload
rm $BACKUP_FILE