Smooth Major Version Upgrades on macOS: A Complete and Rollback-Ready Guide

    Upgrading a self-hosted LLM platform on macOS from a 0.x release to 1.x is a breaking change, not a routine patch. This guide walks through a reproducible, rollback-safe process covering cold backups, code and image replacement, startup verification, persistent volume recovery, and extension reinstallation, while highlighting macOS-specific disk and architecture considerations.

    Smooth Major Version Upgrades on macOS

    For teams running a container-orchestrated, self-hosted large language model application platform on macOS, moving from 0.x to 1.x is a qualitative leap rather than a routine update. Not only do all image tags change, but the underlying data directory layout, the composition of dependent components, and the way the extension mechanism runs are all restructured. Many people run into problems after upgrading: “I can log in, but every workflow is empty,” “plugins won’t install,” or “services keep restarting.” The root cause is rarely operator error. It is treating a major version upgrade like a minor one, where you just pull a new image and restart. This article lays out a reproducible and rollback-ready process.

    1. First, Understand What Makes Major Upgrades Hard

    A minor upgrade usually involves only swapping the image tag, with backward-compatible data formats. A major upgrade typically brings three kinds of changes:

    • Component topology changes: new independently running extension service containers are added, and previously monolithic capabilities are split apart.
    • Data directory and volume mapping changes: the way persistent directories are organized changes, and old volumes are not automatically recognized by the new version.
    • Extension mechanism redesign: model integrations and tool capabilities that used to be built in are now loaded and installed by a separate extension process.

    Once you understand these three points, it becomes clear why “backup” and “data migration” must be handled as two separate phases, instead of expecting a single startup to take care of everything.

    2. Phase One: Keep the Backup Simple, but Make It Rollback-Ready

    The most reliable backup method is not exporting the database record by record. It is taking a cold copy of the entire deployment directory while writes are stopped.

    1. # Stop services first so files are not in a half-written state during the copy
    2. cd dify/docker && docker compose down
    3. # Go up one level and take a full snapshot (macOS ships with ditto, which preserves metadata more completely)
    4. cd ../.. && ditto dify dify_backup_0153

    Key points:

    1. The backup must be cold. A hot copy can capture inconsistent database files and volume data, which shows up as random errors after recovery.
    2. Keep the original directory name and structure, so a rollback only requires copying back in reverse, with no config fixes needed.
    3. If Time Machine or a cloud sync drive is enabled, exclude the volume directories that are being written to, to avoid sync conflicts producing “conflicted copy” files.
    4. After the backup completes, verify that its size is close to the original directory. A sharp drop in size usually means the copy was interrupted.

    3. Phase Two: Replace Code and Images in Sync

    The new version’s program files need to be overlaid onto the original deployment directory as a whole. For configuration files, use the templates shipped with the new version as the baseline, then compare them item by item against custom settings in the old config (ports, time zone, object storage parameters, message queue addresses, log level, and so on) and merge them manually. Do not drop the entire old config file back into the new directory. This is the most common cause of startup failures.

    Pull images while services are stopped to reduce disk and network contention:

    1. docker pull <platform-web-image>:<new-version-tag>
    2. docker pull <platform-api-image>:<new-version-tag>
    3. docker pull <extension-daemon-image>:<new-version-tag>

    Two additional points on macOS: first, the container platform needs enough free disk reserved (20GB or more is recommended), because stacking image layers can easily trigger out-of-space errors; second, on ARM-based chips, prefer the official image built for the corresponding architecture to avoid running through an emulation layer, which causes a sharp drop in performance.

    4. Phase Three: Startup and Quick Verification

    1. cd dify/docker
    2. docker compose -f docker-compose.yaml up -d
    3. docker compose ps

    After startup, verify in the following order to narrow down the problem layer by layer:

    1. All containers are running, with no continuous restarts;
    2. The platform web entry point is reachable and the login page renders correctly;
    3. Logging in with the original account succeeds and the application list page loads;
    4. If the list is empty, the volume data was not recognized, so move on to the next phase.

    5. Phase Four: Work Data Recovery (the Easiest Place to Trip)

    The new version does not automatically take over the old version’s persistent volumes. Copy the entire volumes directory from the orchestration directory in the backup to the corresponding location in the new version, then restart the services:

    1. ditto dify_backup_0153/docker/volumes dify/docker/volumes
    2. cd dify/docker && docker compose down && docker compose up -d

    Before copying, it is a good idea to rename the newly generated empty volume directory and keep it, which makes comparison and fallback easier. After recovery, focus on checking three things: whether applications and workflows are back, whether knowledge base documents can be retrieved normally, and whether historical conversation records are complete. These three correspond to metadata, vector data, and business data respectively. Any missing item points to the corresponding volume not being mounted correctly.

    6. Phase Five: Extracting and Reinstalling Extensions

    The new version turns model providers and tools into extensions. You need to export the extension information already in use from the old environment, then install it in the new one.

    1. # 1. Find the API container ID
    2. docker ps
    3. # 2. Open a terminal inside the container
    4. docker exec -it <container-id> bash
    5. # 3. Export the list of extensions currently in use; workers controls parallelism
    6. poetry run flask extract-plugins --workers=20
    7. # 4. Install extensions inside the API container; access to the extension marketplace is required
    8. poetry run flask install-plugins --workers=2

    This process generates a manifest file (JSONL format, one extension record per line per workspace/tenant). Before running it, confirm that the container has outbound network access and can reach the extension marketplace domain. In enterprise intranet environments, configure a proxy or mirror source in advance; otherwise the install phase will hang for a long time and then fail on timeout. Keep parallelism low during the install phase; setting it too high causes contention on downloads and disk writes.

    7. Rollback and Wrap-Up

    If business is still not restored within 30 minutes after the upgrade, roll back immediately: stop services → overwrite everything with the backup directory → start. The rollback path must be verified once before the upgrade, otherwise the backup is worthless.

    After a successful upgrade, three wrap-up tasks are recommended: set up a scheduled cold backup task for the deployment directory; organize custom configuration items into a standalone environment variable file and put it under version control; and connect the container platform to a logging service and monitoring alerts, with thresholds set for memory, disk, and container restart counts, to avoid failing the next upgrade due to insufficient resources. When self-hosting this kind of service on cloud platforms such as Baidu AI Cloud, you can combine object storage for backup archiving and use a container platform to host the orchestration services, externalizing all volatile state, which significantly reduces upgrade risk.