---
title: "Deploy DocsGPT RAG Assistant + pgvector"
description: "Private AI assistant for your docs: agents, pgvector search, S3 storage"
category: "AI/ML"
url: https://railway.com/deploy/docsgpt-rag-assistant-pgvector
---

# Deploy DocsGPT RAG Assistant + pgvector

Private AI assistant for your docs: agents, pgvector search, S3 storage

**[Deploy DocsGPT RAG Assistant + pgvector on Railway](https://railway.com/template/docsgpt-rag-assistant-pgvector)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/docsgpt-rag-assistant-pgvector/manifest.json

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

## Template content

### Postgres https://avatars.githubusercontent.com/u/177543?v=4

- **Image:** pgvector/pgvector:pg17
- **Start command:** `docker-entrypoint.sh postgres -c "listen_addresses=*"`

### Storage https://avatars.githubusercontent.com/u/6293622?v=4

- **Image:** versity/versitygw:v1.8.0
- **Start command:** `sh -c 'mkdir -p /data/docsgpt && exec versitygw --quiet --port :9000 --health /health posix /data'`
- **Health check:** /health

### DocsGPT https://raw.githubusercontent.com/arc53/DocsGPT/1.1.0/frontend/public/web-app-manifest-512x512.png

- **Image:** arc53/docsgpt:1.1.0
- **Start command:** `gunicorn -w 1 -k docsgpt.gunicorn_worker.BoundedDrainUvicornWorker --bind [::]:7091 --timeout 180 --graceful-timeout 120 --keep-alive 5 --worker-tmp-dir /dev/shm --max-requests 5000 --max-requests-jitter 500 --config docsgpt/gunicorn_conf.py docsgpt.asgi:asgi_app`
- **Health check:** /api/health
- **Public domain:** Yes

### Redis https://avatars.githubusercontent.com/u/1529926?v=4

- **Image:** redis:7-alpine
- **Start command:** `sh -c 'docker-entrypoint.sh redis-server --requirepass "$REDIS_PASSWORD" --save 60 1 --dir /data --bind :: 0.0.0.0'`

### Worker https://raw.githubusercontent.com/arc53/DocsGPT/1.1.0/frontend/public/web-app-manifest-512x512.png

- **Image:** arc53/docsgpt:1.1.0
- **Start command:** `celery -A docsgpt.app.celery worker -l INFO -B -c 2 -Q docsgpt,parsing,embeddings,ingest,analytics`

## Documentation

# Deploy and Host DocsGPT on Railway

DocsGPT is an open source AI assistant that answers from your own documents. Upload files or crawl websites, chat with cited answers, build agents with tools and schedules, and expose them through a chat widget or an OpenAI compatible API.

## About Hosting DocsGPT

Hosting DocsGPT means running its API, a background worker, PostgreSQL and Redis together. This template deploys the official `arc53/docsgpt:1.1.0` image twice (web UI plus API, and the Celery worker), a pgvector PostgreSQL for user data and embeddings, Redis for the task queue, and a private S3 storage service for uploaded files. Upstream ships with no sign-in, so this template turns on token access: every API call needs one generated access token. Embedding models are baked into the image and the default model is the hosted DocsGPT model, so the stack works with zero API keys.

**Plan requirement:** deploy on the Railway Hobby plan or higher. The worker runs the embedding model and needs about 1.5 GB of RAM while it ingests documents. The Trial limit of 1 GB per service is not enough.

## What's Included

- **DocsGPT**: web UI and REST API on one public domain, healthcheck on `/api/health`
- **Worker**: Celery worker and scheduler for ingestion, parsing, embeddings and scheduled agents (private)
- **Postgres**: `pgvector/pgvector:pg17` with a volume, holds users' data and vectors
- **Redis**: `redis:7-alpine` with a password and a volume (private)
- **Storage**: S3 compatible file store with a volume (private), shared by the API and the worker

## First Steps After Deploy

1. Wait until all five services are green.
2. Open the DocsGPT service, open the latest deploy logs and search for `Generated Simple JWT Token`. Copy the token.
3. Open the DocsGPT domain and paste the token when the page asks for it.
4. Add a source (upload a file or add a website), wait for it to finish, then ask a question.
5. Optional: set `LLM_PROVIDER` and `API_KEY` on the DocsGPT service to use your own OpenAI, Anthropic, Google, Groq or OpenRouter model, then redeploy DocsGPT and Worker.

## Common Use Cases

- **Documentation assistant**: answers with citations from product docs, wikis and PDFs
- **Internal knowledge search**: one private place to query team documents
- **Support widget**: embed the chat widget on a site, backed by your own sources
- **Agents**: agents with tools, webhooks and schedules that use your sources
- **OpenAI compatible endpoint**: call an agent from existing clients through `/v1/chat/completions` with an agent API key

## Dependencies for DocsGPT Hosting

- **Railway Hobby plan or higher**: the worker needs more than 1 GB of RAM during ingestion
- **PostgreSQL with pgvector**: included
- **Redis**: included
- **S3 compatible storage**: included
- **LLM provider key**: optional, the hosted DocsGPT model works without one

### Deployment Dependencies

- [DocsGPT Docker deployment guide](https://docs.docsgpt.cloud/Deploying/Docker-Deploying)
- [DocsGPT settings](https://docs.docsgpt.cloud/Deploying/DocsGPT-Settings)
- [DocsGPT security checklist](https://docs.docsgpt.cloud/Deploying/Security)
- [DocsGPT GitHub repository](https://github.com/arc53/DocsGPT)

### Implementation Details

The API and the worker cannot share a disk on Railway, so files go to the bundled S3 service and vectors go to pgvector. Key variables on the DocsGPT service:

```env
PORT=7091
AUTH_TYPE=simple_jwt
JWT_SECRET_KEY=${{secret(64)}}
INTERNAL_KEY=${{secret(48)}}
ENCRYPTION_SECRET_KEY=${{secret(64)}}
API_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
POSTGRES_URI=${{Postgres.DATABASE_URL}}
VECTOR_STORE=pgvector
STORAGE_TYPE=s3
S3_ENDPOINT_URL=http://${{Storage.RAILWAY_PRIVATE_DOMAIN}}:9000
CELERY_BROKER_URL=redis://default:${{Redis.REDIS_PASSWORD}}@${{Redis.RAILWAY_PRIVATE_DOMAIN}}:6379/0
LLM_PROVIDER=docsgpt
```

The access token is one shared credential: everyone who holds it is the same user. Change `JWT_SECRET_KEY` to revoke it. For one account per person, set `AUTH_TYPE=oidc` with `OIDC_ISSUER`, `OIDC_CLIENT_ID` and `OIDC_FRONTEND_URL` on DocsGPT and Worker. Do not replace `ENCRYPTION_SECRET_KEY` after you connect services, or stored credentials become unreadable. Update `API_URL` when you add a custom domain. The worker sends an upstream version check to `gptcloud.arc53.com`; set `VERSION_CHECK=false` on the Worker to turn it off.

## Why Deploy DocsGPT 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 DocsGPT on Railway, you get a private document assistant with PostgreSQL, Redis, file storage, generated secrets, health checks, managed SSL and private networking between services.


## 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/docsgpt-rag-assistant-pgvector
