Deploying an Ollama App
Ollama is an open-source platform for running, managing, and serving large language models (LLMs) locally or in the cloud. It provides a simple API and CLI for interacting with models, making it easy to integrate AI capabilities into your applications. This guide explains how to deploy an Ollama application on Klutch.sh using a Dockerfile for a production-ready setup.
Prerequisites
- A Klutch.sh account (sign up here)
- A GitHub repository for your Ollama Docker setup
- Basic knowledge of Docker and Git
1. Prepare Your Ollama Project
Clone the official Ollama repository or create your own project directory:
git clone https://github.com/jmorganca/ollama.gitcd ollama
2. Sample Dockerfile
Here’s a basic Dockerfile for Ollama (adapt as needed for your use case):
FROM ollama/ollama:latest
# Expose the Ollama API portEXPOSE 11434
# Start the Ollama serverCMD ["ollama", "serve"]
3. Configure Environment Variables (Optional)
Ollama can be configured with environment variables for advanced settings. Refer to the Ollama documentation for available options.
4. Deploy to Klutch.sh
- Push your code (including Dockerfile) to your GitHub repository.
- In the Klutch.sh dashboard, create a new app and connect your repository.
- Set the build context and Dockerfile path if different from the root.
- Set the app port to
11434
(or the port exposed in your Dockerfile). - Add any required environment variables.
- Click “Create” to deploy. Klutch.sh will build and run your Ollama container.
5. Post-Deployment
- Access the Ollama API using the provided Klutch.sh URL and port 11434.
- Use the Ollama CLI or API to interact with your deployed models.
- (Optional) Connect a custom domain via the Klutch.sh dashboard.