---
title: "Deploy Open WebUI · Quick Start"
description: "Self-hosted AI chat for OpenAI-compatible APIs, with Postgres and pgvector"
category: "AI/ML"
url: https://railway.com/deploy/open-webui-quick-start
---

# Deploy Open WebUI · Quick Start

Self-hosted AI chat for OpenAI-compatible APIs, with Postgres and pgvector

**[Deploy Open WebUI · Quick Start on Railway](https://railway.com/template/open-webui-quick-start)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/open-webui-quick-start/manifest.json

- **Creator:** withSeismic
- **Category:** AI/ML

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### open-webui

- **Image:** ghcr.io/open-webui/open-webui:latest
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Open WebUI on Railway

Open WebUI is a self-hosted chat interface for large language models. It works with any OpenAI-compatible API (OpenAI, OpenRouter, Groq, Together, LiteLLM and others) and with Ollama, and adds multi-user accounts, chat history, document chat (RAG), web search, tools and model presets. This template runs the official image with Postgres and pgvector, a generated admin account and public sign-up turned off.

## About Hosting Open WebUI

This template deploys two services: the official `ghcr.io/open-webui/open-webui:latest` image and Railway's Postgres 18, which ships with the pgvector extension.

- **No open admin sign-up.** Open WebUI normally makes the first person to visit the URL the admin. This template creates the admin account from variables before the server accepts requests, with a generated 32-character password, and turns public sign-up off. Anyone else who tries to sign up gets a 403.
- **Generated secret key.** `WEBUI_SECRET_KEY` is a generated 64-character value stored as a variable, so logins survive redeploys. Without it the image writes a new key inside the container on every deploy and everyone is logged out.
- **Postgres instead of SQLite.** Users, chats, settings and knowledge bases live in Postgres over the private network.
- **Embeddings in pgvector.** Document embeddings go into the same Postgres database (`VECTOR_DB=pgvector`), not Chroma files on disk. Open WebUI enables the extension itself on first boot.
- **Document chat works without an API key.** Uploaded files are embedded locally with `sentence-transformers/all-MiniLM-L6-v2`, which is downloaded once (about 90 MB) to the volume.
- **Volume for uploads.** `/app/backend/data` is a volume, so uploaded files and the model cache survive redeploys.
- **Hardened defaults.** Session cookies are HTTPS-only, CORS and websockets accept only this app's own domain, and the Ollama connection is off so the UI does not keep trying to reach an Ollama server that isn't there.
- **Healthcheck.** Railway waits for `/health` before routing traffic to a new deployment.
- **Tracks upstream.** The image uses the `latest` tag, which Open WebUI builds from its release branch (the same image as `main`), so pulling it again gives you the newest release.

### Getting started

1. Click **Deploy**. Optionally set `WEBUI_ADMIN_EMAIL` to your own email and paste an `OPENAI_API_KEY` (with `OPENAI_API_BASE_URL` if you use another OpenAI-compatible provider). Both can be left as they are.
2. Wait for both services to turn green. The first boot takes a minute or two: it creates the database tables, enables pgvector and downloads the embedding model.
3. Open the **open-webui** service, go to **Variables** and copy `WEBUI_ADMIN_PASSWORD`.
4. Open the service's public URL and log in with `WEBUI_ADMIN_EMAIL` and that password. You can change the password under **Settings > Account**.
5. Add a model provider under **Admin Panel > Settings > Connections**: an OpenAI-compatible URL and key, or an Ollama URL if you run Ollama elsewhere. Your models then appear in the model picker.
6. Add your team under **Admin Panel > Users** (the **+** button). Public sign-up stays off unless you turn it on under **Admin Panel > Settings > Authentication**; new sign-ups then wait as "pending" until you approve them.
7. To chat with documents, create a knowledge base under **Workspace > Knowledge**, upload files, and reference it in a chat with `#`.

## Common Use Cases

- A private, shared chat interface for a team over OpenAI, OpenRouter or any other OpenAI-compatible API, with per-user accounts and history.
- Chat with internal documents: upload PDFs and text files to knowledge bases and query them with any connected model.
- One front end for several providers and models, including a self-hosted Ollama or vLLM server.
- A place to build and share prompts, model presets, tools and functions across a team.

## Dependencies for Open WebUI Hosting

- Open WebUI (official Docker image)
- PostgreSQL 18 with pgvector (Railway's Postgres)
- An LLM provider to chat with: an OpenAI-compatible API key or an Ollama server. Not needed to deploy, log in, manage users or build knowledge bases.

### Deployment Dependencies

- [Open WebUI documentation](https://docs.openwebui.com/)
- [Open WebUI environment variables](https://docs.openwebui.com/reference/env-configuration)
- [Open WebUI on GitHub](https://github.com/open-webui/open-webui)
- [pgvector](https://github.com/pgvector/pgvector)
- [Railway Postgres](https://docs.railway.com/databases/postgresql)

### Implementation Details

| Variable | Default in this template | Purpose |
|---|---|---|
| `WEBUI_ADMIN_EMAIL` | `admin@example.com` | Admin login, created on first boot |
| `WEBUI_ADMIN_PASSWORD` | generated, 32 characters | Admin password, used on first boot only |
| `WEBUI_SECRET_KEY` | generated, 64 characters | Signs sessions. Keep it unchanged |
| `ENABLE_SIGNUP` | `False` | Public sign-up closed |
| `DEFAULT_USER_ROLE` | `pending` | New sign-ups need approval if you open sign-up |
| `DATABASE_URL` | `${{Postgres.DATABASE_URL}}` | Main database, private network |
| `VECTOR_DB` / `PGVECTOR_DB_URL` | `pgvector` / `${{Postgres.DATABASE_URL}}` | Embeddings stored in Postgres |
| `RAG_EMBEDDING_MODEL_AUTO_UPDATE` | `False` | Downloads only the model files needed (about 90 MB, not about 900 MB) and skips the update check on each boot |
| `OPENAI_API_KEY` | empty (optional) | Key for the OpenAI-compatible endpoint |
| `OPENAI_API_BASE_URL` | `https://api.openai.com/v1` | OpenAI-compatible endpoint |
| `ENABLE_OLLAMA_API` | `False` | No Ollama server is included |
| `WEBUI_URL` | `https://${{RAILWAY_PUBLIC_DOMAIN}}` | Public URL, used in links and OAuth redirects |
| `CORS_ALLOW_ORIGIN` | `https://${{RAILWAY_PUBLIC_DOMAIN}}` | Origins allowed for API calls and websockets |
| `WEBUI_SESSION_COOKIE_SECURE` | `True` | Cookies sent over HTTPS only |

Things to know:

- **Most settings are read on first boot only.** Open WebUI copies values such as `OPENAI_API_KEY`, `OPENAI_API_BASE_URL`, `ENABLE_SIGNUP`, `ENABLE_OLLAMA_API` and `WEBUI_URL` into the database the first time it starts, and the Admin Panel is the source of truth after that. To add or change a provider key later, use **Admin Panel > Settings > Connections**; changing the Railway variable has no effect. The same applies to `WEBUI_ADMIN_EMAIL` and `WEBUI_ADMIN_PASSWORD`, which only create the admin when the database has no users.
- **Custom domain.** After adding one, add it to `CORS_ALLOW_ORIGIN` (separate several origins with `;`) and update **Admin Panel > Settings > General > WebUI URL**. Until then, websocket connections from the new domain are refused.
- **Resources.** Open WebUI keeps the embedding model in memory. Measured on Railway: about 0.9 GB RAM for Open WebUI and about 0.1 GB for Postgres at idle, with CPU near zero for both. Embedding uploaded documents uses CPU while it runs. The volume holds about 90 MB of model cache plus your uploads.
- **First-boot log.** On the very first boot Open WebUI logs a `LocalEntryNotFoundError` traceback for the embedding model, then downloads it. This is expected and does not repeat.
- **Scaling.** Run one replica: the uploads volume attaches to a single instance. Open WebUI only needs Redis when it runs several instances or workers, so none is included.
- **Upgrades.** The service tracks `ghcr.io/open-webui/open-webui:latest`. A plain redeploy reuses the image it already pulled; to move to the newest release, redeploy from source (`railway redeploy --service open-webui --from-source --yes`). Database migrations run automatically on start. Back up Postgres before major version jumps. If you change the embedding model, use **Reindex Embedding Data** in **Admin Panel > Settings > Documents**.

## Why Deploy Open WebUI 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 Open WebUI on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/open-webui-quick-start
