Railway

Deploy DeepSeek Chat — Ollama + Open WebUI, Private AI

Run distilled DeepSeek models privately — Ollama + chat UI

Deploy DeepSeek Chat — Ollama + Open WebUI, Private AI

Just deployed

/root/.ollama

Just deployed

/app/backend/data

Deploy and Host DeepSeek on Railway

Run DeepSeek's distilled open models privately with a ready-made stack — Ollama as the model server and Open WebUI as a ChatGPT-style interface, deployed in one click. Pick which DeepSeek model to load, and the template handles downloading it, wiring the chat UI to the model server, and persisting both your models and your conversations. No manual Ollama setup, no config files.


What This Template Deploys

ServicePurpose
OllamaThe model server — downloads and runs DeepSeek models, exposes an API on port 11434
Open WebUIChatGPT-style chat interface, connected to Ollama on port 8080

Both run on Railway's private network. Persistent volumes hold the downloaded models (which are gigabytes) and your chat history, so neither is re-downloaded or lost on redeploy.


About Hosting

One thing to understand before deploying, because it sets expectations correctly: Railway is CPU-only — there are no GPUs. That determines which DeepSeek models are realistic here.

This runs the distilled DeepSeek models, not the full 671B ones. DeepSeek's flagship R1 and V3 models need hundreds of gigabytes of GPU memory across multiple high-end GPUs — impossible on any CPU host. What runs well here are the distilled variantsdeepseek-r1:1.5b, 7b, 8b — which are compact enough for CPU inference. They're genuinely capable for many tasks, but they are smaller models, and on CPU they respond more slowly than a GPU-backed service. If you deploy expecting the full R1's speed and depth, that expectation won't match reality; deploy expecting a private, self-hosted small reasoning model and it delivers.

Want the full DeepSeek models instead? Skip local inference and point Open WebUI at DeepSeek's API — set the DeepSeek API base URL and key in Open WebUI, and you get the full R1/V3 models running on DeepSeek's own GPUs while Railway just hosts your private chat interface and history. The template supports both paths: local distilled models via Ollama, or the full models via API.

Volumes are essential. DeepSeek models are multiple gigabytes each; without a persistent volume on Ollama, every redeploy re-downloads them, which is slow and wasteful. Open WebUI needs its own volume for accounts and chat history. Both are mounted here.

Typical cost: ~$10–20/month on Railway depending on model size and RAM — larger distilled models need more memory. Everything is open source and free; API mode adds DeepSeek's usage cost.


How It Compares

Distilled DeepSeek (this template)DeepSeek API (via this UI)DeepSeek.comChatGPT
Where models runYour Railway CPUDeepSeek GPUsDeepSeek GPUsOpenAI
Model size1.5B–8B distilledFull R1/V3Full R1/V3GPT
Data privacyFully localUI local, inference remoteVendorVendor
SpeedSlower (CPU)FastFastFast
CostFlat infraInfra + API usageFree/paidSubscription
Self-hosted UIYesYesNoNo

For fully-private local inference, the distilled models on Ollama keep everything on your infrastructure. For full-model quality, API mode runs inference on DeepSeek's GPUs while keeping your chat interface and history self-hosted. This template gives you both from one deployment.


Deploy in Under 5 Minutes

  1. Click Deploy on Railway — Ollama and Open WebUI build automatically (~3 minutes)
  2. Confirm volumes are mounted for Ollama models and Open WebUI data
  3. Set which DeepSeek model to pull (e.g. deepseek-r1:7b) — the template downloads it on first run
  4. Open the Open WebUI domain, create the first account (it becomes admin), and select the model
  5. Start chatting — or, for full models, add your DeepSeek API key in Open WebUI settings instead

The first model download takes a few minutes depending on size; after that it's cached on the volume.


Common Use Cases

  • Private local AI chat — run a distilled DeepSeek reasoning model entirely on your own infrastructure, nothing sent to a vendor
  • Self-hosted chat UI for DeepSeek's API — keep the interface and history private while using the full R1/V3 models via API
  • Offline-capable reasoning model — a compact DeepSeek model for tasks where data can't leave your infrastructure
  • Model experimentation — try different distilled sizes (1.5B/7B/8B) and compare quality versus speed
  • Team AI workspace — Open WebUI's multi-user support gives a team a shared private DeepSeek interface
  • Cost-controlled AI — flat infrastructure for local models, or pay-per-use API mode, your choice per deployment

Configuration

VariableRequiredDescription
OLLAMA_MODELRecommendedDeepSeek model to auto-pull, e.g. deepseek-r1:7b
OLLAMA_BASE_URLAuto-injectedOllama's private address, wired into Open WebUI
WEBUI_SECRET_KEYRequiredSigns Open WebUI sessions — set once, keep stable
WEBUI_AUTHPre-settrue — enables login and multi-user accounts
OLLAMA_PORTPre-set11434
PORTPre-set8080 for Open WebUI
OPENAI_API_BASE_URLOptionalSet to DeepSeek's API endpoint to use the full R1/V3 models
OPENAI_API_KEYOptionalYour DeepSeek API key when using API mode

Only distilled models run locally on Railway. Use deepseek-r1:1.5b, 7b, or 8b. The full R1/V3 need GPUs Railway doesn't have — for those, use API mode with OPENAI_API_BASE_URL pointed at DeepSeek.

Volumes are required. Ollama's model volume prevents multi-gigabyte re-downloads on redeploy; Open WebUI's volume holds accounts and chat history. Without them, models and conversations reset.


Dependencies for DeepSeek Hosting

  • Railway account — expect ~$10–20/month depending on model size and RAM
  • Persistent volumes for Ollama models and Open WebUI data (included)
  • More RAM for larger distilled models (7B/8B need more than 1.5B)
  • Optional: a DeepSeek API key for full-model access via API mode

Deployment Dependencies

Implementation Details

The template runs the official Ollama image (port 11434) and Open WebUI (port 8080) on Railway's private network, with OLLAMA_BASE_URL wiring the chat UI to the model server automatically. On first run, Ollama pulls the DeepSeek model specified in OLLAMA_MODEL onto its persistent volume, so the multi-gigabyte download happens once rather than on every redeploy.

Because Railway is CPU-only, the template targets DeepSeek's distilled models (1.5B–8B), which run on CPU — slower than GPU inference but fully private and self-contained. For the full R1/V3 models, Open WebUI can be pointed at DeepSeek's API via OPENAI_API_BASE_URL and OPENAI_API_KEY, running inference on DeepSeek's GPUs while keeping the interface and chat history on your Railway deployment. Open WebUI's own volume persists users, settings, and conversations; WEBUI_SECRET_KEY must stay stable or sessions are invalidated.


Frequently Asked Questions

Can I run the full DeepSeek R1 on Railway? No — the full R1 and V3 need multiple high-end GPUs and hundreds of GB of memory, which Railway (CPU-only) can't provide. This template runs the distilled 1.5B–8B models locally, or connects to DeepSeek's API for the full models while keeping your UI self-hosted.

How fast are the local models? The distilled models run on CPU, so they're slower than a GPU-backed service — usable for many tasks, but not instant. If you need speed with the full models, use API mode.

What's the difference between local and API mode? Local mode runs a distilled model on your Railway CPU — fully private, flat cost. API mode sends inference to DeepSeek's GPUs for the full models — faster and more capable, but requests leave your infrastructure and cost per use. The template supports both.

Do my models and chats survive a redeploy? Yes, with the volumes mounted. Models are cached on Ollama's volume and chat history on Open WebUI's, so neither is lost or re-downloaded.

Which model should I pick? deepseek-r1:1.5b for the lightest/fastest, 7b or 8b for better quality if you allocate more RAM. Larger distilled models need more memory.

Is my data private in local mode? Yes. In local mode, inference runs entirely on your Railway service and nothing is sent to any third party. API mode sends prompts to DeepSeek.

Can a team use it? Yes. Open WebUI supports multiple users with authentication, so a team shares one private DeepSeek interface.


Why Deploy DeepSeek on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying this DeepSeek stack on Railway you get a private AI chat setup in one click — Ollama and Open WebUI pre-wired, models auto-downloaded to a persistent volume, chat history saved, and a choice of local distilled models or the full models via API. Private, self-hosted, and honest about what runs where.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
55