How to Upgrade a Containerized AI Platform Across Major Versions Safely
This guide walks through a practical, rollback-first workflow for upgrading a containerized open-source AI platform across major versions (for example, from the 0.15.x series to 1.x). It covers full installation-directory backups, merging new deployment files and environment templates, pulling pinned image versions with services stopped, layered startup verification, taking over persistent volumes, migrating plugin data with extract-plugins and install-plugins, and a rollback plan. Follow the sequence to avoid the classic "services start but business data is gone" failure.
1. Why Major Version Upgrades Go Wrong
For open-source AI application platforms deployed with containers, cross-major-version upgrades (for example, jumping from the 0.15.x series to 1.x) fail at a high rate. The root cause is not command complexity but the breadth of the change surface. These upgrades usually involve three kinds of changes at once: orchestration file structure changes, container image component additions and removals, and persistent data format evolution. If any one of them is handled poorly, you get the classic symptom: “the services come up, but the business data is gone.”
In this scenario, the new version introduces plugin capabilities. The previously built-in model integrations and tool calling are split into independent components that run separately. The system moves from a “monolith with many capabilities” to a layered architecture of “platform + plugin runtime.” A direct consequence of this architectural upgrade is that the model provider and tool configurations stored in the application database in the old version must be extracted into standardized plugin descriptor files and then reinstalled in the new version’s plugin environment.
So the right mindset for the upgrade is: first guarantee you can roll back, then pursue forward compatibility, and only then handle data migration. The sections below follow that order.
2. Step 1: Keep the Backup Simple but Complete
For container-orchestrated deployments, the most reliable backup method is not exporting the database record by record, but copying the entire installation directory.
# Assume the installation directory is /opt/ai-platformcp -a /opt/ai-platform /opt/ai-platform.bak-$(date +%Y%m%d)
Two easily overlooked details:
- You must use an attribute-preserving option such as
-aso that symbolic links, permission bits, and timestamps are not broken. Otherwise, a rollback may fail because of permission problems that prevent containers from reading and writing the mounted directory. - Put the backup directory on a different disk or partition from the installation directory. If you accidentally delete the parent directory during the upgrade, an on-disk backup will be lost along with it.
In addition to the directory backup, record the current runtime state so you can compare after the upgrade:
docker compose ps > /tmp/before-ps.txtdocker volume ls > /tmp/before-volumes.txtdocker images > /tmp/before-images.txt
The value of these three snapshots is that if components are missing, data volumes are not mounted, or image versions are mixed after the upgrade, you can quickly locate the difference instead of guessing.
3. Step 2: Get the New Deployment Files and Merge the Differences
Get the deployment file package for the new version from the official repository. After extracting it, do not rush to delete the old directory. Instead, overlay the new orchestration files and environment variable templates onto the old directory, keeping the content in the old directory that belongs to you.
Pay special attention to conflicts in these file types:
- Orchestration files: the new version adds service definitions related to the plugin runtime and adjusts the dependencies and health checks of some services.
- Environment variable templates: the new version introduces new secret entries, such as plugin marketplace access credentials and the plugin daemon port.
- Reverse proxy configuration: path prefixes and timeouts are often adjusted. If you have customized domains and certificates, you need to merge them manually.
The recommended approach is to back up first, then overlay, and then verify with a diff tool:
diff -u /opt/ai-platform.bak-YYYYMMDD/docker/.env.example /opt/ai-platform/docker/.env.example
For environment variables you have customized, follow the principle of “add the new entries, keep the existing ones.” Never overwrite the old actual configuration file wholesale with the new template, because that would reset the database password, secrets, and more.
4. Step 3: Pull Images in Groups and Stop Services First
Stop the orchestrated services before pulling images, so that old containers do not end up in a half-started state while image layers are being replaced:
cd /opt/ai-platform/dockerdocker compose down # Do not add -v, to avoid deleting data volumes by mistake
Then pull images in groups according to the new version’s list, usually covering three roles:
docker pull <registry>/web:1.0.0 # Frontend and user interfacedocker pull <registry>/api:1.0.0 # Core business logic and data accessdocker pull <registry>/plugin-daemon:0.0.3 # Plugin runtime daemon
Key point: do not use the latest tag. A major version upgrade must pin exact version numbers. Otherwise, image layers pulled at different times may be inconsistent, causing interface incompatibilities. It is also a good idea to tag and keep the old images so a rollback does not require re-downloading:
docker tag <registry>/api:0.15.3 <registry>/api:rollback
If network access to the image registry is unstable, pull everything on one machine first and then distribute it. In cloud environments, you can also use the internal network acceleration capability of a container image service to reduce pull time. This is a general infrastructure capability, independent of any specific vendor.
5. Step 4: Start Up and Verify the Upgrade
docker compose -f docker-compose.yaml up -ddocker compose psdocker compose logs -f api | head -n 100
After startup, verify in the following order and narrow down the problem scope layer by layer:
- Container state layer: all services should be running with no repeated restarts. Repeated restarts usually mean the database connection failed or the migration script did not finish.
- API layer: access the backend health check path and confirm it returns normally.
- UI layer: open the application list page in a browser. A successful login means the main upgrade succeeded.
At this point, “missing workflows” are normal, because the persistent data has not yet been connected to the new directory. This is expected behavior, so do not roll back immediately.
6. Step 5: Take Over the Data Volumes — The Real Fix for Missing Workflows
The persistent directory under the new version’s directory is empty. You need to move the old version’s persistent data over as a whole:
cp -a /opt/ai-platform.bak-YYYYMMDD/docker/volumes/. /opt/ai-platform/docker/volumes/docker compose restart
After the move, refresh the page, and historical applications, workflows, and knowledge base documents should all be restored. If anything is still missing, check two things first: first, whether the copy missed hidden directories (the /. at the end of the cp source path cannot be omitted); second, whether the file ownership inside the data volume matches the user the container runs as. Wrong ownership shows up as “the directory exists but the content cannot be read.”
7. Step 6: Plugin Data Migration (The Core Difficulty)
Under the new architecture, model providers and tools are carried by plugins, so you need to extract the old configuration into a plugin manifest and then reinstall it.
First, locate the core business container:
docker ps # Find the ID of the api container
Second, open a terminal inside the container:
docker exec -it <containerID> bash
Third, export the plugin manifest:
poetry run flask extract-plugins --workers=20
This command scans all workspaces in the current instance and organizes the models and tools in use into plugins.jsonl. workers controls the number of parallel processes and can be lowered according to the CPU and memory available in the container, to avoid the export being killed by OOM.
Fourth, install in the new plugin environment:
poetry run flask install-plugins --workers=2
The installation stage has high network requirements; the container must be able to reach the public internet and the plugin marketplace domains. If outbound access is restricted in an enterprise environment, open the policy in advance, or reduce concurrency to 1 and install one by one to identify the failing item. After installation, restart the plugin-related services and return to the UI to confirm that model providers and tools are available again.
8. Rollback Plan and Post-Upgrade Hardening
Every upgrade plan must include a rollback path. If the new version has a failure that cannot be diagnosed quickly, run:
docker compose downrm -rf /opt/ai-platform/docker/volumes # Only clean the new directory's datacp -a /opt/ai-platform.bak-YYYYMMDD/. /opt/ai-platform/docker compose up -d
After a successful upgrade, three hardening tasks are recommended: write the version number into internal deployment documentation; configure a periodic backup task for the persistent directory; and configure monitoring and alerts for container state and API availability. If you deploy on a cloud container platform, you can combine object storage for off-site backups and combine log services with monitoring and alerting to detect anomalies early. These are all vendor-independent, general engineering practices.
In summary, the safe formula for a cross-major-version upgrade is: full backup → configuration diff merge → pinned image versions → layered verification → data volume takeover → plugin rebuild → rollback fallback. Follow the sequence, and the vast majority of “data loss after upgrade” problems can be avoided in advance.
