mStudio can keep managed apps like WordPress, TYPO3 or Nextcloud up to date automatically. This guide explains how to activate automatic updates via the API, for example for many app installations at once, and how to find out whether an automatic update has failed.
Prerequisites
To manage automatic updates, you will need to have the following:
- The ID of an existing app installation, or the project ID if you want to work on all app installations of a project (how to create a project)
- An app whose current version supports automatic updates (see below)
How automatic updates work
- Update range: Which versions an app installation is automatically updated to is defined by mittwald per app version. The
updateConstraintproperty of the current app version (see GET/v2/apps/ ) contains a SemVer constraint that a newer version must satisfy. Depending on the software, this covers every new version (WordPress), minor and patch updates (Nextcloud, Matomo) or patch updates only (TYPO3, Contao, Drupal, Joomla!, Shopware 6). You cannot change this range yourself.{appId}/ versions/ {appVersionId} - Timing: Automatic updates run directly after the daily system backup of the project. New versions are rolled out gradually, so not every app installation is updated on the day a version is released.
- Failures: If an automatic update fails, the app installation is reset to its previous version, automatic updates are stopped for this app installation, and the project's administrators and developers are notified by email.
Plugins, themes and extensions are not updated automatically.
Find app installations that support automatic updates
Both GET/v2/
autoUpdatesSupported=trueonly returns app installations whose current app version supports automatic updates.autoUpdatesActivated=falseonly returns app installations whose automatic updates are not activated.
Combine both parameters to get all app installations whose automatic updates can be activated:
GET /v2/projects/PROJECT_ID/app-installations?autoUpdatesSupported=true&autoUpdatesActivated=false
Activate or deactivate automatic updates
To activate automatic updates for an app installation, use the PATCH/v2/autoUpdatesActivated property to true:
PATCH /v2/app-installations/APP_INSTALLATION_ID HTTP/1.1
Host: api.mittwald.de
Content-Type: application/json
{
"autoUpdatesActivated": true
}
To deactivate automatic updates, set autoUpdatesActivated to false. To activate automatic updates for many app installations at once, call this endpoint for each app installation returned by the query above. The list endpoints are paginated: use the limit and skip (or page) query parameters and the X-Pagination-TotalCount response header to fetch all pages, otherwise you will only activate automatic updates for the first page of results.
Detect failed automatic updates
The app installation returned by GET/v2/
autoUpdatesActivatedindicates whether automatic updates are currently activated.autoUpdatesStoppedAfterFailureistrueif automatic updates were stopped because an automatic update failed. It is reset when you activate automatic updates again and is not set when automatic updates are deactivated deliberately.lastAutoUpdateFailedAtcontains the time of the last failed automatic update. The value is kept when automatic updates are activated again, so useautoUpdatesStoppedAfterFailureto check whether automatic updates are currently stopped.lastErrorcontains the last error that occurred during an update and is reset on success.
After checking the app installation, activate automatic updates again as described above.