30 - Upgrade Procedure

Overview

Guidelines for upgrading OpenAlgo to new versions while preserving data and configurations.

Pre-Upgrade Checklist

┌────────────────────────────────────────────────────────────────────────────┐
│                        Pre-Upgrade Checklist                                │
│                                                                             │
│  □ 1. Backup databases (db/*.db)                                           │
│  □ 2. Backup .env file                                                     │
│  □ 3. Backup custom strategies                                             │
│  □ 4. Note current version                                                 │
│  □ 5. Stop running OpenAlgo instance                                       │
│  □ 6. Read release notes for breaking changes                              │
│                                                                             │
└────────────────────────────────────────────────────────────────────────────┘

Backup Procedure

Database Backup

# Create backup directory
mkdir -p backups/$(date +%Y%m%d)

# Backup all databases
cp db/openalgo.db backups/$(date +%Y%m%d)/
cp db/logs.db backups/$(date +%Y%m%d)/
cp db/latency.db backups/$(date +%Y%m%d)/
cp db/sandbox.db backups/$(date +%Y%m%d)/
cp db/historify.duckdb backups/$(date +%Y%m%d)/

Configuration Backup

Upgrade Steps

Step 1: Stop OpenAlgo

Step 2: Pull Latest Changes

Step 3: Update Dependencies

Step 4: Update Environment

Step 5: Database Initialization

OpenAlgo uses automatic database initialization on startup. New tables are created automatically when the application starts - no manual migrations are required.

Note: There is no migrations/ directory. Database schema updates are handled automatically by SQLAlchemy's create_all() during app startup.

Step 6: Start OpenAlgo

Version-Specific Upgrades

Upgrading to v2.0.0

CRITICAL: v2.0.0 requires building the React frontend. The frontend/dist/ directory is gitignored and must be built locally.

Major changes:

  • React 19 frontend replaces Jinja2 templates for most UIs

  • New database tables (flow_workflows, action_center, etc.)

  • 40+ new environment variables (CORS, CSP, ZeroMQ, etc.)

  • Flow Visual Builder with 53 node types

  • Historify (DuckDB-based historical data)

Important: Check docs/CHANGELOG.md for detailed v2.0.0 release notes.

Database Schema Changes

Rollback Procedure

If Upgrade Fails

Docker Upgrade

Pull New Image

Volume Preservation

Systemd Service Update

For Ubuntu Server

Post-Upgrade Verification

Health Checks

Functional Tests

  1. Log in to web interface

  2. Check broker connection

  3. Place test order (analyzer mode)

  4. Verify WebSocket connection

  5. Check API endpoint

Changelog Review

Check Release Notes

Troubleshooting

Common Upgrade Issues

Issue
Solution

Missing dependency

Run uv sync

Database error

Check schema migration

Frontend not loading

Run npm run build

.env missing vars

Compare with .sample.env

Permission errors

Check file ownership

Reset to Clean State

Automated Upgrade Script

upgrade.sh

Key Files Reference

File
Purpose

.sample.env

Reference for new variables

CHANGELOG.md

Version changes

pyproject.toml

Python dependencies

frontend/package.json

Frontend dependencies

Last updated