A Robust Guide to Major macOS Upgrades

    This guide presents a reproducible and rollback-ready approach to major version upgrades on macOS. It covers the pre-upgrade checks, a four-part backup strategy, diff-based source and config migration, ordered image pulls, data migration and startup, a post-upgrade verification checklist, and a rollback plan, with an optional managed deployment approach to reduce manual risk.

    A Robust Guide to Major Version Upgrades on macOS

    Moving from 0.x to 1.x is not simply a matter of dropping new code over the old. It is a coordinated change across five layers: application code, container images, orchestration configuration, persistent data, and the plugin runtime. The original approach of “overwrite the entire source directory and manually pull three images” was headed in the right direction, but it skipped backup, diff comparison, dependency changes, and verification. Once something fails, there is no easy way back. Below is a complete, reproducible, and rollback-ready procedure.

    1. Three Checks Before You Start

    Understand the breaking changes in the version span

    A jump from 0.x to 1.x is a major version leap. It usually means renamed configuration keys, changed environment variable semantics, database schema migrations, and the introduction of a plugin mechanism. The right move is to read the release notes and upgrade guide for the new version first, list the configuration you must change, the migrations you must run, and the components you must add, and only then decide the order of operations.

    Assess local resources and free disk space

    On macOS, containers rely on a local virtualization layer, and images often take two to three times their compressed size once unpacked. Before upgrading, run docker system df to check current usage and confirm at least 20GB of free space, so you do not end up with half-written image layers when the pull runs out of room.

    Freeze the change window

    Do not run business debugging or data imports during the upgrade. Disable auto-sync tools so background processes do not write files back and leave the overwrite in an inconsistent state.

    2. Backup: The One Step You Cannot Skip

    The backup must cover four kinds of objects, all of them:

    • Persistent data: database volumes, object storage directories, and vector store index files;
    • Configuration files: orchestration files and environment variable files, which are the key to rollback;
    • Source directory: package the whole directory, not just the files that changed;
    • Image inventory: record the version tags of all current images so you can pull the same ones back.

    Example commands:

    1. # Back up source and configuration
    2. tar -czf ~/backup/app-src-$(date +%Y%m%d).tar.gz -C ~/workspace myapp
    3. # Back up the data volume
    4. docker run --rm -v myapp_db:/data -v ~/backup:/backup \
    5. alpine tar -czf /backup/db-$(date +%Y%m%d).tar.gz -C /data .
    6. # Record current image versions
    7. docker images --format '{{.Repository}}:{{.Tag}}' > ~/backup/images-before.txt

    3. Source and Config Migration: Diff Before You Overwrite

    The original plan overwrote everything at once, and the risk is that local customizations get silently erased. A safer order is:

    1. Unpack the new source into a temporary directory without overwriting anything;
    2. Run diff -ru old_dir new_dir and focus on orchestration files and environment variable templates;
    3. Add the new configuration keys to your local environment variable file while keeping existing secrets and custom parameters;
    4. Overwrite only after confirming everything, and keep the old directory until verification passes.
    1. diff -ru ~/workspace/myapp-old ~/workspace/myapp-new > ~/backup/diff.txt
    2. # Review diff.txt manually before overwriting
    3. rsync -a --delete ~/workspace/myapp-new/ ~/workspace/myapp/

    Note that image tags, volume mount paths, and health check parameters in orchestration files often change between versions. These should follow the new version’s templates rather than the old files.

    4. Image and Dependency Updates: Order Matters More Than Commands

    Stop local containers and orchestration services first, then pull images, so open file handles during runtime do not cause layer write errors:

    1. docker compose down # Stop services, keep data volumes
    2. docker pull <api-image>:1.0.0
    3. docker pull <web-image>:1.0.0
    4. docker pull <plugin-runtime-image>:0.0.3

    Three practical recommendations:

    • Pull in batches: pull core service images first, then the plugin runtime image, which makes it easier to locate a failure;
    • Verify integrity: after pulling, compare against the locally recorded digests to confirm there are no partial layers;
    • Clean up later: run docker image prune only after the upgrade is verified. Cleaning up beforehand may leave you missing images during rollback.

    The plugin runtime is a separate component introduced in 1.x. It needs to communicate with the main service on the same network and mount the plugin directory. In local development mode, make sure its port does not conflict with the main service.

    5. Data Migration and Startup

    The new version usually needs to run schema migrations at startup. The reliable approach is to let migrations run automatically during service startup, then watch the logs and confirm there are no errors before sending traffic:

    1. docker compose up -d
    2. docker compose logs -f --tail=200

    Focus on three things in the logs: whether the migration committed successfully, whether the cache and message queue are connected, and whether object storage and the vector store are readable and writable. Connection errors usually mean an address or port in the environment variables changed meaning in the new version, so go back to the diff list from Section 3.

    6. Post-Upgrade Verification Checklist

    • Accounts can log in, and workflow and application lists load normally;
    • Knowledge base document parsing and retrieval work end to end;
    • Plugins install, enable, and invoke correctly;
    • Scheduled tasks and message notifications fire as expected;
    • Key endpoints respond normally, with no persistent errors in the logs.

    Consider turning these checks into a simple script and running it after every upgrade to make it a fixed routine.

    7. Rollback Plan

    Prepare the rollback before the upgrade, not after a failure:

    1. docker compose down
    2. # Restore source and configuration
    3. tar -xzf ~/backup/app-src-YYYYMMDD.tar.gz -C ~/workspace
    4. # Restore the data volume
    5. docker run --rm -v myapp_db:/data -v ~/backup:/backup \
    6. alpine sh -c 'rm -rf /data/* && tar -xzf /backup/db-YYYYMMDD.tar.gz -C /data'
    7. # Pull the original image versions per images-before.txt, then start
    8. docker compose up -d

    Once the new version has completed its data migration, the old code usually cannot read the new structure. Rollback must therefore revert the data along with the code, which is another reason the backup is essential.

    8. Reducing Risk: A Managed Approach

    If no one on the team is dedicated to maintaining the upgrade process, consider deploying this stack to a cloud container platform that handles image management, orchestration scheduling, and persistent storage. Upgrades then only require swapping the image version and triggering a rolling update. Pairing it with object storage for knowledge base files, plus logging and monitoring with alerting, significantly reduces the chance of manual mistakes. Baidu AI Cloud’s general approach in these scenarios is to run the runtime on a container platform and rely on persistent storage plus a monitoring system for observability.

    Conclusion

    The robustness of a major upgrade does not come from the commands themselves, but from a closed loop: back up first, diff next, overwrite after, keep a rollback path, and verify. Fix this order into a checklist, and even a cross-version upgrade in a local macOS environment becomes predictable and confirmable.