Error Tracking Guide

    Deploying Sentry

    Sentry is a powerful, open-source error tracking and performance monitoring platform that helps developers identify, triage, and resolve issues in real-time. Self-host your own instance on RamNode's reliable VPS hosting for complete data control and unlimited events.

    Error Tracking
    Performance Monitoring
    Session Replay
    Multi-Language SDKs
    1

    System Requirements

    Sentry is a resource-intensive application that runs multiple services including PostgreSQL, Redis, Kafka, ClickHouse, and various Python workers.

    ComponentMinimumRecommended
    CPU4 vCPUs8+ vCPUs
    RAM8 GB16+ GB
    Storage40 GB SSD100+ GB NVMe SSD
    OSUbuntu 22.04/24.04 LTSUbuntu 24.04 LTS
    Network1 Gbps1 Gbps with dedicated IP
    Recommended RamNode Plan

    For production deployments, we recommend starting with the Premium SSD 8GB plan or higher. For development and testing, the Premium SSD 4GB plan can work but may experience slower performance during high-load periods.

    2

    VPS Setup

    Deploy Your RamNode VPS

    1. Log in to your RamNode control panel
    2. Select Deploy New Server and choose your preferred location
    3. Select Ubuntu 24.04 LTS as your operating system
    4. Choose a plan with at least 8GB RAM for production use
    5. Add your SSH key for secure access
    6. Deploy and note your server's IP address

    Initial Server Configuration

    Connect and configure server
    # Connect to your server
    ssh root@YOUR_SERVER_IP
    
    # Update system packages
    apt update && apt upgrade -y
    
    # Set timezone
    timedatectl set-timezone UTC
    
    # Configure hostname
    hostnamectl set-hostname sentry
    
    # Install essential packages
    apt install -y curl wget git vim ufw fail2ban htop

    Configure Firewall

    Set up UFW firewall
    # Enable UFW
    ufw default deny incoming
    ufw default allow outgoing
    
    # Allow SSH
    ufw allow 22/tcp
    
    # Allow HTTP and HTTPS
    ufw allow 80/tcp
    ufw allow 443/tcp
    
    # Enable firewall
    ufw enable
    
    # Verify status
    ufw status verbose

    Create Sentry User

    Create dedicated user
    # Create sentry user
    adduser --disabled-password --gecos "" sentry
    
    # Add to docker group (after Docker installation)
    usermod -aG docker sentry
    
    # Switch to sentry user for remaining setup
    su - sentry
    3

    Docker Installation

    Install Docker Engine
    # Remove old versions
    sudo apt remove docker docker-engine docker.io containerd runc 2>/dev/null
    
    # Install prerequisites
    sudo apt install -y ca-certificates curl gnupg lsb-release
    
    # Add Docker's official GPG key
    sudo install -m 0755 -d /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
      | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    sudo chmod a+r /etc/apt/keyrings/docker.gpg
    
    # Add Docker repository
    echo "deb [arch=$(dpkg --print-architecture) \
      signed-by=/etc/apt/keyrings/docker.gpg] \
      https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    # Install Docker
    sudo apt update
    sudo apt install -y docker-ce docker-ce-cli containerd.io \
      docker-buildx-plugin docker-compose-plugin
    
    # Verify installation
    docker --version
    docker compose version

    Configure Docker

    Optimize Docker for production
    # Create Docker daemon configuration
    sudo tee /etc/docker/daemon.json > /dev/null <<EOF
    {
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "100m",
        "max-file": "3"
      },
      "storage-driver": "overlay2"
    }
    EOF
    
    # Restart Docker to apply changes
    sudo systemctl restart docker
    
    # Enable Docker to start on boot
    sudo systemctl enable docker
    4

    Sentry Installation

    Clone the Repository

    Download Sentry self-hosted
    # Switch to sentry user if not already
    su - sentry
    
    # Clone the repository
    git clone https://github.com/getsentry/self-hosted.git sentry
    cd sentry
    
    # Checkout the latest stable release
    git fetch --tags
    LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
    git checkout $LATEST_TAG
    echo "Installing Sentry version: $LATEST_TAG"

    Configure Environment

    Set up environment file
    # Copy environment template
    cp .env.example .env
    
    # Edit environment file
    vim .env
    Example .env configuration
    # Primary configuration
    SENTRY_BIND=9000
    SENTRY_SECRET_KEY= # Will be generated automatically
    
    # Mail configuration (example with SMTP)
    SENTRY_MAIL_HOST=smtp.your-provider.com
    SENTRY_MAIL_PORT=587
    SENTRY_MAIL_USERNAME=your-email@domain.com
    SENTRY_MAIL_PASSWORD=your-app-password
    SENTRY_MAIL_USE_TLS=true
    SENTRY_SERVER_EMAIL=sentry@yourdomain.com
    
    # Data retention (in days)
    SENTRY_EVENT_RETENTION_DAYS=90

    Configure Sentry Settings

    Edit sentry/config.yml
    system.url-prefix: 'https://sentry.yourdomain.com'
    system.admin-email: 'admin@yourdomain.com'
    
    # Enable features
    features.organizations:discover-basic: true
    features.organizations:discover-query: true
    features.organizations:performance-view: true

    Run the Installer

    Execute installation (15-30 minutes)
    # Run the installer
    ./install.sh

    During installation, you'll be prompted to create an admin user. Use a strong password and remember these credentials.

    Start Sentry

    Launch all services
    # Start Sentry in detached mode
    docker compose up -d
    
    # Verify all containers are running
    docker compose ps
    
    # View logs (optional)
    docker compose logs -f
    5

    Nginx Reverse Proxy

    Install Nginx
    # Exit sentry user to root
    exit
    
    # Install Nginx
    apt install -y nginx
    
    # Start and enable Nginx
    systemctl start nginx
    systemctl enable nginx

    Configure Virtual Host

    /etc/nginx/sites-available/sentry
    server {
        listen 80;
        server_name sentry.yourdomain.com;
    
        location / {
            proxy_pass http://127.0.0.1:9000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
    
            # WebSocket support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    
            # Timeouts
            proxy_connect_timeout 300;
            proxy_send_timeout 300;
            proxy_read_timeout 300;
    
            # File upload size
            client_max_body_size 100M;
        }
    }
    Enable site and install SSL
    # Enable the site
    ln -sf /etc/nginx/sites-available/sentry /etc/nginx/sites-enabled/
    rm -f /etc/nginx/sites-enabled/default
    
    # Test and reload
    nginx -t && systemctl reload nginx
    
    # Install Certbot
    apt install -y certbot python3-certbot-nginx
    
    # Obtain SSL certificate
    certbot --nginx -d sentry.yourdomain.com \
      --non-interactive --agree-tos \
      --email admin@yourdomain.com
    
    # Verify auto-renewal
    certbot renew --dry-run
    6

    Email Configuration

    Edit sentry/sentry.conf.py
    # Email configuration
    mail.backend = 'smtp'
    mail.host = 'smtp.your-provider.com'
    mail.port = 587
    mail.username = 'your-email@domain.com'
    mail.password = 'your-app-password'
    mail.use-tls = True
    mail.use-ssl = False
    mail.from = 'sentry@yourdomain.com'
    mail.list-namespace = 'sentry.yourdomain.com'

    Performance Tuning

    docker-compose.override.yml
    services:
      web:
        deploy:
          resources:
            limits:
              memory: 2G
            reservations:
              memory: 1G
    
      worker:
        deploy:
          resources:
            limits:
              memory: 2G
            reservations:
              memory: 1G
    
      postgres:
        command: postgres -c max_connections=200
        deploy:
          resources:
            limits:
              memory: 2G
    
      redis:
        deploy:
          resources:
            limits:
              memory: 512M
    Apply configuration
    # Restart with new configuration
    docker compose down
    docker compose up -d
    7

    SDK Integration

    Integrate Sentry into your applications using the official SDKs:

    JavaScript/Node.js

    Install and configure
    npm install @sentry/node
    
    // Initialize in your app
    const Sentry = require("@sentry/node");
    
    Sentry.init({
      dsn: "https://YOUR_KEY@sentry.yourdomain.com/PROJECT_ID",
      environment: "production",
      tracesSampleRate: 1.0,
    });

    Python

    Install and configure
    pip install sentry-sdk
    
    # Initialize in your app
    import sentry_sdk
    
    sentry_sdk.init(
        dsn="https://YOUR_KEY@sentry.yourdomain.com/PROJECT_ID",
        environment="production",
        traces_sample_rate=1.0,
    )

    PHP

    Install and configure
    composer require sentry/sentry
    
    // Initialize in your app
    \Sentry\init([
        'dsn' => 'https://YOUR_KEY@sentry.yourdomain.com/PROJECT_ID',
        'environment' => 'production',
        'traces_sample_rate' => 1.0,
    ]);
    8

    Backup & Maintenance

    Database Backup Script

    Create backup script
    #!/bin/bash
    # /home/sentry/backup-sentry.sh
    set -e
    
    BACKUP_DIR="/home/sentry/backups"
    DATE=$(date +%Y%m%d_%H%M%S)
    mkdir -p $BACKUP_DIR
    
    cd /home/sentry/sentry
    
    # Backup PostgreSQL
    docker compose exec -T postgres pg_dump -U postgres sentry | \
      gzip > $BACKUP_DIR/sentry_postgres_$DATE.sql.gz
    
    # Backup volumes
    tar -czf $BACKUP_DIR/sentry_volumes_$DATE.tar.gz \
      -C /var/lib/docker/volumes .
    
    # Keep only last 7 days of backups
    find $BACKUP_DIR -name "sentry_*" -mtime +7 -delete
    
    echo "Backup completed: $DATE"
    Set up automated backups
    chmod +x /home/sentry/backup-sentry.sh
    
    # Add to crontab (daily at 3 AM)
    (crontab -l 2>/dev/null; echo "0 3 * * * /home/sentry/backup-sentry.sh") | crontab -

    Updating Sentry

    Update to latest version
    # Navigate to Sentry directory
    cd /home/sentry/sentry
    
    # Pull latest changes
    git fetch --tags
    LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
    
    # Check current version
    CURRENT_TAG=$(git describe --tags)
    echo "Current: $CURRENT_TAG, Latest: $LATEST_TAG"
    
    # Update if new version available
    if [ "$CURRENT_TAG" != "$LATEST_TAG" ]; then
      # Stop services
      docker compose down
    
      # Checkout new version
      git checkout $LATEST_TAG
    
      # Run installer (handles migrations)
      ./install.sh --skip-user-creation
    
      # Start services
      docker compose up -d
    fi

    Cleanup Commands

    Regular maintenance
    # Clean up old events (run periodically)
    cd /home/sentry/sentry
    docker compose exec web sentry cleanup --days=90
    
    # Remove unused Docker resources
    docker system prune -af --volumes
    
    # Check disk usage
    df -h
    du -sh /var/lib/docker/volumes/*
    9

    Troubleshooting

    Useful Commands

    CommandPurpose
    docker compose psList all container statuses
    docker compose logs -f serviceFollow logs for a service
    docker compose restart serviceRestart a specific service
    docker compose down && up -dFull restart all services
    docker compose exec web sentry shellAccess Sentry shell

    Sentry Deployed Successfully!

    You now have a fully functional, self-hosted Sentry installation with enterprise-grade error tracking and performance monitoring.

    Next steps: Integrate Sentry SDKs into your applications, configure alert rules for critical errors, set up team members with appropriate permissions, and consider enabling session replay and profiling.