#!/bin/bash set -e echo "🚀 Starting Authenticated Ollama Server with Admin Panel..." # Start supervisor in background to manage services supervisord -c /etc/supervisor/conf.d/supervisord.conf & # Wait a moment for services to start sleep 5 echo "⏳ Waiting for Ollama to be ready..." # Wait for Ollama to be responsive for i in {1..30}; do if curl -f http://127.0.0.1:11434/api/tags >/dev/null 2>&1; then echo "✅ Ollama is ready!" break fi echo "🔄 Attempt $i/30 - Waiting for Ollama..." sleep 2 done echo "📥 Pulling Llama 3.2 1B model..." # Switch to user account for model operations su - user -c "ollama pull llama3.2:1b" || echo "⚠️ Model pull failed, but continuing..." echo "🎉 Server is ready with Admin Panel!" echo "📡 API available at http://localhost:7860" echo "📖 Documentation at http://localhost:7860/docs" echo "🔧 Admin panel endpoints available" # Keep the container running tail -f /var/log/supervisor/*.log