- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
76 lines
2.7 KiB
Bash
76 lines
2.7 KiB
Bash
#!/bin/bash
|
||
|
||
# Скрипт для бэкапа Git репозитория на S3
|
||
# Использование: ./backup_to_s3.sh [описание_изменений]
|
||
|
||
# Настройки
|
||
BUCKET_NAME="crm-git-backups"
|
||
BACKUP_PREFIX="crm-git-backup"
|
||
S3_ENDPOINT="https://s3.timeweb.cloud"
|
||
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
||
COMMIT_MESSAGE=${1:-"Auto backup $(date '+%Y-%m-%d %H:%M:%S')"}
|
||
|
||
# Цвета для вывода
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
NC='\033[0m' # No Color
|
||
|
||
echo -e "${GREEN}=== CRM Git Backup to S3 ===${NC}"
|
||
|
||
# Проверяем, что мы в Git репозитории
|
||
if [ ! -d ".git" ]; then
|
||
echo -e "${RED}Ошибка: Не найден Git репозиторий${NC}"
|
||
exit 1
|
||
fi
|
||
|
||
# Проверяем наличие изменений
|
||
if git diff --quiet && git diff --cached --quiet; then
|
||
echo -e "${YELLOW}Нет изменений для коммита${NC}"
|
||
exit 0
|
||
fi
|
||
|
||
# Добавляем все изменения
|
||
echo -e "${YELLOW}Добавляем изменения в Git...${NC}"
|
||
git add .
|
||
|
||
# Создаем коммит
|
||
echo -e "${YELLOW}Создаем коммит: $COMMIT_MESSAGE${NC}"
|
||
git commit -m "$COMMIT_MESSAGE"
|
||
|
||
# Создаем архив репозитория
|
||
ARCHIVE_NAME="crm_backup_${TIMESTAMP}.tar.gz"
|
||
echo -e "${YELLOW}Создаем архив: $ARCHIVE_NAME${NC}"
|
||
|
||
# Исключаем .git из архива для экономии места
|
||
tar --exclude='.git' --exclude='cache' --exclude='logs' --exclude='test' \
|
||
-czf "/tmp/$ARCHIVE_NAME" .
|
||
|
||
# Проверяем размер архива
|
||
ARCHIVE_SIZE=$(du -h "/tmp/$ARCHIVE_NAME" | cut -f1)
|
||
echo -e "${GREEN}Архив создан: $ARCHIVE_NAME (размер: $ARCHIVE_SIZE)${NC}"
|
||
|
||
# Загружаем на S3 (если настроен AWS CLI)
|
||
if command -v aws &> /dev/null; then
|
||
echo -e "${YELLOW}Загружаем на S3...${NC}"
|
||
aws --endpoint-url="$S3_ENDPOINT" s3 cp "/tmp/$ARCHIVE_NAME" "s3://$BUCKET_NAME/$BACKUP_PREFIX/$ARCHIVE_NAME"
|
||
|
||
if [ $? -eq 0 ]; then
|
||
echo -e "${GREEN}✅ Бэкап успешно загружен на S3${NC}"
|
||
echo -e "${GREEN} S3 путь: s3://$BUCKET_NAME/$BACKUP_PREFIX/$ARCHIVE_NAME${NC}"
|
||
else
|
||
echo -e "${RED}❌ Ошибка загрузки на S3${NC}"
|
||
fi
|
||
else
|
||
echo -e "${YELLOW}⚠️ AWS CLI не установлен, пропускаем загрузку на S3${NC}"
|
||
fi
|
||
|
||
# Очищаем временный файл
|
||
rm -f "/tmp/$ARCHIVE_NAME"
|
||
|
||
# Показываем последние коммиты
|
||
echo -e "${GREEN}Последние коммиты:${NC}"
|
||
git log --oneline -5
|
||
|
||
echo -e "${GREEN}=== Backup завершен ===${NC}"
|