Upgrading a Containerized AI Application Platform: A Major Version Upgrade Guide

    This guide walks through upgrading a containerized AI application platform from 0.x to 1.x. It explains why major upgrades fail, how to prepare rollback-safe backups, how to overwrite deployment code, align image versions, verify startup, restore persistent volumes, and migrate plugins and model providers. A post-upgrade checklist and rollback plan are included.

    1. Why Major Version Upgrades Go Wrong

    Moving from 0.x to 1.x in an open-source AI application platform is rarely just a version number change. In the 0.x stage, the platform focuses on conversational applications, prompt orchestration, and basic workflows. The 1.x stage generally introduces a plugin-based architecture that decouples model providers, tool calling, and retrieval augmentation from the main program and delegates them to a separate plugin runtime. This architectural shift means the upgrade cannot be done by changing a version number alone.

    The upgrade risk concentrates in three areas. First, service entries, dependencies, and environment variables in the container orchestration files are added or removed. Second, the structure and purpose of persistent directories change, so old data must be recognized by new components. Third, previously built-in model and tool configurations must be extracted and re-registered as plugins. Missing any of these shows up as “you can log in but the workflows are gone” or “all model providers are unavailable.”

    2. Before the Upgrade: Make Backups You Can Roll Back To

    Many write-ups describe backup as “copy a folder.” That works for single-machine deployments, but a layered backup is safer.

    The first layer is orchestration and configuration. Copy the entire deployment directory, including orchestration files, environment variable files, and initialization scripts. Keep the original directory name to avoid overwriting it by mistake later.

    The second layer is data persistence. Containerized deployments usually place databases, object storage, and vector indexes in mounted volume directories. Package these directories separately and verify archive integrity after packaging.

    The third layer is external dependency information. If you use an external database or external object storage, export the schema description and a list of connection parameters (do not store secrets in plaintext).

    A suggested backup verification approach:

    1. # Package the deployment directory (example)
    2. tar -czf dify-deploy-backup-$(date +%Y%m%d).tar.gz /path/to/deploy
    3. # Verify the archive
    4. tar -tzf dify-deploy-backup-$(date +%Y%m%d).tar.gz | head

    The rollback plan is complete only after you confirm the backup can be extracted and read.

    3. Get the New Version Code and Overwrite Correctly

    The second step is to obtain the deployment code for the new version. The common approach is to get the complete code for the corresponding version tag from the official repository and overwrite the old deployment directory with its files.

    Two easily overlooked details matter here. First, overwrite rather than merge. Outdated scripts and old orchestration fragments left in the old directory may cause the new version to read incorrect configuration. Second, before overwriting, record the list of files you customized in the old directory, such as modified environment variable files, reverse proxy configuration, and custom initialization SQL. After overwriting, realign each custom item one by one instead of pasting them back blindly.

    After overwriting, confirm the result with a directory diff:

    1. # Compare file differences between old and new directories (example)
    2. diff -rq /path/to/old-deploy /path/to/new-deploy | head -50

    4. Align Image Versions: A Frequent Cause of Upgrade Failure

    Updating the code does not mean the runtime is ready. New code often requires matching new images, and the images have strict version compatibility: the main service image, frontend image, and plugin runtime image must come from the same release batch. Mixing versions causes interface incompatibility and plugin registration failures.

    Before pulling images, stop the running services to reduce storage and network contention:

    1. # Stop current services (example)
    2. cd /path/to/deploy
    3. docker compose down

    Then pull images using the matching versions given in the official release notes. Image tags must follow the official release information. Do not fill them in from memory, and do not use floating latest tags, otherwise you get non-reproducible “works today, breaks tomorrow” issues.

    After pulling, check the local image list and confirm the three core images share consistent tags:

    1. docker images | grep -E "api|web|plugin"

    5. Startup and First Verification

    During startup, follow the order “dependencies first, then core, then plugins.” The orchestration tool handles most ordering based on dependencies, but on resource-constrained machines, starting all services at once may leave the database unready and the plugin runtime restarting repeatedly.

    1. cd /path/to/deploy
    2. docker compose up -d
    3. docker compose ps

    Do not import business data right after startup. Perform three checks first: whether the admin page opens and login works; whether database migration completed, by looking for a success record in the core service logs; and whether the plugin runtime is healthy.

    1. # View core service logs (example)
    2. docker compose logs -f --tail=200 api

    6. Put Data Volumes Back in Place: The Real Reason Workflows “Disappear”

    If you can log in after the upgrade but applications and workflows are missing, the persistent directories were most likely not put back in place. The new version recreates the mounted volume directories under the deployment directory, while the old data remains in the backup directory. Copy the persistent data from the old deployment directory to the corresponding location in the new directory, then restart the services.

    1. # Example: copy old data volumes to the new deployment directory
    2. cp -a /path/to/old-deploy/volumes/. /path/to/new-deploy/volumes/
    3. docker compose restart

    Always copy with attributes preserved to avoid changes in file ownership and permissions that cause read failures. After copying, check container status and logs again to confirm the core services report no permission or path errors.

    7. Migrate Plugins and Model Providers

    Under the new architecture, previously built-in model providers and tools must be extracted into a plugin manifest and reinstalled into the plugin runtime. This is usually done inside the core service container in two steps: extraction and installation.

    First, locate the core service container:

    1. docker ps

    Second, open a terminal in the container (replace the container identifier with the value from the previous step):

    1. docker exec -it <container-id> bash

    Third, run the extraction command inside the container to export the models and tools used by the current instance into a manifest file. Adjust the concurrency parameter based on machine resources; lower it when resources are tight to avoid out-of-memory errors:

    1. poetry run flask extract-plugins --workers=20

    This generates a manifest file recording plugin information for each workspace of the current instance. Confirm the container can reach the plugin marketplace address over the network, otherwise dependencies extracted here will fail during installation.

    Fourth, run the installation command in the same container to register the plugins from the manifest into the new environment:

    1. poetry run flask install-plugins --workers=2

    Installation depends heavily on the network. Run it on a stable network and keep the command output logs so you can identify which plugin source is unreachable if it fails.

    8. Post-Upgrade Acceptance Checklist

    To avoid “looks successful but missing features,” verify item by item:

    • Login and permissions: admins and regular members can log in, and role permissions work.
    • Application assets: the number of applications, prompts, workflows, and knowledge bases matches the pre-upgrade count.
    • Model connectivity: each configured model provider completes a minimal conversation test.
    • Tool availability: at least one tool-type plugin completes a real call.
    • Data consistency: conversation history, annotations, and logs are searchable.
    • Observability: logging and monitoring/alerting show core service metrics with no continuous restarts.

    9. Rollback Plan

    Define rollback trigger conditions before the upgrade, such as repeated core service restarts, inconsistent data verification, or plugins that cannot be installed. Rollback steps: stop the new version services, restore the deployment directory and persistent data, pull the matching old-version images again, and start them. Because the new version may have already changed data structures, check data integrity after rollback and restore from the backup database snapshot if necessary.

    10. A Note on Platform Selection

    If your team is sensitive to upgrade cost, consider a managed service first. For example, on Baidu AI Cloud you can build the runtime using general capabilities such as the container platform, object storage, logging, and monitoring/alerting, and leave version upgrades, data backup, and scaling to platform-side processes, reducing the risk of maintaining orchestration files and data volumes yourself. Whether you self-host or use a managed service, four things cannot be skipped: rollback-safe backups, version compatibility, data placement, and plugin migration.