Chatwoot + Dify on Railway
Railway turns docker-compose service graphs into one-click cloud deployments — five minutes from GitHub repo to live.
Why Railway#
- GitHub-first — push to deploy
- Visual service graph — every container is a node with dependencies
- Built-in databases — Postgres / Redis one click
- Usage-based pricing — costs near zero when idle, flexible vs fixed VPS
- Low latency — US-East / EU-West / Asia regions
When NOT to use Railway#
-
30k monthly conversations — usage billing exceeds VPS cost
- GPU inference needed — Railway has no GPUs
- China-resident compliance — no mainland China region
Steps#
1. Connect Railway to GitHub#
Sign up → “New Project → Deploy from GitHub repo” → pick your chatwoot/chatwoot fork.
2. Add Postgres + Redis#
Console → Add Service → Database → Postgres / Redis. Railway auto-injects DATABASE_URL and REDIS_URL.
3. Set Chatwoot env#
SECRET_KEY_BASE=$(openssl rand -hex 64)
FRONTEND_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
RAILS_ENV=production
DEFAULT_LOCALE=en
MAILER_SENDER_EMAIL=support@your.com
SMTP_ADDRESS=smtp.postmarkapp.com
SMTP_USERNAME=...
SMTP_PASSWORD=...
${{}} references other services — easier than hand-pasting URLs.
4. Add the Sidekiq worker service#
Duplicate the Chatwoot service, change Start Command to bundle exec sidekiq -C config/sidekiq.yml.
5. Deploy Dify#
New project, add services per Dify’s docker/docker-compose.yaml:
dify-api,dify-worker,dify-web,dify-weaviate
Pull from Docker Hub; Railway auto-detects compose-style config.
6. Custom domain#
Settings → Domains → Custom Domain. Free TLS included.
Cost#
| Resource | Spec | Monthly |
|---|---|---|
| Chatwoot service (512MB) | 24h | ~$5 |
| Sidekiq worker (256MB) | 24h | ~$3 |
| Postgres (1GB) | — | ~$5 |
| Redis (256MB) | — | ~$3 |
| Dify API + Worker + Web | — | ~$15 |
| Weaviate | — | ~$5 |
| Total | ~$36 / mo |
Plus 5k-conversation LLM tokens (DeepSeek): $10-30 → $50-80 total.
Gotchas#
- Sleep mode — free Hobby tier sleeps on idle; cold start 10-30 s. Production needs Pro
- China latency — front with Cloudflare or add a HK hop
- Volume persistence — attachments need a mounted Volume or they disappear on restart
- Build OOM — Chatwoot Rails build needs ≥ 2 GB; set
RAILWAY_DEDICATED_BUILDER=true