Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull a default model on start #2

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ app = '' # change this before deploying!
primary_region = 'ord'

[env]
DEFAULT_MODEL = 'llama3.1:8b'
OLLAMA_BASE_URL = 'http://localhost:11434'
OLLAMA_MODELS = '/app/backend/data/models'

Expand Down
11 changes: 11 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ mkdir -p /app/backend/data/models

/bin/ollama serve &

# Wait until Ollama service is up and running
until curl -s http://localhost:11434 > /dev/null; do
echo 'Waiting for Ollama service to start...';
sleep 1;
done

if ! [ -e "$DEFAULT_MODEL" ]; then
echo "Pulling default model: $DEFAULT_MODEL"
ollama pull $DEFAULT_MODEL &
fi

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$SCRIPT_DIR" || exit

Expand Down