be07438915
Mirror to GitHub (Archive Method) / mirror (push) Failing after 16s
Mirror to GitHub (Rsync Method) / mirror (push) Failing after 16s
Mirror to GitHub / mirror (push) Failing after 16s
Test and Lint / backend-test (push) Successful in 1m10s
Test and Lint / frontend-test (push) Has started running
Version and Release / version-bump (push) Has been cancelled
Version and Release / trigger-drone (push) Has been cancelled
continuous-integration/drone/push Build is passing
- Create comprehensive README.md optimized for GitHub/SEO - Consolidate deployment instructions into single DEPLOYMENT.md - Add all standard GitHub documentation files: - CONTRIBUTING.md with development guidelines - CODE_OF_CONDUCT.md for community standards - SECURITY.md with vulnerability reporting - CHANGELOG.md following Keep a Changelog format - Simplify deployment with single docker-compose.yml - Remove complex deployment configurations (Swarm, Traefik) - Add backup script for easy maintenance - Update .github-mirror-exclude to hide complex configs - Remove redundant documentation files This prepares PicPeak as a professional open-source alternative to PicDrop and Scrapbook.de with clear, simple deployment.
69 lines
2.0 KiB
Bash
Executable File
69 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# PicPeak Backup Script
|
|
# Creates backups of database and storage
|
|
|
|
set -e
|
|
|
|
# Configuration
|
|
BACKUP_DIR="./backups"
|
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
BACKUP_NAME="picpeak_backup_${TIMESTAMP}"
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m'
|
|
|
|
echo "🔄 Starting PicPeak backup..."
|
|
|
|
# Create backup directory
|
|
mkdir -p "${BACKUP_DIR}/${BACKUP_NAME}"
|
|
|
|
# Backup database
|
|
echo "📊 Backing up database..."
|
|
if [ -f "./data/photo_sharing.db" ]; then
|
|
cp ./data/photo_sharing.db "${BACKUP_DIR}/${BACKUP_NAME}/"
|
|
echo -e "${GREEN}✓ SQLite database backed up${NC}"
|
|
else
|
|
# PostgreSQL backup
|
|
docker exec picpeak-postgres pg_dump -U picpeak picpeak > "${BACKUP_DIR}/${BACKUP_NAME}/database.sql" 2>/dev/null || {
|
|
echo -e "${RED}⚠ Database backup failed - is PostgreSQL running?${NC}"
|
|
}
|
|
fi
|
|
|
|
# Backup storage
|
|
echo "📸 Backing up photos..."
|
|
if [ -d "./storage" ]; then
|
|
tar -czf "${BACKUP_DIR}/${BACKUP_NAME}/storage.tar.gz" ./storage 2>/dev/null || {
|
|
echo -e "${RED}⚠ Storage backup failed${NC}"
|
|
exit 1
|
|
}
|
|
echo -e "${GREEN}✓ Storage backed up${NC}"
|
|
fi
|
|
|
|
# Backup environment files
|
|
echo "⚙️ Backing up configuration..."
|
|
cp .env "${BACKUP_DIR}/${BACKUP_NAME}/.env.backup" 2>/dev/null || true
|
|
|
|
# Create backup info
|
|
echo "📝 Creating backup info..."
|
|
cat > "${BACKUP_DIR}/${BACKUP_NAME}/backup_info.txt" << EOF
|
|
PicPeak Backup
|
|
Created: $(date)
|
|
Version: $(grep version backend/package.json | head -1 | awk -F'"' '{print $4}')
|
|
Storage Size: $(du -sh ./storage 2>/dev/null | cut -f1 || echo "N/A")
|
|
EOF
|
|
|
|
# Compress entire backup
|
|
echo "📦 Compressing backup..."
|
|
cd "${BACKUP_DIR}"
|
|
tar -czf "${BACKUP_NAME}.tar.gz" "${BACKUP_NAME}"
|
|
rm -rf "${BACKUP_NAME}"
|
|
|
|
# Cleanup old backups (keep last 7)
|
|
echo "🧹 Cleaning up old backups..."
|
|
ls -t *.tar.gz | tail -n +8 | xargs -r rm
|
|
|
|
echo -e "${GREEN}✅ Backup completed: ${BACKUP_DIR}/${BACKUP_NAME}.tar.gz${NC}"
|
|
echo "💡 To restore: tar -xzf ${BACKUP_NAME}.tar.gz && follow restore instructions" |