Skip to content

MngInstallComponentUpdate

Starts an asynchronous update of one managed platform component (for example sct-sms) to a specific published version returned by MngGetComponentUpdates.

The platform service sttrader.service is not stopped or restarted. Only the selected component's systemd service is stopped for the switch-over, so the main TCP connection stays available during the update.

Access

The router accepts SESSION_ADMIN and SESSION_CRM_ADMIN, and the resolved staff manager must additionally have the super_admin permission (super_admin = 1). A regular BackOffice or CRM brand administrator cannot install a component update.

The authorization decision is based on the current enabled staff manager record, not solely on values contained in the JWT. The optional update PIN is checked exactly as for MngInstallSystemUpdate.

Request

Field Type Required Description
component string Yes Component name from MngGetComponentUpdates.components[].component; 2–40 characters matching `^[a-z][a-z0-9-]{1,39}---
title: MngInstallComponentUpdate
description: Start installation of a published platform component release without restarting the platform. SuperAdmin only.
tags:
- tcp socket
- manager api
- system updates
- components
- superadmin
---
# MngInstallComponentUpdate

Starts an asynchronous update of one managed platform component (for example sct-sms) to a specific published version returned by MngGetComponentUpdates.

The platform service sttrader.service is not stopped or restarted. Only the selected component's systemd service is stopped for the switch-over, so the main TCP connection stays available during the update.

Access

The router accepts SESSION_ADMIN and SESSION_CRM_ADMIN, and the resolved staff manager must additionally have the super_admin permission (super_admin = 1). A regular BackOffice or CRM brand administrator cannot install a component update.

The authorization decision is based on the current enabled staff manager record, not solely on values contained in the JWT. The optional update PIN is checked exactly as for MngInstallSystemUpdate.

Request

Field Type Required Description
version string Yes Exact released version (X.Y.Z, 5–64 characters) from MngGetComponentUpdates.components[].releases[].version
pin string Required only when pin_required is true Configured 4–6 digit updater PIN. Omit this field when the server reports pin_required: false.
{
  "command": "MngInstallComponentUpdate",
  "data": {
    "component": "sct-sms",
    "version": "1.1.0",
    "pin": "1234"
  },
  "extID": "MngInstallComponentUpdate_1",
  "__token": "<superadmin-jwt>"
}

After the SuperAdmin and PIN checks the server revalidates, in this order, that:

  1. the component has a valid host entry /etc/sttrader/components.d/<component>.json with managed: true and an installed package (404 COMPONENT_NOT_MANAGED otherwise — the first installation is done on the server with install-components.sh);
  2. the version is a valid X.Y.Z strictly newer than the installed version (409 UPDATE_VERSION_NOT_NEWER; downgrades and reinstalls are rejected);
  3. the component registry can be read (503 UPDATE_REGISTRY_UNAVAILABLE);
  4. the version is published with release: true (409 RELEASE_NOT_AVAILABLE);
  5. the release's requires_platform range is satisfied by the running platform (409 COMPONENT_INCOMPATIBLE);
  6. no platform or component update owns the host update lock or has an unfinished reservation (409 UPDATE_IN_PROGRESS).

The server then refreshes the updater binary and starts it with --mode component. Under systemd the updater runs in its own transient unit sttrader-component-updater-<operation_id>.

Clients must not derive or submit an arbitrary version without first retrieving the release list.

Accepted response

Handler status: 202.

{
  "accepted": true,
  "component": "sct-sms",
  "version": "1.1.0",
  "status_available": true,
  "update_id": "upd-1790142000-a1b2c3d4e5f6",
  "status_port": 8098,
  "status_token": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
  "status_retention_seconds": 60
}
Field Type Description
accepted bool Always true: the updater process was launched
component string Component being updated
version string Target component version
status_available bool Whether the temporary updater status endpoint is enabled for this operation; always returned
update_id string Update identifier for GetUpdateStatus; present when status_available is true
status_port int TCP port of the temporary updater status endpoint on the same host; present when status_available is true
status_token string Per-update bearer token (64 hex characters) for GetUpdateStatus; present when status_available is true
status_retention_seconds int How long a terminal status remains available; present when status_available is true

accepted: true means the updater was launched. It does not confirm that the component was replaced or verified. The updater then downloads the package, checks its Ed25519 manifest signature, size and SHA-256, stages and smoke-checks it, stops the component service, snapshots the component data files (config.toml, SQLite databases and their sidecars), installs the new systemd unit, switches the current release link, starts the service and waits for the component to report readiness. If the new version does not become ready, the updater automatically restores the previous release, its unit and the data snapshot taken before the update; data written by the component during the failed start is lost. See Platform components.

Update status

Progress is read with the same GetUpdateStatus command on the temporary status endpoint as for platform updates. BackOffice keeps the hostname of its current platform connection and replaces only the port with status_port.

{
  "command": "GetUpdateStatus",
  "data": {
    "update_id": "upd-1790142000-a1b2c3d4e5f6",
    "token": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
  },
  "extID": "GetUpdateStatus_1"
}

For component operations the response data additionally contains component:

{
  "extID": "GetUpdateStatus_1",
  "status": 200,
  "data": {
    "update_id": "upd-1790142000-a1b2c3d4e5f6",
    "component": "sct-sms",
    "target_version": "1.1.0",
    "state": "verifying",
    "progress": 90,
    "message": "Waiting for the component to become ready",
    "started_at": 1790142000,
    "updated_at": 1790142024,
    "terminal": false,
    "success": false
  }
}

Fields, states and endpoint errors are described in MngInstallSystemUpdate — Update status endpoint. Component operations report these states and stage-based progress values:

State Progress Meaning for a component
preparing 5 Resolving and checking the published release
downloading 10 Downloading the package
validating 25 Checking package size and SHA-256 (the manifest signature is checked before the download)
staging 40 Unpacking to releases/<version> and running app.js --version
stopping 50 Stopping the component service; component downtime starts
backing_up 60 Copying the data files of shared/ and the unit to backups/<operation_id>/
installing 70 Installing the unit and switching current
starting 82 Starting the component service; migrations run
verifying 90 Waiting for the readiness marker and 5 seconds of stable activity
rolling_back 92 Restoring the previous release, unit and data snapshot
completed 100 Terminal, success: true
rolled_back 100 Terminal: the previous version and data snapshot were restored and the component is running again
failed 100 Terminal: the update failed before downtime (nothing changed), or automatic rollback was not possible and an operator must intervene on the server

Because the platform keeps running, the main TCP connection is not interrupted. After terminal: true, or if the temporary endpoint disappears, call MngGetComponentUpdates and confirm installed_version, running_version and update_state.

Errors

Handler status Error Meaning
400 INVALID_DATA component or version is missing, is not a string or violates its length constraints
403 NOT_ENOUGH_RIGHTS The resolved manager is not a SuperAdmin
403 UPDATE_PIN_REQUIRED The server requires an updater PIN and none was supplied
403 UPDATE_PIN_INVALID The supplied PIN is malformed or incorrect
429 AUTH_RATE_LIMITED The update PIN attempt limit is active; response data includes retry_after_seconds
503 SECURITY_GUARD_UNAVAILABLE PIN attempt protection is temporarily unavailable; no update was started
404 COMPONENT_NOT_MANAGED The name is invalid, the component has no entry in /etc/sttrader/components.d/, the entry has managed: false or is invalid, or no package is installed on this host
409 UPDATE_VERSION_NOT_NEWER The version is not a valid X.Y.Z strictly newer than the installed component version
409 RELEASE_NOT_AVAILABLE The version is not published with release: true in the component registry
409 COMPONENT_INCOMPATIBLE The release's requires_platform range is not satisfied by the running platform
409 UPDATE_IN_PROGRESS Another platform or component update owns the host update lock or has an unfinished reservation
503 UPDATE_REGISTRY_UNAVAILABLE The component registry could not be reached or validated while checking the target version
500 UPDATER_START_FAILED The server could not refresh or launch the updater process

Error responses contain only error; BackOffice maps the code to its own text. The PIN errors and rate limiting are identical to MngInstallSystemUpdate (AUTH_RATE_LIMITED additionally carries retry_after_seconds).

{
  "error": "COMPONENT_INCOMPATIBLE"
}

Only one update can run on a host at a time: a component update and a platform update share the same lock, so a component update is rejected while the platform is being updated and vice versa.

Rolling back a component to an older version is not available through the API. It is an emergency server-side operation; see Emergency rollback.

Journal

Every install attempt is written to the product journal with its request, with sensitive fields such as pin redacted. The response is intentionally omitted because it contains the temporary status token.