---
title: "Deploy DB-GPT Data Agent + Auth Gateway"
description: "DB-GPT data agent: chat with SQL and docs, private behind a login gateway"
category: "AI/ML"
url: https://railway.com/deploy/db-gpt-data-agent-auth-gateway
---

# Deploy DB-GPT Data Agent + Auth Gateway

DB-GPT data agent: chat with SQL and docs, private behind a login gateway

**[Deploy DB-GPT Data Agent + Auth Gateway on Railway](https://railway.com/template/db-gpt-data-agent-auth-gateway)**

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

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

## Template content

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

- **Image:** caddy:2.11-alpine
- **Start command:** `sh -c 'echo c2V0IC1lCjogIiR7UE9SVDo/UE9SVCBpcyByZXF1aXJlZH0iCjogIiR7VUlfVVNFUk5BTUU6P1VJX1VTRVJOQU1FIGlzIHJlcXVpcmVkfSIKOiAiJHtVSV9QQVNTV09SRDo/VUlfUEFTU1dPUkQgaXMgcmVxdWlyZWR9Igo6ICIke1VQU1RSRUFNOj9VUFNUUkVBTSBpcyByZXF1aXJlZH0iCkhBU0g9IiQoY2FkZHkgaGFzaC1wYXNzd29yZCAtLXBsYWludGV4dCAiJFVJX1BBU1NXT1JEIikiCnByaW50ZiAnJXNcbicgXAogICd7JyBcCiAgJyAgYXV0b19odHRwcyBvZmYnIFwKICAnICBhZG1pbiBvZmYnIFwKICAnICBzZXJ2ZXJzIHsnIFwKICAnICAgIHByb3RvY29scyBoMSBoMmMnIFwKICAnICB9JyBcCiAgJ30nIFwKICAiOiRQT1JUIHsiIFwKICAnICBAY3Jvc3NzaXRlIHsnIFwKICAnICAgIGhlYWRlciBTZWMtRmV0Y2gtU2l0ZSBjcm9zcy1zaXRlJyBcCiAgJyAgICBub3QgeycgXAogICcgICAgICBtZXRob2QgR0VUIEhFQUQnIFwKICAnICAgICAgaGVhZGVyIFNlYy1GZXRjaC1Nb2RlIG5hdmlnYXRlJyBcCiAgJyAgICB9JyBcCiAgJyAgfScgXAogICcgIGhhbmRsZSAvZ2F0ZXdheS1oZWFsdGggeycgXAogICcgICAgcmVzcG9uZCAib2siIDIwMCcgXAogICcgIH0nIFwKICAnICBoYW5kbGUgeycgXAogICcgICAgcmVzcG9uZCBAY3Jvc3NzaXRlICJjcm9zcy1zaXRlIHJlcXVlc3QgYmxvY2tlZCIgNDAzJyBcCiAgJyAgICBiYXNpY19hdXRoIHsnIFwKICAiICAgICAgJFVJX1VTRVJOQU1FICRIQVNIIiBcCiAgJyAgICB9JyBcCiAgIiAgICByZXZlcnNlX3Byb3h5ICRVUFNUUkVBTSIgXAogICcgIH0nIFwKICAnfScgPiAvZXRjL2NhZGR5L0NhZGR5ZmlsZQpleGVjIGNhZGR5IHJ1biAtLWNvbmZpZyAvZXRjL2NhZGR5L0NhZGR5ZmlsZSAtLWFkYXB0ZXIgY2FkZHlmaWxlCg== | base64 -d > /tmp/start.sh && exec sh /tmp/start.sh'`
- **Health check:** /gateway-health
- **Public domain:** Yes

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

- **Image:** eosphorosai/dbgpt-openai:v0.8.2
- **Start command:** `sh -c 'echo c2V0IC1lCjogIiR7UE9SVDo/UE9SVCBpcyByZXF1aXJlZH0iCjogIiR7T1BFTkFJX0FQSV9LRVk6P09QRU5BSV9BUElfS0VZIGlzIHJlcXVpcmVkIChhbnkgT3BlbkFJIGNvbXBhdGlibGUga2V5LCBzZWUgT1BFTkFJX0FQSV9CQVNFKX0iCjogIiR7REJHUFRfRU5DUllQVF9LRVk6P0RCR1BUX0VOQ1JZUFRfS0VZIGlzIHJlcXVpcmVkfSIKY2FzZSAiJFBPUlQiIGluICcnfCpbITAtOV0qKSBlY2hvICJQT1JUIG11c3QgYmUgYSBudW1iZXIsIGdvdDogJFBPUlQiID4mMjsgZXhpdCA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RfcGF0aCA9ICJwaWxvdC9kYXRhIgoKW21vZGVsc10KW1ttb2RlbHMubGxtc11dCm5hbWUgPSAiJHtlbnY6TExNX01PREVMX05BTUU6LWdwdC00b30iCnByb3ZpZGVyID0gIiR7ZW52OkxMTV9NT0RFTF9QUk9WSURFUjotcHJveHkvb3BlbmFpfSIKYXBpX2Jhc2UgPSAiJHtlbnY6T1BFTkFJX0FQSV9CQVNFOi1odHRwczovL2FwaS5vcGVuYWkuY29tL3YxfSIKYXBpX2tleSA9ICIke2VudjpPUEVOQUlfQVBJX0tFWX0iCgpbW21vZGVscy5lbWJlZGRpbmdzXV0KbmFtZSA9ICIke2VudjpFTUJFRERJTkdfTU9ERUxfTkFNRTotdGV4dC1lbWJlZGRpbmctMy1zbWFsbH0iCnByb3ZpZGVyID0gIiR7ZW52OkVNQkVERElOR19NT0RFTF9QUk9WSURFUjotcHJveHkvb3BlbmFpfSIKYXBpX3VybCA9ICIke2VudjpFTUJFRERJTkdfTU9ERUxfQVBJX1VSTDotaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MS9lbWJlZGRpbmdzfSIKYXBpX2tleSA9ICIke2VudjpPUEVOQUlfQVBJX0tFWX0iCkVPRgpzZWQgLWkgInMvX19QT1JUX18vJFBPUlQvIiAvYXBwL2NvbmZpZ3MvZGJncHQtcmFpbHdheS50b21sCmV4ZWMgZGJncHQgc3RhcnQgd2Vic2VydmVyIC0tY29uZmlnIC9hcHAvY29uZmlncy9kYmdwdC1yYWlsd2F5LnRvbWwK | base64 -d > /tmp/start.sh && exec sh /tmp/start.sh'`
- **Health check:** /api/v1/chat/dialogue/health

## Documentation

# 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

- [DB-GPT Docker deployment guide](http://docs.dbgpt.cn/docs/installation/docker)
- [DB-GPT GitHub repository](https://github.com/eosphoros-ai/DB-GPT)

### 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

1. Open the **DB-GPT Gateway** public URL
2. Log in with `UI_USERNAME` (default `admin`) and `UI_PASSWORD`, both on the gateway's Variables tab
3. Try Chat Data against the preloaded `Walmart_Sales` database
4. 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_ORIGINS` on 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.


## 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 v0.1 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-data-agent-auth-gateway
