
Deploy Ollama
A software platform for downloading, running, and managing LLMs.
Ollama
Just deployed
/root/.ollama
Open WebUI
Just deployed
/app/backend/data

Deploy and Host Ollama on Railway
Run self-hosted language models with Ollama and chat with them through Open WebUI. This template deploys two services: a private Ollama server for model inference and a public Open WebUI instance for managing models and conversations.
About Hosting Ollama
Ollama downloads and runs the models you choose from the Ollama model library. Open WebUI connects to Ollama over Railway’s private network. When you send a message, Ollama generates the response and Open WebUI streams it back to your browser.
Getting started
- Open the Open WebUI service’s public URL and create your admin account.
- In the admin settings, go to Settings → Connections and select Manage on the preconfigured Ollama connection.
- Pull a model.
llama3.2:1bis a small model you can use to verify the deployment before trying a larger one. - Start a new chat, select the downloaded model, and send a message.
A fresh deployment starts with an empty model library. Once downloaded, models stay on Ollama’s persistent volume across redeploys.
Common Use Cases
- Self-hosted chat — Draft text, summarize notes, or ask questions through a browser using a model running in your Railway project.
- Prompt and model testing — Run the same prompt against different models to compare response quality and speed before choosing one for an application.
- Application integration — Call Ollama from another Railway service to classify messages, extract fields from text, or generate summaries.
Dependencies for Ollama Hosting
The template includes Ollama and Open WebUI with a preconfigured private connection. Each service has its own persistent volume.
| Service | Purpose | Persistent storage |
|---|---|---|
| Ollama | Downloads models and serves inference requests on private port 11434. | /root/.ollama stores downloaded models. |
| Open WebUI | Provides the browser interface for model management and chat on port 8080. | /app/backend/data stores accounts, conversations, and application data. |
Using the Ollama API
Open WebUI is included, but you can also call Ollama directly from another service in the same Railway environment. Set this variable on the calling service:
OLLAMA_BASE_URL=http://${{Ollama.RAILWAY_PRIVATE_DOMAIN}}:11434
Use GET /api/tags to list installed models and POST /api/chat to send a conversation. The private hostname is reachable from your Railway services. For browser access, use Open WebUI’s public URL.
Choosing a model
Check both volume capacity and available memory before pulling a larger model. The model files need to fit on disk, and Ollama needs enough memory to load the model and handle its context window. If chat responses are slow, check Ollama’s CPU and memory usage first. Open WebUI handles the conversation interface, while Ollama does the inference work.
Why Deploy Ollama on Railway?
You get a browser-based chat interface and a private inference API backed by the same model library. Pull a model once, test it in Open WebUI, and call it from an application in the same Railway environment. Separate services and volumes let you update the interface while keeping downloaded models and chat history available across redeploys.
Resources
Template Content
Ollama
ollama/ollamaOpen WebUI
ghcr.io/open-webui/open-webui
