#!/bin/bash set -e # Start Ollama server in background echo "Starting Ollama server..." ollama serve & OLLAMA_PID=$! # Wait for Ollama to be ready echo "Waiting for Ollama to be ready..." for i in {1..30}; do if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then echo "Ollama is ready!" break fi if [ $i -eq 30 ]; then echo "Ollama failed to start within 30 seconds" exit 1 fi sleep 1 done # Start the Node.js gateway application echo "Starting gateway..." exec node dist/main.js