#!/bin/bash # File Transformer S3 Setup Script # This script helps set up the development environment set -e echo "🚀 Setting up File Transformer S3..." # Check if running on Arch Linux if command -v pacman &> /dev/null; then echo "📦 Detected Arch Linux - installing dependencies with pacman..." # Check if Node.js is installed if ! command -v node &> /dev/null; then echo "Installing Node.js and npm..." sudo pacman -S --noconfirm nodejs npm else echo "✅ Node.js already installed" fi # Check if Python3 is installed if ! command -v python3 &> /dev/null; then echo "Installing Python3..." sudo pacman -S --noconfirm python python-pip else echo "✅ Python3 already installed" fi # Check if Docker is installed if ! command -v docker &> /dev/null; then echo "Installing Docker..." sudo pacman -S --noconfirm docker docker-compose sudo systemctl enable docker sudo systemctl start docker sudo usermod -aG docker $USER echo "⚠️ Please log out and back in for Docker group changes to take effect" else echo "✅ Docker already installed" fi # Check if running on Ubuntu/Debian elif command -v apt &> /dev/null; then echo "📦 Detected Ubuntu/Debian - installing dependencies with apt..." # Check if Node.js is installed if ! command -v node &> /dev/null; then echo "Installing Node.js and npm..." curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejs else echo "✅ Node.js already installed" fi # Check if Python3 is installed if ! command -v python3 &> /dev/null; then echo "Installing Python3..." sudo apt-get update sudo apt-get install -y python3 python3-pip else echo "✅ Python3 already installed" fi # Check if Docker is installed if ! command -v docker &> /dev/null; then echo "Installing Docker..." curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker $USER rm get-docker.sh echo "⚠️ Please log out and back in for Docker group changes to take effect" else echo "✅ Docker already installed" fi else echo "⚠️ Unsupported package manager. Please install manually:" echo " - Node.js and npm" echo " - Python3 and pip" echo " - Docker and docker-compose" fi # Create .env file if it doesn't exist if [ ! -f .env ]; then echo "📝 Creating .env file from template..." cp env.example .env echo "✅ Created .env file" echo "⚠️ Please edit .env with your configuration values" else echo "✅ .env file already exists" fi # Install Node.js dependencies echo "📦 Installing Node.js dependencies..." cd dashboard npm install cd .. # Install Python dependencies echo "🐍 Installing Python dependencies..." pip3 install -r functions/requirements.txt echo "✅ Setup complete!" echo "" echo "Next steps:" echo "1. Edit .env file with your configuration" echo "2. Run 'make deploy-local' to start the system" echo "3. Or run 'make dev-dashboard' for development mode" echo "" echo "Available commands:" echo " make help - Show all available commands" echo " make deploy-local - Deploy with Docker Compose" echo " make dev-dashboard - Start dashboard in dev mode" echo " make build-functions - Build function containers"