Local Web Service Deployment and Rollback After a Multimodal Upgrade
This guide explains how to deploy and roll back a local web service after a multimodal upgrade. It covers variable conventions, vision-related input constraints, pre-upgrade environment checks, version pinning, installation verification, service startup, port handling, and initial validation steps, with commands and rollback preparation.
Define Variables First
The commands below use the following variables. The example values are for demonstration only; replace them with the actual package name, version, and parameters from the release notes.
| Variable | Example value | Description |
|---|---|---|
| TOOL | mmtool | Command-line entry name |
| PKG | mmtool | npm package name |
| VERSION | 1.4.2 | Target version for this upgrade |
| OLD_VERSION | 1.3.0 | Old version to use for rollback |
| PORT | 3080 | Default service port |
1. New Changes Introduced by Vision Capabilities
Vision capabilities allow the service to process screenshots, forms, receipts, charts, and document images. This adds several steps to the call chain: image upload, format validation, size limits, content safety checks, and log redaction. Operations teams also need to monitor ports, file permissions, dependency versions, and browser access methods.
An upgrade usually involves two parts. The model side determines whether the service can understand images, while the host tool side determines whether the service can start, be managed, and be accessed reliably. Therefore, an upgrade is not just a single install command. It is a complete process that includes environment confirmation, version selection, installation verification, startup testing, and a rollback plan.
Common image input limits are listed below. Confirm the specific values in the release notes before use:
- Formats: PNG, JPEG, WebP
- Single file size: no more than 10 MB
- Long-edge resolution: no more than 4096 pixels
- Content safety: intercept violating content before upload and log the interception result without saving the image
- Log redaction: do not write raw images, Base64 strings, or full prompt content to logs
2. Pre-Upgrade Environment Checks
Check each item in the table below before upgrading. Each item has a pass criterion and failure handling. Proceed to installation only after all items pass.
| Check item | Command | Pass criterion | Failure handling |
|---|---|---|---|
| Node.js version | node --version |
Not lower than 18.0.0 | Install a version that meets the requirement with a version manager |
| npm version | npm --version |
Not lower than 9.0.0 | Upgrade npm or switch to the corresponding Node.js version |
| Disk space | df -h ~ |
At least 2 GB free in the home directory | Clean caches or change the installation directory |
| Package source reachable | npm ping |
Returns pong | Check the HTTPS_PROXY proxy variable and registry settings |
| Certificate | npm config get cafile |
In enterprise environments, returns the internal certificate path | Configure the root certificate provided by the team |
| Global directory writable | npm config get prefix |
Points to a directory writable by the current user | Run npm config set prefix ~/.npm-global and add bin under that directory to PATH |
Windows users can replace df -h ~ with the disk properties page in File Explorer and replace echo $PATH with echo %PATH%.
Before upgrading, also save the old version. Run the following commands, record the current version number, and download the old version package to a backup directory. npm pack only downloads the archive and does not install it:
npm list -g mmtool --depth=0mkdir -p ~/mmtool-backupcd ~/mmtool-backup && npm pack mmtool@1.3.0
3. Version Strategy and Version Locking
Test environments can use the latest version to evaluate vision capabilities and compatibility. Query the latest version with:
npm view mmtool version
Production environments should pin to a verified version. Create a version lock file tools/mmtool.version in the code repository and write only one line with the version number, for example 1.4.2. For each upgrade, record the upgrade time, reason for the change, and rollback version in the commit history for that file.
The advantage of a global installation is that the command can be called from any directory. The disadvantage is that multiple projects may share the same version. Teams can choose a user-level installation or maintain independent environments per project.
4. Install and Verify
Run the installation command in a test directory, not directly on a production machine:
npm install -g mmtool@1.4.2mmtool --version
The output of mmtool --version should be 1.4.2. If an old version is shown, multiple copies may exist on the system. Run which -a mmtool (use where mmtool on Windows) to view all copies, remove the old copies, or call the new version by its full path.
Any ERR line in the installation log is considered a failure. WARN lines need to be checked one by one to determine whether they affect operation. If permissions are insufficient, do not use sudo for long-term installation; configure a user-level directory as described above.
5. Start the Service and Validate
The default startup command is:
mmtool web
The service listens on 127.0.0.1:3080 by default and automatically opens the browser. In a remote terminal or script, automatically opening the browser may fail or be inappropriate. In that case, use the disable parameter:
mmtool web --no-open
If the port is occupied, first locate the process using it. On macOS and Linux, use:
lsof -i :3080
On Windows, use netstat -ano and find the PID corresponding to port 3080 in the output. Stop the process only after confirming that it belongs to you. Alternatively, use another port:
mmtool web --port 3090
After startup, run validation:
- Loopback access. Run
curl -I http://127.0.0.1:3080/; expectHTTP/1.1 200 OK. - Static resource validation.
