---
title: "Deploy WebUI"
description: "Deploy OpenWebUI with Postgres & Redis"
category: "AI/ML"
url: https://railway.com/deploy/webui-1
---

# Deploy WebUI

Deploy OpenWebUI with Postgres & Redis

**[Deploy WebUI on Railway](https://railway.com/template/webui-1)**

- **Category:** AI/ML
- **Total deploys:** 2

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### open-webui/open-webui

- **Image:** ghcr.io/open-webui/open-webui
- **Public domain:** Yes

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

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

## Documentation

# 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/](https://docs.openwebui.com/)                                                                               |
| GitHub Repository        | [https://github.com/open-webui/open-webui](https://github.com/open-webui/open-webui)                                                     |
| Official Container Image | [https://github.com/open-webui/open-webui/pkgs/container/open-webui](https://github.com/open-webui/open-webui/pkgs/container/open-webui) |
| OpenAI API Documentation | [https://platform.openai.com/docs/api-reference](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:

```env
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.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [stella](https://railway.com/deploy/stella) — Self-host stella with web, API, Postgres, Redis, and object storage.
- [Hermes Agent | OpenClaw Alternative with Dashboard](https://railway.com/deploy/hermes-agent-or-openclaw-alternative-wit) — Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

Open this page in a browser: https://railway.com/deploy/webui-1
