Cloud Deployment
Deploy DBX to various cloud platforms including Railway, Heroku, and other container-based services.
Railway
Railway provides an easy way to deploy DBX with automatic container orchestration.
Important: Architecture Compatibility
Railway runs on AMD64 architecture. If you're deploying from an ARM64 machine (like Apple Silicon Macs), you must use the AMD64-only image tags to avoid "exec format error":
# Use AMD64-only tags for Railway
fnlog0/dbx:latest-amd64-only
fnlog0/dbx:0.1.5-amd64-only
Prerequisites
- Railway account
- Redis instance (Railway provides managed Redis)
Deployment Steps
-
Create a New Project
- Go to Railway Dashboard
- Click "New Project"
- Select "Deploy from Docker Hub"
-
Configure the Service
Image Name:
fnlog0/dbx:latest-amd64-only
Environment Variables:
DATABASE_URL=redis://your-redis-url:6379 DATABASE_TYPE=redis HOST=0.0.0.0 PORT=3000 POOL_SIZE=10 LOG_LEVEL=INFO
-
Add Redis Service (Optional)
- Click "New Service" → "Database" → "Redis"
- Railway will provide the connection URL
- Use that URL in your
DATABASE_URL
environment variable
-
Deploy Click "Deploy" and wait for the build to complete.
Verification
Check the logs to ensure the service started correctly:
# Check Railway logs
railway logs
You should see output like:
🚀 DBX API starting...
🌐 Server listening on port 3000
✅ Connected to Redis
Troubleshooting
Exec Format Error If you see this error:
exec container process `/app/./dbx-api`: Exec format error
Solution: Use the AMD64-only image tag:
- Change from:
fnlog0/dbx:latest
- Change to:
fnlog0/dbx:latest-amd64-only
Heroku
Deploy DBX to Heroku using the container registry:
Prerequisites
- Heroku account
- Heroku CLI installed
- Redis addon (Heroku provides managed Redis)
Deployment Steps
-
Login to Heroku Container Registry
heroku login heroku container:login
-
Create a New App
heroku create your-dbx-app
-
Add Redis Addon
heroku addons:create heroku-redis:mini -a your-dbx-app
-
Deploy with Docker
# Pull and tag the image docker pull fnlog0/dbx:latest docker tag fnlog0/dbx:latest registry.heroku.com/your-dbx-app/web # Push to Heroku docker push registry.heroku.com/your-dbx-app/web # Release the image heroku container:release web -a your-dbx-app
-
Configure Environment Variables
heroku config:set DATABASE_TYPE=redis -a your-dbx-app heroku config:set HOST=0.0.0.0 -a your-dbx-app heroku config:set LOG_LEVEL=INFO -a your-dbx-app
The DATABASE_URL
will be automatically set by the Heroku Redis addon.
Container Platforms
Generic Container Platform
For any container platform that supports Docker:
-
Pull the Image
docker pull fnlog0/dbx:latest
-
Run with Environment Variables
docker run -d --name dbx -p 3000:3000 \ -e DATABASE_URL=redis://your-redis-url:6379 \ -e DATABASE_TYPE=redis \ -e HOST=0.0.0.0 \ -e PORT=3000 \ -e POOL_SIZE=10 \ -e LOG_LEVEL=INFO \ fnlog0/dbx:latest
Docker Swarm
version: '3.8'
services:
dbx:
image: fnlog0/dbx:latest
ports:
- "3000:3000"
environment:
- DATABASE_URL=redis://redis:6379
- DATABASE_TYPE=redis
- HOST=0.0.0.0
- PORT=3000
- POOL_SIZE=10
- LOG_LEVEL=INFO
deploy:
replicas: 3
restart_policy:
condition: on-failure
depends_on:
- redis
redis:
image: redis:7-alpine
deploy:
replicas: 1
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: dbx
spec:
replicas: 3
selector:
matchLabels:
app: dbx
template:
metadata:
labels:
app: dbx
spec:
containers:
- name: dbx
image: fnlog0/dbx:latest
ports:
- containerPort: 3000
env:
- name: DATABASE_URL
value: "redis://redis:6379"
- name: DATABASE_TYPE
value: "redis"
- name: HOST
value: "0.0.0.0"
- name: PORT
value: "3000"
- name: POOL_SIZE
value: "10"
- name: LOG_LEVEL
value: "INFO"
---
apiVersion: v1
kind: Service
metadata:
name: dbx-service
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 3000
selector:
app: dbx
Health Checks
All cloud platforms can use DBX's built-in health endpoints:
- Health Check:
GET /redis/admin/health
- Ping:
GET /redis/admin/ping
- Server Info:
GET /redis/admin/info
Example health check configuration:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/redis/admin/ping"]
interval: 30s
timeout: 10s
retries: 3
Best Practices
- Use managed Redis: Most cloud platforms offer managed Redis services
- Set resource limits: Configure appropriate CPU and memory limits
- Enable health checks: Use DBX's built-in health endpoints
- Monitor logs: Configure log aggregation for troubleshooting
- Use environment variables: Never hardcode configuration values
- Scale horizontally: DBX is stateless and scales well horizontally