Upgrade
Follow the steps for your installation method. The procedure differs depending on how you installed OpenAlgo.
Option 1: Ubuntu Server (installed via install.sh)
Your installation lives at /var/python/openalgo and runs as the systemd service openalgo. Use the bundled update script, it performs the entire upgrade safely in one command:
cd /var/python/openalgo
sudo bash install/update.shThe script automatically:
Stops the
openalgoserviceBacks up all databases (openalgo, logs, latency, sandbox, historify) to a timestamped
db/backup_<timestamp>/folderPulls the latest code (
git pull)Compares your
.envagainst.sample.envand lists any new variables you should add (it never overwrites your.env)Updates Python dependencies
Runs all database migrations
Restarts the service
Legacy multi-deployment installs (/var/python/openalgo-flask/<name>/openalgo/) are detected automatically and the correct openalgo-<name> service is updated.
Pre-built images on Docker Hub
CI publishes a multi-architecture image (amd64 and arm64) on every push to main:
marketcalls/openalgoon Docker Hubmarketcalls/openalgo:latest, the currentmainmarketcalls/openalgo:<commit-sha>, every build, so you can pin or roll back to an exact version
Which upgrade path applies to you depends on how you installed:
docker-run.sh (Desktop)
Pulls marketcalls/openalgo:latest
./docker-run.sh pull then ./docker-run.sh restart
install-docker.sh (custom domain)
Builds locally from the repo
git pull then rebuild, Option 2a
install-docker-multi-custom-ssl.sh
Builds locally per instance
Re-run the installer in update mode, Option 2b
Manual clone
Builds locally
Option 2
The server install scripts build locally rather than pulling, so a docker pull alone will not update them. If you would rather pull than build, it is much faster, since no build step runs, see "Using the pre-built image instead of building" below.
Option 2: Docker: manual clone (no custom domain)
Use this if you cloned OpenAlgo yourself and run it with docker compose.
Your .env file and the named volumes persist across the rebuild, no reconfiguration needed. Database migrations run automatically on container startup.
Option 2a: Docker + Custom Domain (single instance)
For installations created with install-docker.sh, which sets up nginx, a Let's Encrypt certificate and your domain.
Your installation lives at /opt/openalgo.
What is preserved automatically, and why:
Your .env
/opt/openalgo/.env
Not tracked by git, bind-mounted into the container
Database, logs, strategies, keys
Docker named volumes
Volumes are independent of the image
nginx site configuration
/etc/nginx/sites-available/<domain>
Outside the repository entirely
SSL certificate
/etc/letsencrypt/live/<domain>/
Outside the repository entirely
Because nginx and the certificate live outside the repo, a Docker upgrade cannot break your domain or SSL. You do not need to re-run certbot, and you do not need to touch nginx.
You also do not need to change your broker's redirect URL, it stays https://<your-domain>/<broker>/callback.
Option 2b: Docker + Custom Domain (multi-instance)
For installations created with install-docker-multi-custom-ssl.sh, where each domain is its own instance under /opt/openalgo/<domain>.
The installer doubles as the upgrade script. Re-run it and choose update mode:
When it finds an existing instance it asks:
Answer y. It pulls the latest code and preserves your existing configuration, broker keys, API secrets and domain settings are read back out of the instance's .env and reused. Answer n to skip an instance you do not want to touch.
To upgrade a single instance by hand instead:
Using the pre-built image instead of building
Optional. Building locally takes several minutes and needs build tooling on the server; pulling the published image takes seconds. The trade-off is that you give up local modifications to the source.
Edit docker-compose.yaml in your install directory:
Then upgrades become:
Pinning to an exact version is the main practical benefit, it makes rollback immediate and unambiguous:
Backing up before a Docker upgrade
Named volumes are not touched by docker compose build, but take a copy before any upgrade.
The simplest method, copy straight out of the running container:
Here openalgo is the compose service name, not the container name.
If you prefer to archive the volume itself, look up its real name first:
Docker Compose prefixes volume names with the project name, which is taken from the directory. An install in /opt/openalgo produces openalgo_openalgo_db, while /opt/openalgo/yourdomain.com produces something different. Always read the name rather than assuming it:
Also copy your .env, which is the only file that cannot be regenerated:
Rolling back a Docker upgrade
Restore the database only if the upgrade actually migrated it and you need the earlier schema, migrations are forward-only, so a rollback of code without the matching database can fail to start.
After a Docker + custom domain upgrade
Check these in order:
Then in the browser: log in, confirm the dashboard loads, and confirm live data updates, a working page with frozen prices means the WebSocket upgrade through nginx is not working, which is the one thing worth checking specifically on a custom-domain setup.
Option 3: Desktop / Local: Update Scripts (Recommended)
OpenAlgo runs cross-platform, Windows, macOS and Linux desktops all have a one-command update path using the bundled scripts.
Windows
macOS / Linux
Both scripts detect a local (non-server) installation automatically and perform the same safe sequence: back up all databases (openalgo, logs, latency, sandbox, historify) to a timestamped db\backup_<timestamp>\ folder → git pull → report any new .env variables → update dependencies via uv → run all database migrations. Your .env is never touched.
After the script finishes, start OpenAlgo as usual:
You should see the configuration check pass and all databases initialize:
Option 4: Manual Upgrade (any platform)
If you prefer to run the steps yourself, only the backup step differs by platform, everything else is identical on Windows, macOS and Linux.
1. Backup the databases
Windows (PowerShell):
macOS / Linux:
2. Pull the latest application code
3. Update dependencies
(Legacy pip setups: pip install -r requirements.txt inside your virtual environment.)
4. Run the migration script
Migrations are idempotent, safe to run on every upgrade. From the project root:
Or use the equivalent command from the upgrade directory:
The Strategy RMS migration is required on releases that include it. It creates the sm_ strategy tables on an older installation and adds compatible nullable columns/indexes to an earlier Strategy RMS schema. Existing rows are retained; unknown historical values are not invented. If this required migration fails, the runner exits non-zero: do not start the updated application until the failure is resolved.
5. Start OpenAlgo
Handling new environment variables
Newer releases often introduce new environment variables that OpenAlgo needs to function. Do not recreate your .env from the sample, merge instead:
Open
.sample.envand checkENV_CONFIG_VERSIONat the top. If it is newer than the version in your.env, new variables were added.On startup, OpenAlgo's configuration check reports exactly which variables are missing.
Copy only the missing lines from
.sample.envinto your.envand set appropriate values, keeping all your existing settings (broker keys,APP_KEY,API_KEY_PEPPER, domain configuration) untouched.
The update scripts (install/update.sh on Linux/macOS, install\update.bat on Windows) print this comparison for you automatically.
Post-Upgrade Checklist
Configuration version check passes on startup (no missing variable warnings)
All databases initialize correctly
Scheduler, WebSocket proxy (port 8765) and ZeroMQ services are running
Broker login works and the master contract downloads
API requests and strategies function normally
If anything fails after an upgrade, check log/errors.jsonl first, it contains structured error details including full tracebacks.
Optional: testing the gthread worker
OpenAlgo currently runs on Gunicorn's eventlet worker, which Gunicorn has announced it will drop in its next major version. An experimental switch to Gunicorn's threaded gthread worker is part of OpenAlgo since 30 September 2026, for those who want to test it.
It is opt-in and not the default: a normal upgrade leaves you on eventlet with no change in behaviour.
If you would like to help test it, see Migrating to gthread (Experimental).
Last updated
Was this helpful?