Railway

Deploy WebUI

Deploy OpenWebUI with Postgres & Redis

Deploy WebUI

Just deployed

/data

open-webui/open-webui

open-webui/open-webui

Just deployed

/var/lib/postgresql/data

Deploy and Host WebUI on Railway

Open WebUI is an open-source, self-hosted AI chat interface for interacting with large language models through a modern, ChatGPT-style web application. It supports OpenAI-compatible APIs, Ollama, and other AI providers, while offering user management, chat history, document-based retrieval (RAG), and multi-user collaboration in a private deployment.

About Hosting WebUI

Hosting Open WebUI on Railway provides a production-ready AI workspace without managing servers or container infrastructure. This template deploys Open WebUI alongside PostgreSQL for persistent storage and Redis for real-time WebSocket communication and caching. Railway automatically provisions secure private networking between services, HTTPS for public access, and environment variable management for secrets and API keys. Unlike the default SQLite deployment, PostgreSQL preserves chat history, prompts, user accounts, and settings across redeployments, while Redis enables horizontal scaling and responsive real-time collaboration for multiple users.

Common Use Cases

  • Deploy a private ChatGPT alternative for individuals, teams, or organizations.
  • Connect multiple AI providers such as OpenAI, Gemini, and Ollama through a single interface.
  • Build internal AI assistants with document search, retrieval-augmented generation (RAG), and shared workspaces.

Dependencies for WebUI Hosting

DependencyPurpose
PostgreSQLStores users, conversations, prompts, settings, and application data.
RedisProvides caching and WebSocket support for real-time features and scaling.

Deployment Dependencies

ResourceLink
Official Documentationhttps://docs.openwebui.com/
GitHub Repositoryhttps://github.com/open-webui/open-webui
Official Container Imagehttps://github.com/open-webui/open-webui/pkgs/container/open-webui
OpenAI API Documentationhttps://platform.openai.com/docs/api-reference

Implementation Details

Docker

This template deploys the following services:

ServiceImage
Open WebUIghcr.io/open-webui/open-webui
PostgreSQLghcr.io/railwayapp-templates/postgres-ssl:17
Redisredis:8.2.1

Railway automatically deploys all services without requiring custom build commands.

Public Networking

SettingValue
Proxy TypeHTTP Proxy
Target Port8080

Generate a Railway domain from Settings → Networking → Generate Domain to access the application.

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string.
REDIS_URLYesRedis connection string.
WEBSOCKET_REDIS_URLYesRedis backend for WebSocket support.
WEBUI_SECRET_KEYYesSecret used to sign user sessions.
WEBUI_URLYesPublic Railway URL for the deployment.
WEBUI_AUTHYesEnables user authentication.
OPENAI_API_KEYNoOpenAI or Gemini API key.
OPENAI_API_BASE_URLNoOpenAI-compatible API endpoint.
OLLAMA_BASE_URLNoURL of an Ollama server for local models.
DATABASE_POOL_SIZENoPostgreSQL connection pool size.
ENABLE_WEBSOCKET_SUPPORTNoEnables real-time WebSocket features.
ANONYMIZED_TELEMETRYNoEnable or disable telemetry collection.

Example:

DATABASE_URL=${{Postgres.DATABASE_URL}}
REDIS_URL=${{Redis.REDIS_URL}}
WEBSOCKET_REDIS_URL=${{Redis.REDIS_URL}}

WEBUI_SECRET_KEY=${{secret(64)}}
WEBUI_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
WEBUI_AUTH=true

OPENAI_API_KEY=sk-...
OPENAI_API_BASE_URL=https://api.openai.com/v1

ENABLE_WEBSOCKET_SUPPORT=true
ANONYMIZED_TELEMETRY=false

To use Google Gemini, set OPENAI_API_BASE_URL to Google's OpenAI-compatible endpoint and provide your Gemini API key. For Ollama, configure OLLAMA_BASE_URL to point to your Ollama instance.

Persistent Storage

Open WebUI stores application data in PostgreSQL by default.

Additional persistent storage is optional and only required if you plan to retain uploaded files or configure external storage backends such as Amazon S3, Google Cloud Storage, or Azure Blob Storage.

Database

This template requires both PostgreSQL and Redis.

  • Add the Railway PostgreSQL service.
  • Add the Railway Redis service.
  • Use the Railway reference variables for DATABASE_URL, REDIS_URL, and WEBSOCKET_REDIS_URL.
  • PostgreSQL stores users, chats, prompts, and settings.
  • Redis provides caching and WebSocket state management for real-time communication.

Build & Start

The application runs directly from the official container image.

No custom build or start commands are required.

Accessing the Application

After deployment:

  1. Generate a Railway public domain.
  2. Open the generated URL.
  3. Create the first user account.
  4. The first registered account automatically becomes the administrator.
  5. Configure your preferred AI provider from Settings → Connections or through environment variables.
  6. Invite additional users and begin chatting with your connected models.

Why Deploy 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 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.


Template Content

open-webui/open-webui

ghcr.io/open-webui/open-webui

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
51