Skip to content

Open WebUI self-hosted: a private AI chat with Docker and Postgres

Run Open WebUI as your own private ChatGPT-style chat: the official Docker image, managed Postgres for users and chats, HTTPS, and the model API you choose.

Abhishek Jaiswal

6 min

On this page 10 sections

Open WebUI gives you a private ChatGPT-style chat interface that you host yourself.

A team install needs the official ghcr.io/open-webui/open-webui Docker image, a Postgres database for users and chat history, and an HTTPS address. You then point it at a model API you already pay for, such as OpenAI, OpenRouter or your own Ollama server. On Ownkube the Open WebUI template sets all of that up in one click.

The short version

  • A self-hosted AI chat has two halves. The interface and its data live with you, and the model runs wherever you send the requests.
  • The Open WebUI template deploys the official image with a managed Postgres database, a persistent volume for uploads and an ownkube.app hostname with automatic HTTPS.
  • The first account to sign up becomes the admin, so finish setup right after the deploy.
  • Open WebUI loads an embedding model when it starts, so give it at least 1 GiB of memory.

What “private ChatGPT” means here

People searching for a private ChatGPT or a self-hosted ChatGPT usually want their chats in a database they control, accounts for their team, and one interface for several models. Open WebUI does each of those. Users, chats, prompts and settings sit in your Postgres database, and uploaded documents stay on the app’s own volume.

The prompts still travel to the model provider you connect, and a hosted API’s data terms apply to what you send it. If you run Ollama on your own GPU machine, the whole loop stays on hardware you control.

The fastest way: the Open WebUI template

The Open WebUI template on the Ownkube Marketplace creates a Postgres 18 database, deploys the official image, wires the connection string into DATABASE_URL and generates WEBUI_SECRET_KEY, which keeps everyone signed in across restarts.

Deploy it, open the hostname and create your account straight away, because Open WebUI makes the first account the admin.

From the terminal, okctl runs the same install:

Terminal window
okctl regions list
okctl boxes list --kind database
okctl marketplace deploy open-webui --region <region-id> --db-box <box-id>

The Marketplace sets up other self-hosted apps the same way. We have guides for Vaultwarden, NocoDB and n8n.

Connect a model provider

Once you’re signed in as the admin, open the admin settings and add a connection. Open WebUI speaks two protocols:

Connection What it reaches
OpenAI API OpenAI itself, or any OpenAI-compatible endpoint such as OpenRouter, Groq, or a vLLM or LiteLLM server
Ollama An Ollama server you run, for example on a GPU machine at home or in the office

You can add more than one. Each user then picks a model from a single dropdown, so the team gets one interface for every model you pay for.

Connection settings saved in the admin panel are stored in the database. After the first start those saved values take priority over environment variables, so make later changes in the panel.

Lock down sign-ups

After the admin account exists, new sign-ups get the pending role by default and can’t chat until an admin approves them, which works fine for a small team.

To close registration completely, turn off new sign-ups in the admin panel’s general settings and add people from the users page. This is one of the database-saved settings, so change it in the panel.

The manual path

Use the manual path to pin a different version or to see what the template set up.

1. Create a managed Postgres database

Create a database box on Ownkube. Boxes start at $4 a month, plus storage at $0.25 per GB per month. Copy its connection string, which starts with postgresql://.

2. Deploy the image

Create a web app from ghcr.io/open-webui/open-webui with the version tag you want. The container listens on port 8080. Attach a persistent volume at /app/backend/data, where Open WebUI keeps uploads and its local vector store.

3. Set the environment variables

Terminal window
DATABASE_URL=postgresql://<user>:<password>@<host>:5432/<database>
WEBUI_SECRET_KEY=<a-long-random-string>
# Optional: preset a provider instead of adding it in the admin panel
OPENAI_API_BASE_URL=https://api.openai.com/v1
OPENAI_API_KEY=<your-key>
OLLAMA_BASE_URL=http://<your-ollama-host>:11434

Store the API key as a secret with okctl vars set <app> OPENAI_API_KEY --secret. okctl prompts for the value, so it never lands in your shell history.

4. Wait for the readiness check

The first boot takes longer than most apps because Open WebUI downloads and loads its embedding model. The template allows for that with a long readiness window on /health, and you should do the same on a manual deploy.

The docker compose equivalent

If you’re comparing this with an Open WebUI docker compose install on a VPS, here’s the same setup as a compose file. The postgres service becomes the managed database box and the open-webui service becomes the web deployment. The ownkube.app hostname replaces the reverse proxy, the TLS certificate and the DNS record.

services:
postgres:
image: postgres:17
environment:
POSTGRES_DB: openwebui
POSTGRES_USER: openwebui
POSTGRES_PASSWORD: change-me
volumes:
- pgdata:/var/lib/postgresql/data
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
environment:
DATABASE_URL: postgresql://openwebui:change-me@postgres:5432/openwebui
WEBUI_SECRET_KEY: change-me-too
volumes:
- open-webui:/app/backend/data
depends_on:
- postgres
volumes:
pgdata:
open-webui:

On a VPS the compose file leaves you to set up the reverse proxy, the certificate, Postgres backups, OS updates and restarts after a reboot. On Ownkube the hostname comes with its certificate and backups are a switch on the database. We run the servers underneath.

Sizing the deployment

We set the template to ask for 1 GiB of memory and allow up to 2 GiB. The embedding model accounts for most of that, and it stays loaded whether one person chats or ten.

A team that chats during working hours fits metered pricing, billed per minute. If you want a flat price, Spark 2 (1 GiB, $10 a month) is the floor, and Spark 3 (2 GiB, $19 a month) matches the template’s ceiling. Spark 3 and up need the Personal or Team plan.

Add the smallest database box at $4 a month and 5 GB of storage at $1.25. On Spark 3 the total is about $24 a month, plus whatever your model provider charges for tokens.

If a client wants the install inside their own AWS account, the same app moves there with no rewrite, and logs, metrics and health checks come with it.

FAQ

Can I run the model on Ownkube too?

Ownkube Compute boxes are CPU and memory, with no GPUs, so Open WebUI on Ownkube connects to a model elsewhere. That can be a hosted API or an Ollama server on a GPU machine you own. Open WebUI only needs a URL it can reach.

Does Open WebUI need Postgres, or does SQLite work?

Open WebUI uses SQLite on its data volume when DATABASE_URL is unset. That’s fine for one person. Postgres is the better home once a team shares the install, and it lets you turn on database backups.

Who becomes the admin?

The first account to sign up. Finish setup right after the deploy, then decide whether later sign-ups stay pending or registration closes from the admin panel.

Where do my chats live?

In the Postgres database the template created. Uploaded documents live on the app’s volume. On the Personal and Team plans you can turn on 7-day backups with point-in-time restore for the database.

How do I update Open WebUI?

Change the image tag on the deployment and redeploy. Open WebUI migrates its database schema on start. Pin a version so an upgrade is a step you take on purpose and can roll back.

Is Open WebUI open source?

Open WebUI publishes its source on GitHub under its own license, which carries branding conditions. Read the license in the repository before you rebrand the interface for a client.

Where Ownkube fits

A team chat over the models you already pay for needs a database, a volume, HTTPS and a box with enough memory. Ownkube Compute gives you each of those, and you never set up a cloud account. Deploy the template, sign in as the admin and add your model connection. See Ownkube pricing for the per-minute wallet model, from $5 a month. Deploy my first app.

Abhishek Jaiswal · Founder and Engineer

Abhishek Jaiswal is the founder and engineer behind Ownkube, a cloud for personal software. He builds the platform and writes here about cloud cost, migrations, and running production infrastructure in your own AWS account without a DevOps team.

Share