Deployment

Deploy RA-OS to your own server

Deployment

RA-OS can be deployed to various platforms. This guide covers common deployment scenarios.

Local Production Build

For running a production build locally:

# Build the application
npm run build

# Start the production server
npm start

The app will be available at http://localhost:3000.

Self-Hosted Server

Using PM2

PM2 is a process manager that keeps your app running:

# Install PM2 globally
npm install -g pm2

# Build the application
npm run build

# Start with PM2
pm2 start npm --name "ra-os" -- start

# Save the process list
pm2 save

# Set up startup script
pm2 startup

Using Docker

Create a Dockerfile in the project root:

FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .
RUN npm run build

EXPOSE 3000

CMD ["npm", "start"]

Build and run:

docker build -t ra-os .
docker run -d -p 3000:3000 \
  -e OPENAI_API_KEY=sk-... \
  -v ~/rah-data:/root/Library/Application\ Support/RA-H \
  ra-os

Using Docker Compose

Create a docker-compose.yml:

version: '3.8'

services:
  ra-os:
    build: .
    ports:
      - "3000:3000"
    environment:
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
    volumes:
      - rah-data:/root/Library/Application Support/RA-H
    restart: unless-stopped

volumes:
  rah-data:

Run with:

docker-compose up -d

Cloud Platforms

Vercel

RA-OS can be deployed to Vercel, but note that the SQLite database won't persist between deployments. For Vercel, you'd need to:

  1. Use a cloud database (Turso, PlanetScale, etc.)
  2. Modify the database layer to use the cloud provider

This is an advanced configuration not covered in this guide.

Railway / Render

These platforms support persistent storage and are better suited for RA-OS:

  1. Connect your GitHub repository
  2. Set environment variables in the dashboard
  3. Deploy

The database will persist in the platform's storage.

Reverse Proxy with Nginx

If you're running RA-OS behind Nginx:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

SSL with Let's Encrypt

For HTTPS, use Certbot:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com

Data Backup

The entire knowledge graph is stored in a single SQLite file. To backup:

# Copy the database file
cp ~/Library/Application\ Support/RA-H/rah.sqlite ~/backups/rah-$(date +%Y%m%d).sqlite

Next Steps