Deploy Open WebUI
Open WebUI on Postgres with pgvector, admin account set at deploy time
Postgres
Just deployed
Open WebUI
Just deployed
Deploy and Host Open WebUI on Railway
Open WebUI is a self-hosted AI chat interface: models from OpenAI-compatible APIs or Ollama, document chat (RAG), tools, web search and accounts for a team.
This template runs the official image (v0.11.4) with Postgres and pgvector, which holds both the app's database and the embeddings of your documents.
About Hosting Open WebUI
Open WebUI makes the first account that signs up the admin, which is a race on a public URL. It can also create the admin itself at startup from WEBUI_ADMIN_EMAIL and WEBUI_ADMIN_PASSWORD and then turn sign-up off, so this template uses that: the deploy form asks for your email and the password is generated. Open OPEN_WEBUI_URL and sign in with them. Add people from the admin panel, or open sign-up there.
OPENROUTER_API_KEY is optional. With it, every OpenRouter model shows up in the model list and uploaded documents are embedded through OpenRouter (openai/text-embedding-3-small). Without it, add a connection in Admin Settings; chat and document search need a key either way.
I first ran document embeddings on Open WebUI's built-in local model. That worked, but idle RAM went from 0.73 GB to 0.92 GB, too close to the 1 GB per service that Railway's trial allows, so the template sends embeddings to OpenRouter.
Before publishing I tested it end to end on a fresh deploy. Signing up returned 403 and the admin signed in with the admin role. With an OpenRouter key, 459 models were listed and a chat completion with openai/gpt-4o-mini answered. A text file I uploaded finished processing. After a restart the admin signed in again and the saved chat was still there.
Common Use Cases
- A private ChatGPT-style interface for a team, with any model on OpenRouter or your own API connections
- Upload documents and chat about them, with the embeddings stored in your own Postgres
Dependencies for Open WebUI Hosting
An OpenRouter key, or another OpenAI-compatible API you add as a connection in Admin Settings.
Deployment Dependencies
- Open WebUI: https://github.com/open-webui/open-webui
- Docs: https://docs.openwebui.com
- Image:
ghcr.io/open-webui/open-webui:v0.11.4
Implementation Details
WEBUI_ADMIN_EMAIL / WEBUI_ADMIN_PASSWORD # admin created at first start, then sign-up is off
ENABLE_SIGNUP=false
DATABASE_URL + VECTOR_DB=pgvector # one Postgres for app data and embeddings
OPENAI_API_BASE_URL=https://openrouter.ai/api/v1, OPENAI_API_KEY=OPENROUTER_API_KEY
RAG_EMBEDDING_ENGINE=openai # embeddings through OpenRouter
WEBUI_SECRET_KEY # generated
Uploads and caches live on a volume at /app/backend/data. Open WebUI saves most settings in the database on first start, so later changes belong in Admin Settings rather than in these variables.
To upgrade, change the image tag on the Open WebUI service to a newer release.
Idle, Open WebUI used 0.73 GB of RAM and Postgres 0.10 GB.
Why Deploy Open WebUI on Railway?
You get your own chat interface on a public HTTPS address with nobody able to claim the admin account, and your conversations and documents stay in a Postgres you control. Idle RAM for both services comes to about $8 a month; model usage is billed by your provider.
Template Content
Postgres
pgvector/pgvector:pg17Open WebUI
ghcr.io/open-webui/open-webui:v0.11.4WEBUI_ADMIN_EMAIL
Email of the admin account, created on first start. Sign in with it and WEBUI_ADMIN_PASSWORD
