ClaroDocs
IT & DevOps

Upgrade Guide

How to upgrade Claro to the latest version with zero downtime.

Upgrade Guide

This guide covers how to upgrade your on-premise Claro installation to the latest version. Database migrations run automatically on startup, so most upgrades require only pulling new container images and restarting.

Always create a backup before upgrading. While Claro's migrations are designed to be safe, having a backup ensures you can recover if anything goes wrong.

Pre-Upgrade Backup

Back Up PostgreSQL

Create a full database dump:

docker compose -f docker-compose.prod.yml exec postgres \
  pg_dump -U claro -d claro -F c -f /tmp/claro-backup.dump

docker compose -f docker-compose.prod.yml cp \
  postgres:/tmp/claro-backup.dump ./claro-backup-$(date +%Y%m%d).dump

This creates a compressed backup file on your host machine.

Back Up Redis (Optional)

Redis data is transient (job queues, caches) and will regenerate automatically. However, if you want a snapshot:

docker compose -f docker-compose.prod.yml exec redis redis-cli BGSAVE

Wait for the save to complete, then copy the dump file:

docker compose -f docker-compose.prod.yml cp \
  redis:/data/dump.rdb ./redis-backup-$(date +%Y%m%d).rdb

Back Up Environment File

Make a copy of your .env file:

cp .env .env.backup-$(date +%Y%m%d)

Upgrade Process

Pull Latest Images

If you are using pre-built Docker images:

docker compose -f docker-compose.prod.yml pull

If you are building from source:

git pull origin main
docker compose -f docker-compose.prod.yml build

Check for New Environment Variables

Review the release notes or compare .env.example with your current .env file:

diff .env .env.example

Add any new required environment variables to your .env file before restarting.

Restart Services

Stop and restart all containers with the new images:

docker compose -f docker-compose.prod.yml down
docker compose -f docker-compose.prod.yml up -d

The API container automatically detects pending database migrations and runs them on startup. Watch the logs to confirm migrations complete successfully:

docker compose -f docker-compose.prod.yml logs -f api

Look for messages like "Migration applied successfully" or "No pending migrations."

Verify the Upgrade

Run the following checks:

# Check all containers are healthy
docker compose -f docker-compose.prod.yml ps

# Check API health endpoint
curl https://claro.yourcompany.com/api/health

# Check the application version in the health response

Then log in to the web interface and verify:

  • Dashboard loads correctly
  • You can navigate to Campaigns, Templates, Training, and Settings
  • Existing campaigns and data are intact

Rollback Procedure

If the upgrade causes issues, roll back to the previous version:

Stop Containers

docker compose -f docker-compose.prod.yml down

Restore the Database

# Start only the database container
docker compose -f docker-compose.prod.yml up -d postgres

# Wait for PostgreSQL to be ready
sleep 5

# Restore from backup
docker compose -f docker-compose.prod.yml cp \
  ./claro-backup-YYYYMMDD.dump postgres:/tmp/claro-backup.dump

docker compose -f docker-compose.prod.yml exec postgres \
  pg_restore -U claro -d claro --clean --if-exists /tmp/claro-backup.dump

Revert to Previous Images

If using pre-built images, specify the previous version tag:

# Edit docker-compose.prod.yml to use the previous image tag
# Then restart
docker compose -f docker-compose.prod.yml up -d

If building from source:

git checkout PREVIOUS_RELEASE_TAG
docker compose -f docker-compose.prod.yml build
docker compose -f docker-compose.prod.yml up -d

Restore Environment File

If you changed environment variables during the upgrade:

cp .env.backup-YYYYMMDD .env

Upgrade Best Practices

  • Schedule upgrades during low-traffic periods to minimize impact on active campaigns.
  • Pause running campaigns before upgrading if possible. Paused campaigns resume cleanly after the upgrade.
  • Read release notes before every upgrade. Major releases may include breaking changes or new required environment variables.
  • Test in a staging environment if you have one. Restore a backup to a staging server and run the upgrade there first.
  • Keep backups for at least 30 days in case issues are discovered after the upgrade.
  • Monitor logs after upgrade for at least an hour to catch any delayed errors in background job processing.