Skip to content

Updating openLogForge - Docker Compose

This guide covers how to safely update an existing Docker Compose deployment of openLogForge to a new version.

Back up your data before updating

Always create a database backup before pulling a new version. See Step 1 below.


Step 1 - Back up the database

The database lives inside a Docker named volume (olf-data). Export a copy to the host before making any changes.

# Create a backup directory if it does not exist
mkdir -p ~/openlogforge-backups

# Copy the database out of the running container
docker compose exec app sh -c "cp /data/openlogforge.db /tmp/openlogforge-backup.db"
docker compose cp app:/tmp/openlogforge-backup.db \
  ~/openlogforge-backups/openlogforge-$(date +%Y%m%d-%H%M%S).db

echo "Backup saved to ~/openlogforge-backups/"
ls -lh ~/openlogforge-backups/

Step 2 - Check the current version

git -C /path/to/openlogforge describe --tags --abbrev=0

Note the current version tag so you can roll back to it if needed.


Step 3 - Pull the latest code

Navigate to the directory where you cloned the repository:

cd /path/to/openlogforge
git pull

Review what changed before applying the update:

git log --oneline ORIG_HEAD..HEAD

Check CHANGELOG.md for breaking changes or manual migration steps:

git diff ORIG_HEAD..HEAD -- CHANGELOG.md

Step 4 - Rebuild and restart

docker compose up --build -d

Docker rebuilds both images, stops the old containers, and starts the new ones. Alembic database migrations run automatically during backend startup before the API becomes available.


Step 5 - Verify the update

Check both containers are running:

docker compose ps

Expected output:

NAME                     IMAGE               STATUS          PORTS
openlogforge-app-1       openlogforge-app    Up              8000/tcp
openlogforge-web-1       openlogforge-web    Up              0.0.0.0:80->8080/tcp

Check the backend logs for migration output and a clean start:

docker compose logs app --tail 30

Look for lines similar to:

INFO  [alembic.runtime.migration] Running upgrade ...
INFO:     Application startup complete.

Confirm the web interface loads correctly in your browser.


Rolling back

If the update causes problems, roll back to the previous version.

Step 1 - Stop the current containers:

docker compose down

Step 2 - Check out the previous version tag:

# List available tags
git tag --sort=-version:refname | head -10

# Check out the version you want to roll back to
git checkout v0.2.0   # replace with your previous version

Step 3 - Restore the database backup:

# Copy your backup into the volume via a temporary container
docker run --rm \
  -v openlogforge_olf-data:/data \
  -v ~/openlogforge-backups:/backup \
  alpine sh -c "cp /backup/<your-backup-file>.db /data/openlogforge.db"

Replace <your-backup-file> with the filename you noted in Step 1.

Step 4 - Rebuild and start the old version:

docker compose up --build -d

Scheduled maintenance window

For production deployments, consider the following sequence to minimise downtime:

  1. Run the backup (Step 1) during business hours - it takes seconds
  2. Schedule the update (Steps 3-4) during a low-traffic window
  3. Keep the terminal open and tail the logs during restart:
    docker compose up --build -d && docker compose logs -f app
    
  4. Verify the UI is responsive before closing the terminal