
Deploy DB-GPT
Chat with your databases and files using AI. MySQL and login included
MySQL
Just deployed
/var/lib/mysql
Just deployed
Just deployed
/data
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&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 and its v0.8.3 release
- DB-GPT Docker deployment docs
- Official image
eosphorosai/dbgpt-openai - Template source: 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
- Open the Gateway service's public URL.
- Log in with
GATEWAY_USERNAME(defaultadmin) andGATEWAY_PASSWORD(generated), both on the Gateway's Variables tab. - Try Chat Data against the preloaded
Walmart_Salesexample 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_ORIGINSon 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.mdfirst; 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.
Template Content
MySQL
mysql:8OPENAI_API_KEY
Required: your OpenAI-compatible API key, used for chat and embeddings

