---
title: "Deploy DB-GPT"
description: "Chat with your databases and files using AI. MySQL and login included"
category: "AI/ML"
url: https://railway.com/deploy/db-gpt
---

# Deploy DB-GPT

Chat with your databases and files using AI. MySQL and login included

**[Deploy DB-GPT on Railway](https://railway.com/template/db-gpt)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/db-gpt/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** mysql:8
- **Start command:** `docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G`

### Gateway https://raw.githubusercontent.com/eosphoros-ai/DB-GPT/v0.8.3/assets/LOGO_SMALL.png

- **Source:** https://github.com/aalfath/db-gpt-railway-template
- **Health check:** /healthz
- **Public domain:** Yes

### DB-GPT https://raw.githubusercontent.com/eosphoros-ai/DB-GPT/v0.8.3/assets/LOGO_SMALL.png

- **Source:** https://github.com/aalfath/db-gpt-railway-template
- **Health check:** /api/v2/serve/model/health

## Documentation

# Deploy and Host DB-GPT on Railway

DB-GPT is an open-source (MIT) AI data assistant from the eosphoros-ai project. You ask questions about your databases, spreadsheets and documents in plain language and get SQL, charts, reports and answers back. It also has knowledge bases for retrieval-augmented answers, data agents and AWEL workflows. It runs against any OpenAI-compatible model API, with no GPU.

## About Hosting DB-GPT

This template runs DB-GPT 0.8.3 as three services on Railway's private network. Upstream's Docker setup pairs the webserver with MySQL but leaves the schema as a manual step, and DB-GPT has no login of its own. Here the start script creates and upgrades the MySQL schema on every boot, a Caddy gateway puts a generated username and password in front of the app, and every piece of state sits on a volume or in MySQL. The only thing you supply is an OpenAI-compatible API key. Each app service builds from a public GitHub repo pinned to an official image digest, so version bumps reach you as Railway update notices.

## Common Use Cases

* Chat with your database: connect MySQL, PostgreSQL, ClickHouse, DuckDB, SQLite and others, and ask questions in natural language (Text2SQL)
* Analyse Excel and CSV files and generate charts, dashboards and reports with data agents
* Build knowledge bases from documents and URLs for retrieval-augmented Q&amp;A

## Dependencies for DB-GPT Hosting

* An OpenAI-compatible API key (OpenAI by default; OpenRouter, DeepSeek, SiliconFlow, a LiteLLM proxy and others work by changing the base URL and model names)
* MySQL for DB-GPT's metadata (included), and a volume for vectors and files (included)

### Deployment Dependencies

* [DB-GPT on GitHub](https://github.com/eosphoros-ai/DB-GPT) and its [v0.8.3 release](https://github.com/eosphoros-ai/DB-GPT/releases/tag/v0.8.3)
* [DB-GPT Docker deployment docs](https://docs.dbgpt.cn/docs/installation/docker)
* [Official image `eosphorosai/dbgpt-openai`](https://hub.docker.com/r/eosphorosai/dbgpt-openai)
* [Template source: aalfath/db-gpt-railway-template](https://github.com/aalfath/db-gpt-railway-template)

### Implementation Details

| Service | What it does | Public | Storage |
|---|---|---|---|
| **Gateway** | Caddy reverse proxy with basic auth and a cross-site request guard; the only public entry point | yes | none |
| **DB-GPT** | DB-GPT 0.8.3 webserver (`eosphorosai/dbgpt-openai:v0.8.3`, pinned by digest), on the private network only | no | volume at `/data`: Chroma vectors, uploads, chart images, agent workspace, your skills |
| **MySQL** | Railway's MySQL: chats, apps, knowledge spaces, data sources, flows | no | volume at `/var/lib/mysql` |

Start order: MySQL first; the DB-GPT start script waits for it (up to 5 minutes), creates the `dbgpt` database, loads upstream's schema (and adds the tables upstream's SQL file misses), then starts the webserver. On later boots it applies upstream's `upgrade_to_*.sql` files for any newer version. The Gateway shows "DB-GPT is starting up" until the app answers. The first boot takes 1–2 minutes.

**After deploy**

1. Open the **Gateway** service's public URL.
2. Log in with `GATEWAY_USERNAME` (default `admin`) and `GATEWAY_PASSWORD` (generated), both on the Gateway's Variables tab.
3. Try Chat Data against the preloaded `Walmart_Sales` example database, then add your own data sources and knowledge bases.

**Variables you may change** (on the DB-GPT service): `OPENAI_API_KEY` (asked at deploy), `OPENAI_API_BASE` and `LLM_MODEL_NAME` for another provider or model, `EMBEDDING_MODEL_NAME` and `EMBEDDING_MODEL_API_URL` (the full embeddings URL), and the optional `EMBEDDING_MODEL_API_KEY` when embeddings use a different key. `DBGPT_ENCRYPT_KEY` is generated once and encrypts stored credentials: don't change it later.

**Notes**

* Single tenant: anyone with the gateway password has full admin access, including SQL against connected databases.
* A custom domain goes on the Gateway; add it to `DBGPT_CORS_ALLOWED_ORIGINS` on the DB-GPT service too.
* DB-GPT uses about 1.5 GB of RAM: use the Hobby plan or higher.
* Updates: when this template's repo moves to a new DB-GPT release, Railway shows an update notice on your project. Read `CHANGELOG.md` first; the schema upgrade runs on the next boot. Back up the MySQL volume before major upgrades.

## Why Deploy DB-GPT 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 DB-GPT 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.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/db-gpt
