- Add DEPLOYMENT.md with production deployment guide - Add README-FASTAPI.md with backend API documentation - Add README-FULLSTACK.md with complete migration guide - Add Apache configuration in docs/apache/ for reference Documentation includes: - Quick start guide for Docker Compose - Environment variable configuration - API endpoint documentation - Troubleshooting guide - Backup and maintenance procedures - Migration statistics and improvements Apache configuration (reference only): - SSL/HTTPS setup - Reverse proxy for FastAPI backend - Static file serving for React frontend - Security headers and caching Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
117 lines
3.7 KiB
Bash
Executable file
117 lines
3.7 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Apache Setup Script for Oliver Metadata Tool
|
|
# Run once to configure Apache for the application
|
|
#
|
|
# Usage: sudo ./setup-apache.sh
|
|
|
|
set -e
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
|
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
|
|
echo ""
|
|
echo "Oliver Metadata Tool - Apache Setup"
|
|
echo "===================================="
|
|
echo ""
|
|
|
|
# Check if running as root
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "This script must be run as root (use sudo)"
|
|
exit 1
|
|
fi
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
APACHE_CONFIG="/etc/apache2/sites-available/solventum-image-metadata.conf"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Enable required Apache modules
|
|
# -----------------------------------------------------------------------------
|
|
log_info "Enabling Apache modules..."
|
|
|
|
sudo a2enmod proxy 2>/dev/null || log_warn "proxy already enabled"
|
|
sudo a2enmod proxy_http 2>/dev/null || log_warn "proxy_http already enabled"
|
|
sudo a2enmod headers 2>/dev/null || log_warn "headers already enabled"
|
|
sudo a2enmod rewrite 2>/dev/null || log_warn "rewrite already enabled"
|
|
sudo a2enmod ssl 2>/dev/null || log_warn "ssl already enabled"
|
|
|
|
log_success "Apache modules enabled"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Copy Apache configuration
|
|
# -----------------------------------------------------------------------------
|
|
log_info "Installing Apache configuration..."
|
|
|
|
if [[ -f "$APACHE_CONFIG" ]]; then
|
|
log_warn "Configuration already exists, creating backup..."
|
|
sudo cp "$APACHE_CONFIG" "${APACHE_CONFIG}.backup.$(date +%Y%m%d-%H%M%S)"
|
|
fi
|
|
|
|
sudo cp "$SCRIPT_DIR/apache-config.conf" "$APACHE_CONFIG"
|
|
|
|
log_success "Configuration installed"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Test Apache configuration
|
|
# -----------------------------------------------------------------------------
|
|
log_info "Testing Apache configuration..."
|
|
|
|
if sudo apache2ctl configtest; then
|
|
log_success "Apache configuration is valid"
|
|
else
|
|
echo "Apache configuration test failed!"
|
|
echo "Fix errors and run: sudo apache2ctl configtest"
|
|
exit 1
|
|
fi
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Enable site
|
|
# -----------------------------------------------------------------------------
|
|
log_info "Enabling site..."
|
|
|
|
sudo a2ensite solventum-image-metadata 2>/dev/null || log_warn "Site already enabled"
|
|
|
|
log_success "Site enabled"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Reload Apache
|
|
# -----------------------------------------------------------------------------
|
|
log_info "Reloading Apache..."
|
|
|
|
sudo systemctl reload apache2 || {
|
|
echo "Apache reload failed, trying restart..."
|
|
sudo systemctl restart apache2
|
|
}
|
|
|
|
log_success "Apache reloaded"
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Summary
|
|
# -----------------------------------------------------------------------------
|
|
echo ""
|
|
echo "=============================================="
|
|
log_success "Apache setup complete!"
|
|
echo "=============================================="
|
|
echo ""
|
|
|
|
log_info "Configuration file: $APACHE_CONFIG"
|
|
log_info "Frontend path: /var/www/html/solventum-image-metadata"
|
|
echo ""
|
|
|
|
log_info "Next steps:"
|
|
echo " 1. Run: sudo ./deploy.sh"
|
|
echo " 2. Access: https://ai-sandbox.oliver.solutions/solventum-image-metadata/"
|
|
echo ""
|
|
|
|
log_info "Useful commands:"
|
|
echo " Check config: sudo apache2ctl configtest"
|
|
echo " Reload Apache: sudo systemctl reload apache2"
|
|
echo " View logs: sudo tail -f /var/log/apache2/solventum-image-metadata-error.log"
|
|
echo ""
|