Managing R2R versions, updates, and database migrations across environments.

Deployment Management

R2R deployments consist of three main components that need to be managed:

  1. The R2R Python package
  2. The Docker images
  3. The database schema

Version Management

Check your current R2R version:

$r2r version

Update R2R

Update your R2R installation to the latest version:

$r2r update

This command will:

  • Upgrade the R2R package to the latest version using pip
  • Display the update progress and confirmation
  • Show any errors if they occur during the update process

When you update R2R, the Docker image used by r2r serve will automatically be updated to match the new version. The system will attempt to use a version-specific image (e.g., ragtoriches/prod:1.2.3) or fall back to latest if the specific version isn’t available.

Database Management

R2R uses database migrations to manage schema changes across versions. After updating R2R, you should always check and update your database schema:

Check Current Migration

View the current migration state of your database:

$r2r db current

Apply Migrations

Upgrade your database to the latest version:

$r2r db upgrade

Deployment Process

Here’s the recommended process for updating an R2R deployment:

  1. Prepare for Update

    $# Check current versions
    >r2r version
    >r2r db current
    >
    ># Generate system report (optional)
    >r2r generate-report
  2. Stop Running Services

    $# Bring down existing deployment
    >r2r docker-down
  3. Update R2R

    $r2r update
  4. Update Database

    $# Check and apply any new migrations
    >r2r db upgrade
  5. Restart Services

    $# Start the server with your configuration
    >r2r serve --docker [additional options]

Managing Multiple Environments

For different environments (development, staging, production), use different project names and schemas:

$# Development
>export R2R_PROJECT_NAME=r2r_dev
>r2r serve --docker --project-name r2r-dev
>
># Staging
>export R2R_PROJECT_NAME=r2r_staging
>r2r serve --docker --project-name r2r-staging
>
># Production
>export R2R_PROJECT_NAME=r2r_prod
>r2r serve --docker --project-name r2r-prod

Vector Index Management

R2R uses vector indices to enable efficient similarity search across documents. For detailed information about managing vector indices, including creation, listing, and deletion, see the Ingestion documentation.

Key vector index management commands:

$# Create a new vector index
>r2r create-vector-index
>
># List existing indices
>r2r list-vector-indices
>
># Delete an index
>r2r delete-vector-index <index-name>

Troubleshooting

If issues occur during deployment:

  1. Generate a system report:

    $r2r generate-report
  2. Check container health:

    $# Bring down existing deployment
    >r2r docker-down
    >
    ># Start fresh and watch for health checks
    >r2r serve --docker
  3. Review the database state:

    $r2r db current
    >r2r db history
  4. If needed, roll back database changes:

    $r2r db downgrade --revision <previous-working-version>