Deploy WebUI
Deploy OpenWebUI with Postgres & Redis
Redis
Just deployed
/data
open-webui/open-webui
Just deployed
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
| Dependency | Purpose |
|---|---|
| PostgreSQL | Stores users, conversations, prompts, settings, and application data. |
| Redis | Provides caching and WebSocket support for real-time features and scaling. |
Deployment Dependencies
| Resource | Link |
|---|---|
| Official Documentation | https://docs.openwebui.com/ |
| GitHub Repository | https://github.com/open-webui/open-webui |
| Official Container Image | https://github.com/open-webui/open-webui/pkgs/container/open-webui |
| OpenAI API Documentation | https://platform.openai.com/docs/api-reference |
Implementation Details
Docker
This template deploys the following services:
| Service | Image |
|---|---|
| Open WebUI | ghcr.io/open-webui/open-webui |
| PostgreSQL | ghcr.io/railwayapp-templates/postgres-ssl:17 |
| Redis | redis:8.2.1 |
Railway automatically deploys all services without requiring custom build commands.
Public Networking
| Setting | Value |
|---|---|
| Proxy Type | HTTP Proxy |
| Target Port | 8080 |
Generate a Railway domain from Settings → Networking → Generate Domain to access the application.
Environment Variables
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string. |
REDIS_URL | Yes | Redis connection string. |
WEBSOCKET_REDIS_URL | Yes | Redis backend for WebSocket support. |
WEBUI_SECRET_KEY | Yes | Secret used to sign user sessions. |
WEBUI_URL | Yes | Public Railway URL for the deployment. |
WEBUI_AUTH | Yes | Enables user authentication. |
OPENAI_API_KEY | No | OpenAI or Gemini API key. |
OPENAI_API_BASE_URL | No | OpenAI-compatible API endpoint. |
OLLAMA_BASE_URL | No | URL of an Ollama server for local models. |
DATABASE_POOL_SIZE | No | PostgreSQL connection pool size. |
ENABLE_WEBSOCKET_SUPPORT | No | Enables real-time WebSocket features. |
ANONYMIZED_TELEMETRY | No | Enable 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, andWEBSOCKET_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:
- Generate a Railway public domain.
- Open the generated URL.
- Create the first user account.
- The first registered account automatically becomes the administrator.
- Configure your preferred AI provider from Settings → Connections or through environment variables.
- 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
Redis
redis:8.2.1open-webui/open-webui
ghcr.io/open-webui/open-webuiOPENAI_API_KEY
Optional OpenAI API key
