
Deploy DB-GPT Data Agent + Auth Gateway
DB-GPT data agent: chat with SQL and docs, private behind a login gateway
DB-GPT Gateway
Just deployed
Just deployed
Deploy and Host DB-GPT on Railway
DB-GPT is an open source AI native data app framework. Ask questions about your databases in plain language and get SQL, charts and answers back, analyze Excel and CSV files, build knowledge bases for RAG, generate dashboards, and run multi agent data analysis and AWEL workflows. This template runs it against any OpenAI compatible API, with no GPU needed.
About Hosting DB-GPT
DB-GPT has no built in login: every visitor is treated as an admin, and the app can run SQL against connected databases and execute agent generated code. This template therefore never exposes it directly. The DB-GPT service runs on Railway's private network only, and a small Caddy gateway is the single public entry point, protected by a generated username and password and a cross site request guard. DB-GPT uses the official no GPU image eosphorosai/dbgpt-openai:v0.8.2, stores its metadata in SQLite and its vectors in embedded Chroma, both on one persistent volume, and keeps its database migrations on that same volume so redeploys and upgrades are safe.
Common Use Cases
- Chat with your database: connect MySQL, PostgreSQL, ClickHouse, DuckDB or SQLite and ask questions in natural language (Text2SQL)
- Spreadsheet analysis: upload Excel or CSV files and explore them conversationally
- Knowledge base Q&A: index documents and URLs for retrieval augmented answers
- Generative dashboards and data agents: let agents plan an analysis, write the SQL and render the charts
Dependencies for DB-GPT Hosting
- An OpenAI compatible API key: required, used for both chat and embeddings. OpenAI is the default; OpenRouter, DeepSeek, a LiteLLM proxy and other compatible endpoints work by changing the base URL and model names
- Your own databases: optional, added from the UI. An example Walmart sales database is preloaded
Deployment Dependencies
Implementation Details
| Service | Image | Public | Volume |
|---|---|---|---|
| DB-GPT Gateway | caddy:2.11-alpine | yes | none |
| DB-GPT | eosphorosai/dbgpt-openai:v0.8.2 | no | /app/pilot/data |
First Steps After Deploy
- Open the DB-GPT Gateway public URL
- Log in with
UI_USERNAME(defaultadmin) andUI_PASSWORD, both on the gateway's Variables tab - Try Chat Data against the preloaded
Walmart_Salesdatabase - Add your own data sources and knowledge bases
Key Environment Variables
| Variable | Service | Purpose |
|---|---|---|
OPENAI_API_KEY | DB-GPT | Required LLM and embeddings key |
OPENAI_API_BASE | DB-GPT | OpenAI compatible chat endpoint |
LLM_MODEL_NAME | DB-GPT | Chat model, default gpt-4o |
EMBEDDING_MODEL_NAME / EMBEDDING_MODEL_API_URL | DB-GPT | Embedding model and full endpoint URL |
DBGPT_ENCRYPT_KEY | DB-GPT | Generated; encrypts stored secrets, never rotate |
UI_USERNAME / UI_PASSWORD | DB-GPT Gateway | Login for the whole app |
Notes
- Single tenant: anyone with the gateway password has full admin access
- The Hobby plan or higher is recommended; the Free plan's 0.5 GB of RAM is likely too small
- Custom domain: attach it to the gateway and add it to
DBGPT_CORS_ALLOWED_ORIGINSon the DB-GPT service
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.
Template Content
DB-GPT Gateway
caddy:2.11-alpineOPENAI_API_KEY
Required. API key for the chat model and the embedding model. Any OpenAI compatible provider works: set OPENAI_API_BASE, EMBEDDING_MODEL_API_URL and the model names to match it. The service refuses to start without it.


