Docker Deployment

    Deploy ActiveRabbit using Docker containers.

    Docker is the recommended way to deploy ActiveRabbit. This guide covers Docker Compose setup, Kubernetes deployment, and container optimization.

    Docker Compose

    Quick Start

    # Create a new directory
    mkdir activerabbit && cd activerabbit
    
    # Download docker-compose.yml
    curl -O https://raw.githubusercontent.com/activerabbit-ai/activerabbit/main/docker-compose.yml
    
    # Download environment template
    curl -O https://raw.githubusercontent.com/activerabbit-ai/activerabbit/main/.env.example
    mv .env.example .env
    
    # Generate secret key
    echo "SECRET_KEY_BASE=$(openssl rand -hex 64)" >> .env
    
    # Start services
    docker compose up -d

    docker-compose.yml

    version: '3.8'
    
    services:
      web:
        image: ghcr.io/activerabbit-ai/activerabbit:latest
        ports:
          - "3000:3000"
        environment:
          - DATABASE_URL=postgres://postgres:postgres@db:5432/activerabbit
          - REDIS_URL=redis://redis:6379/0
          - SECRET_KEY_BASE=${SECRET_KEY_BASE}
          - RAILS_ENV=production
        depends_on:
          db:
            condition: service_healthy
          redis:
            condition: service_started
        healthcheck:
          test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
          interval: 30s
          timeout: 10s
          retries: 3
    
      worker:
        image: ghcr.io/activerabbit-ai/activerabbit:latest
        command: bundle exec sidekiq
        environment:
          - DATABASE_URL=postgres://postgres:postgres@db:5432/activerabbit
          - REDIS_URL=redis://redis:6379/0
          - SECRET_KEY_BASE=${SECRET_KEY_BASE}
          - RAILS_ENV=production
        depends_on:
          - db
          - redis
    
      db:
        image: postgres:15-alpine
        volumes:
          - postgres_data:/var/lib/postgresql/data
        environment:
          - POSTGRES_DB=activerabbit
          - POSTGRES_USER=postgres
          - POSTGRES_PASSWORD=postgres
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -U postgres"]
          interval: 10s
          timeout: 5s
          retries: 5
    
      redis:
        image: redis:7-alpine
        volumes:
          - redis_data:/data
        command: redis-server --appendonly yes
    
    volumes:
      postgres_data:
      redis_data:

    Production Configuration

    # docker-compose.prod.yml
    version: '3.8'
    
    services:
      web:
        image: ghcr.io/activerabbit-ai/activerabbit:latest
        deploy:
          replicas: 3
          resources:
            limits:
              cpus: '1'
              memory: 1G
            reservations:
              cpus: '0.5'
              memory: 512M
          restart_policy:
            condition: on-failure
            max_attempts: 3
        environment:
          - RAILS_MAX_THREADS=5
          - WEB_CONCURRENCY=2
    
      worker:
        deploy:
          replicas: 2
          resources:
            limits:
              cpus: '0.5'
              memory: 512M
    
      db:
        deploy:
          resources:
            limits:
              cpus: '2'
              memory: 2G
        command: >
          postgres
          -c shared_buffers=256MB
          -c effective_cache_size=1GB
          -c max_connections=200

    Kubernetes

    Helm Chart

    # Add the ActiveRabbit Helm repository
    helm repo add activerabbit https://charts.activerabbit.ai
    helm repo update
    
    # Install with default values
    helm install activerabbit activerabbit/activerabbit
    
    # Install with custom values
    helm install activerabbit activerabbit/activerabbit \
      --set ingress.enabled=true \
      --set ingress.host=activerabbit.yourdomain.com \
      --set postgresql.enabled=false \
      --set externalDatabase.host=your-db-host \
      --set externalDatabase.password=your-password

    values.yaml

    # Custom Helm values
    replicaCount: 3
    
    image:
      repository: ghcr.io/activerabbit-ai/activerabbit
      tag: latest
      pullPolicy: IfNotPresent
    
    ingress:
      enabled: true
      className: nginx
      annotations:
        cert-manager.io/cluster-issuer: letsencrypt-prod
      hosts:
        - host: activerabbit.yourdomain.com
          paths:
            - path: /
              pathType: Prefix
      tls:
        - secretName: activerabbit-tls
          hosts:
            - activerabbit.yourdomain.com
    
    resources:
      limits:
        cpu: 1000m
        memory: 1Gi
      requests:
        cpu: 500m
        memory: 512Mi
    
    postgresql:
      enabled: true
      auth:
        database: activerabbit
        postgresPassword: changeme
    
    redis:
      enabled: true
      architecture: standalone
    
    workers:
      replicaCount: 2
      resources:
        limits:
          cpu: 500m
          memory: 512Mi

    Kubernetes Manifests

    # deployment.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: activerabbit-web
    spec:
      replicas: 3
      selector:
        matchLabels:
          app: activerabbit
          component: web
      template:
        metadata:
          labels:
            app: activerabbit
            component: web
        spec:
          containers:
            - name: web
              image: ghcr.io/activerabbit-ai/activerabbit:latest
              ports:
                - containerPort: 3000
              envFrom:
                - secretRef:
                    name: activerabbit-secrets
                - configMapRef:
                    name: activerabbit-config
              readinessProbe:
                httpGet:
                  path: /health
                  port: 3000
                initialDelaySeconds: 10
                periodSeconds: 5
              livenessProbe:
                httpGet:
                  path: /health
                  port: 3000
                initialDelaySeconds: 30
                periodSeconds: 10
              resources:
                limits:
                  cpu: "1"
                  memory: 1Gi
                requests:
                  cpu: "500m"
                  memory: 512Mi

    Container Registry

    Official images are available on GitHub Container Registry:

    # Latest stable release
    docker pull ghcr.io/activerabbit-ai/activerabbit:latest
    
    # Specific version
    docker pull ghcr.io/activerabbit-ai/activerabbit:1.5.0
    
    # Development build
    docker pull ghcr.io/activerabbit-ai/activerabbit:main

    Building from Source

    # Dockerfile
    FROM ruby:3.2-slim
    
    RUN apt-get update && apt-get install -y \
        build-essential \
        libpq-dev \
        nodejs \
        npm \
        && rm -rf /var/lib/apt/lists/*
    
    WORKDIR /app
    
    COPY Gemfile Gemfile.lock ./
    RUN bundle install --deployment --without development test
    
    COPY . .
    RUN bundle exec rails assets:precompile
    
    EXPOSE 3000
    
    CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
    # Build the image
    docker build -t activerabbit:custom .
    
    # Run locally
    docker run -p 3000:3000 \
      -e DATABASE_URL=postgres://... \
      -e REDIS_URL=redis://... \
      -e SECRET_KEY_BASE=... \
      activerabbit:custom

    Environment Variables

    VariableRequiredDescription
    DATABASE_URLYesPostgreSQL connection string
    REDIS_URLYesRedis connection string
    SECRET_KEY_BASEYesRails secret key (64+ hex chars)
    RAILS_ENVNoEnvironment (default: production)
    WEB_CONCURRENCYNoPuma workers (default: 2)
    RAILS_MAX_THREADSNoThreads per worker (default: 5)

    Health Checks

    # Check all services
    curl http://localhost:3000/health
    # {"status":"ok","database":"connected","redis":"connected"}
    
    # Readiness (for Kubernetes)
    curl http://localhost:3000/health/ready
    
    # Liveness
    curl http://localhost:3000/health/live

    Logging

    # View logs
    docker compose logs -f web
    
    # JSON structured logging (for log aggregation)
    docker compose logs -f web | jq
    
    # Log to external service
    docker compose logs -f | \
      somelogger --token=xxx

    🐳 Docker Tips

    • Use named volumes for persistent data
    • Set resource limits in production
    • Use health checks for orchestration
    • Pin image versions in production