Why Railway?
| Feature | Benefit |
|---|---|
| Managed PostgreSQL | No database server management |
| Managed Redis | Built-in caching and queues |
| Easy scaling | Add resources with one click |
| GitHub integration | Auto-deploy on push |
| Free tier | For development and testing |
Prerequisites
- Railway account (railway.app)
- GitHub repository with your Consuelo project
- Twilio credentials
- AI provider API key (Groq or OpenAI)
Create Railway Project
Via CLI
Via Dashboard
- Go to railway.app/dashboard
- Click New Project
- Select Deploy from GitHub repo
- Choose your repository
Add Services
Railway needs three services:PostgreSQL
- Click Add Service
- Select Database
- Choose PostgreSQL
Redis
- Click Add Service
- Select Database
- Choose Redis
Application
Your main application is added automatically when you connect the repo.Configure Environment Variables
Required Variables
Add these in the Railway dashboard (Variables tab):Database URLs
Railway automatically provides:DATABASE_URL— PostgreSQL connection (auto-set)REDIS_URL— Redis connection (auto-set)
Deploy
First Deploy
Monitor Deployment
Watch the build logs:Worker Service
Consuelo uses a background worker for queues and jobs.Add Worker Service
Configure Worker
Set the start command in Railway dashboard:- Go to Worker service → Settings
- Set Start Command to:
The worker uses the same Dockerfile as the main service but with a different
start command.
Custom Domain
Add Domain
- Go to Settings → Domains
- Click Custom Domain
- Enter your domain (e.g.,
consuelo.yourcompany.com) - Add the displayed DNS records to your domain
Update CORS
Add your domain to allowed origins:Environment-Specific Deployments
Staging
Create a separate environment:Production
Troubleshooting
Build Fails
Check build logs:- Missing
package.json— Ensure repo root has package.json - Wrong Node version — Add
enginesto package.json - Dependency errors — Run
yarn installlocally first
Database Connection Fails
VerifyDATABASE_URL is set:
DATABASE_URL=postgresql://...
Worker Not Starting
Check worker logs:Redis Connection Fails
Verify Redis is running:Monitoring
View Logs
Metrics
In the Railway dashboard:- Go to your service
- Click Metrics tab
- View CPU, memory, and request metrics
Costs
Railway pricing (as of 2024):| Tier | Cost | Usage |
|---|---|---|
| Free | $0 | 500 hours/month, 1GB disk |
| Hobby | $5/month | More resources |
| Pro | $20/month | Production workloads |
Consuelo typically uses ~1GB memory and ~1GB disk for small deployments.
Monitor usage in the dashboard.
Next Steps
- Configuration — Set up environment variables
- Deployment — Other deployment options
- CLI FAQ — Common deployment questions