sandbox-reports/deploy.sh
DJP facacc94d4 Update AI Tools Usage Report System - Multi-Tool Support
Enhanced the VEO3 usage report system to support all AI tool types:
- Added support for 6 tool types: VEO3, TEXT2IMAGE, TEXT2VOICE, SPEECH2SPEECH, DOCUMENT_TRANSLATION, VIDEOQUERY
- Updated Python report generator (veo3_report.py) with dynamic tool detection
- Updated PHP report page (report.php) with tool usage breakdown section
- Changed all "Prompts" references to "Requests" for clarity
- Updated refresh button to fetch only last 12 weeks (84 days) for better performance
- Made system dynamic to handle unknown tool types automatically
- Renamed report titles from "VEO3 Usage Report" to "AI Tools Usage Report"

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-08 14:50:04 -05:00

114 lines
3.1 KiB
Bash
Executable file

#!/bin/bash
# VEO3 Report Deployment Script
# This script deploys the VEO3 report system to a Linux server
set -e # Exit on error
# Configuration
DEPLOY_DIR="/var/www/veo3-report"
SERVICE_USER="www-data"
SERVICE_NAME="veo3-report"
LOG_DIR="/var/log/veo3-report"
echo "========================================"
echo "VEO3 Report System Deployment"
echo "========================================"
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "ERROR: This script must be run as root (use sudo)"
exit 1
fi
# Create deployment directory
echo "Creating deployment directory: $DEPLOY_DIR"
mkdir -p "$DEPLOY_DIR"
# Create log directory
echo "Creating log directory: $LOG_DIR"
mkdir -p "$LOG_DIR"
mkdir -p "$DEPLOY_DIR/logs"
# Copy files
echo "Copying application files..."
cp veo3_report.py "$DEPLOY_DIR/"
cp veo3_scheduler.py "$DEPLOY_DIR/"
cp requirements.txt "$DEPLOY_DIR/"
cp .env "$DEPLOY_DIR/"
# Make scripts executable
chmod +x "$DEPLOY_DIR/veo3_scheduler.py"
chmod +x "$DEPLOY_DIR/veo3_report.py"
# Set up Python virtual environment
echo "Setting up Python virtual environment..."
cd "$DEPLOY_DIR"
if [ ! -d "venv" ]; then
python3 -m venv venv
fi
# Install dependencies
echo "Installing Python dependencies..."
"$DEPLOY_DIR/venv/bin/pip" install --upgrade pip
"$DEPLOY_DIR/venv/bin/pip" install -r "$DEPLOY_DIR/requirements.txt"
# Set ownership
echo "Setting file ownership..."
chown -R "$SERVICE_USER:$SERVICE_USER" "$DEPLOY_DIR"
chown -R "$SERVICE_USER:$SERVICE_USER" "$LOG_DIR"
# Set permissions
chmod 600 "$DEPLOY_DIR/.env" # Protect sensitive credentials
# Install systemd service
echo "Installing systemd service..."
# Update service file with correct paths
sed -e "s|/var/www/veo3-report|$DEPLOY_DIR|g" \
-e "s|User=www-data|User=$SERVICE_USER|g" \
-e "s|Group=www-data|Group=$SERVICE_USER|g" \
veo3-report.service > /etc/systemd/system/${SERVICE_NAME}.service
# Reload systemd
echo "Reloading systemd daemon..."
systemctl daemon-reload
# Enable service (start on boot)
echo "Enabling service to start on boot..."
systemctl enable ${SERVICE_NAME}.service
# Start service
echo "Starting service..."
systemctl start ${SERVICE_NAME}.service
# Wait a moment for service to start
sleep 2
# Check service status
echo ""
echo "========================================"
echo "Service Status:"
echo "========================================"
systemctl status ${SERVICE_NAME}.service --no-pager
echo ""
echo "========================================"
echo "Deployment Complete!"
echo "========================================"
echo ""
echo "Service Commands:"
echo " Start: sudo systemctl start ${SERVICE_NAME}"
echo " Stop: sudo systemctl stop ${SERVICE_NAME}"
echo " Restart: sudo systemctl restart ${SERVICE_NAME}"
echo " Status: sudo systemctl status ${SERVICE_NAME}"
echo " Logs: sudo journalctl -u ${SERVICE_NAME} -f"
echo ""
echo "Log Files:"
echo " Service: $LOG_DIR/service.log"
echo " Errors: $LOG_DIR/service-error.log"
echo " Scheduler: $DEPLOY_DIR/logs/veo3_scheduler.log"
echo ""
echo "The report will run automatically at 7:00 PM EST every day."
echo ""