ngandugilbert commited on
Commit
c5eda13
·
verified ·
1 Parent(s): 37a11c4

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +26 -0
start.sh ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Start Ollama in the background
4
+ ollama serve &
5
+
6
+ # Pull the TinyLlama model
7
+ ollama pull tinyllama
8
+
9
+ # Wait for Ollama to start
10
+ max_attempts=30
11
+ attempt=0
12
+ while ! curl -s http://localhost:11434/api/tags >/dev/null; do
13
+ sleep 1
14
+ attempt=$((attempt + 1))
15
+ if [ $attempt -eq $max_attempts ]; then
16
+ echo "Ollama failed to start within 30 seconds. Exiting."
17
+ exit 1
18
+ fi
19
+ done
20
+ echo "Ollama is ready."
21
+
22
+ # Set Ngrok auth token from environment variable
23
+ ngrok authtoken $NGROK_AUTH_TOKEN
24
+
25
+ # Start Ngrok to tunnel the Ollama server
26
+ ngrok http 11434