EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
Hands of Destiny Lightsail Backup - Action Plan

Current Status

  • Instance: HandsofDestiny-2GB (52.64.166.170)
  • SSH Key: ~/LightsailDefault Key-ap-southeast-2.pem
  • WordPress Version: 6.2.2-21 (Bitnami)
  • Issue: Site is very large, causing slow backup/download

Steps to Backup to GitHub

Step 1: Create Tarball on Lightsail (Run in background)

ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170
cd /opt/bitnami/wordpress
nohup tar -czf /tmp/handsofd-wordpress.tar.gz \
--exclude='wp-content/cache/*' \
--exclude='wp-content/upgrade/*' \
--exclude='wp-content/backups/*' \
--exclude='tmp/*' \
--dereference \
. > /tmp/tar.log 2>&1 &

Check progress:

ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170 "tail -f /tmp/tar.log"

Step 2: Download Tarball (When ready)

cd /tmp
scp -i ~/LightsailDefaultKey-ap-southeast-2.pem \
bitnami@52.64.166.170:/tmp/handsofd-wordpress.tar.gz \
./handsofd-wordpress.tar.gz

Step 3: Prepare GitHub Repo

cd /tmp/wordpress-repos
rm -rf wordpress-handsofd
git clone https://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@github.com/Independent-Business-Group/wordpress-handsofd.git
cd wordpress-handsofd
# Clear repo (keep .git)
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
# Extract WordPress files
tar -xzf /tmp/handsofd-wordpress.tar.gz

Step 4: Add .gitignore

cat > .gitignore << 'EOF'
# WordPress Core
wp-config.php
.htaccess
.htpasswd
# Cache and temp
wp-content/cache/
wp-content/upgrade/
wp-content/backups/
wp-content/ai-engine/
*.log
# Environment
.env
.env.local
# Bitnami specific
.buildcomplete
.spdx-wordpress.spdx
# OS files
.DS_Store
Thumbs.db
*~
EOF

Step 5: Create README

cat > README.md << 'EOF'
# Hands of Destiny WordPress
This WordPress site runs on AWS Lightsail (HandsofDestiny-2GB instance) in Sydney region.
## Instance Details
- **IP:** 52.64.166.170
- **Stack:** Bitnami WordPress 6.2.2-21
- **Platform:** Dedicated Lightsail VM (too resource-intensive for shared hosting)
## Access
- SSH: `ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170`
- WordPress Admin: https://handsofdestiny.com.au/wp-admin
- Admin User: user
- Admin Password: See LIGHTSAIL_HANDSOFD_GUIDE.md in rmm-psa-devops repo
## Backup
This repository contains a snapshot of WordPress files from the Lightsail instance.
- **Last Backup:** $(date -u +"%Y-%m-%d %H:%M UTC")
- **Database:** Not included (stored on Lightsail MySQL instance)
## Notes
- wp-config.php is excluded (site-specific configuration)
- Cache directories excluded
- Database backups stored separately in rmm-psa-devops/backups/
## Deployment
This site is NOT deployed to DigitalOcean App Platform. It runs on its own Lightsail instance.
See [rmm-psa-devops/LIGHTSAIL_HANDSOFD_GUIDE.md](https://github.com/Independent-Business-Group/rmm-psa-devops/blob/main/LIGHTSAIL_HANDSOFD_GUIDE.md) for full documentation.
EOF

Step 6: Commit and Push

git add .
git commit -m "Backup WordPress files from Lightsail instance
- Backed up from HandsofDestiny-2GB (52.64.166.170)
- Date: $(date -u +%Y-%m-%d)
- WordPress 6.2.2-21 (Bitnami)
- Excludes: cache, upgrades, wp-config.php, logs
- Database excluded (separate backup)"
git push origin main

Step 7: Backup Database (Separate)

# On Lightsail instance
ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170 << 'EOF'
# Get DB credentials from wp-config.php
DB_NAME=$(grep "DB_NAME" /bitnami/wordpress/wp-config.php | cut -d "'" -f 4)
DB_USER=$(grep "DB_USER" /bitnami/wordpress/wp-config.php | cut -d "'" -f 4)
DB_PASSWORD=$(grep "DB_PASSWORD" /bitnami/wordpress/wp-config.php | cut -d "'" -f 4)
# Export database
mysqldump -u $DB_USER -p$DB_PASSWORD $DB_NAME > /tmp/handsofd-database.sql
gzip /tmp/handsofd-database.sql
ls -lh /tmp/handsofd-database.sql.gz
EOF
# Download database backup
scp -i ~/LightsailDefaultKey-ap-southeast-2.pem \
bitnami@52.64.166.170:/tmp/handsofd-database.sql.gz \
~/Documents/IBG_HUB/rmm-psa-devops/backups/handsofd-database-$(date +%Y%m%d).sql.gz

Alternative: Rsync Method (Faster for large sites)

# Direct rsync to local directory
mkdir -p /tmp/handsofd-wordpress
rsync -avz --progress \
-e "ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem" \
--exclude='wp-content/cache' \
--exclude='wp-content/upgrade' \
--exclude='tmp' \
bitnami@52.64.166.170:/opt/bitnami/wordpress/ \
/tmp/handsofd-wordpress/
# Then copy to GitHub repo
cd /tmp/wordpress-repos/wordpress-handsofd
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} +
cp -r /tmp/handsofd-wordpress/* .
# Follow steps 4-6 above

Cleanup

# On Lightsail
ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170 \
"rm -f /tmp/handsofd-wordpress.tar.gz /tmp/handsofd-database.sql.gz"
# Locally
rm -rf /tmp/handsofd-backup /tmp/handsofd-wordpress

Monitoring Backup Progress

If tar/download is running in background:

# Check tar progress
ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170 \
"ps aux | grep tar"
# Check file size growing
watch -n 5 ssh -i ~/LightsailDefaultKey-ap-southeast-2.pem bitnami@52.64.166.170 \
"ls -lh /tmp/handsofd-wordpress.tar.gz"

Estimated Times

Based on site being "too heavy for WHM":

  • Tar creation: 5-15 minutes
  • Download (tarball): 10-30 minutes depending on size
  • Database export: 2-5 minutes
  • Total: ~20-50 minutes

Rsync method may be faster for subsequent updates (only copies changed files).