Skip to content

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:

Terminal window
git clone https://github.com/jmorganca/ollama.git
cd 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 port
EXPOSE 11434
# Start the Ollama server
CMD ["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

  1. Push your code (including Dockerfile) to your GitHub repository.
  2. In the Klutch.sh dashboard, create a new app and connect your repository.
  3. Set the build context and Dockerfile path if different from the root.
  4. Set the app port to 11434 (or the port exposed in your Dockerfile).
  5. Add any required environment variables.
  6. 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.

Resources