Skip to content

Platform Components

The Node.js services sct-sms, sct-click2call, sct-mailer and sct-ai are platform components. Each component has its own version and its own release package in the platform registry. The platform updater installs, updates and, if a start fails, automatically rolls back a component under systemd — without stopping or restarting sttrader.service.

This guide is for engineers who install and operate servers and for engineers who publish component releases. BackOffice users update components from the Components tab of System Updates; the API is described in MngGetComponentUpdates and MngInstallComponentUpdate.

Centralized rollouts

Component updates are started manually from BackOffice (SuperAdmin + PIN) or by an engineer on the server. Mass component rollouts from the License Console are a planned future stage and are not available yet.

Concepts

Term Meaning
Platform sttrader in /etc/sttrader, running as sttrader.service
Component Separately versioned Node.js service connected to the platform through NATS/Moleculer: sct-sms, sct-click2call, sct-mailer, sct-ai
Package <component>-<version>-linux-x64.tar.gz containing the component, a bundled Node.js 22 runtime (the same version for all components) and production dependencies. No npm, nvm or pm2 is needed on the server
Registry https://ctl.scaletrade.com/registry, the same registry as for platform releases. Only releases published with release: true are visible to BackOffice and the updater
Managed component Installed on the same host as the platform and updated by the platform updater
External component Runs on another machine (managed: false). It is shown in BackOffice with its running version but is updated manually

Host component registry

The components of a host are registered in the directory /etc/sttrader/components.d/, one file per component named <component>.json. One file per component lets the installation and migration scripts add or remove an entry atomically, and changes never require a platform restart.

Managed component, /etc/sttrader/components.d/sct-sms.json:

{
  "schema_version": 1,
  "component": "sct-sms",
  "managed": true,
  "root": "/srv/sct-sms",
  "service": "sct-sms",
  "user": "sct"
}

External component, /etc/sttrader/components.d/sct-ai.json:

{
  "schema_version": 1,
  "component": "sct-ai",
  "managed": false
}
Field Description
schema_version Always 1
component Component name matching ^[a-z][a-z0-9-]{1,39}$; must equal the file name without .json
managed true: installed on this host and updated by the updater. false: external component, displayed only
root Managed only. Component root directory; absolute, normalized and at least two levels deep, for example /srv/sct-sms
service Managed only. systemd service name without .service
user Managed only. Unix user the service runs as; sct

Rules:

  • A missing directory means no components. Files whose names do not end in .json or start with . (editor backups, temporary files of an atomic write) are ignored.
  • A component without a file is not installed on this host. A component that has no file but whose node announces itself on the platform bus is shown in BackOffice as external.
  • An invalid file makes MngGetComponentUpdates fail with 500 COMPONENTS_CONFIG_INVALID and is never guessed around. The scripts maintain these files; create one by hand only to register an external component.

Server layout

Each managed component uses the same directory layout under its root:

/srv/sct-sms/
  releases/
    1.0.0/                  # previous version (rollback target)
    1.1.0/                  # current version, not writable by the service
      component.json
      node/bin/node
      app/                  # application, config.example.toml, production node_modules
      systemd/service.in
      release-notes.md
  current -> releases/1.1.0 # relative symlink, switched atomically
  shared/                   # service working directory, owned by sct
    config.toml             # mode 0600, never part of a package
    sct-sms.sqlite (+ -wal, -shm)
    logs/
    run/status.json         # readiness marker
  backups/<operation_id>/   # data snapshot taken before an update (mode 0700)
  • The updater keeps current and the newest older release; older releases and leftovers of interrupted staging (releases/.staging-<operation_id>) are removed after a successful update.
  • Package files under releases/ are written by the updater (root) and are not writable by the service user.
  • The service runs with WorkingDirectory=<root>/shared, so config.toml, the SQLite database and logs/ resolve to shared/. Resources shipped in the package (migrations, seeds, sct-ai knowledge) are resolved from the application directory.
  • config.toml with provider keys is created once at installation (or carried over by migration) and is never overwritten by an update.

Package passport: component.json

{
  "schema_version": 1,
  "component": "sct-sms",
  "version": "1.0.0",
  "build_id": "20261125T100000Z-ab12cd3ef456",
  "built_at": "2026-11-25T10:00:00.000Z",
  "platform": "linux-x64",
  "node_version": "v22.23.5",
  "requires_platform": ">=1.26.10",
  "entry": "app/app.js",
  "ready_timeout_seconds": 120
}

<root>/current/component.json is the installed version shown in BackOffice. ready_timeout_seconds (10–1800, default 120) is how long the updater waits for readiness after a start; sct-ai uses 300 seconds because it builds its knowledge index.

Readiness marker

The service writes shared/run/status.json atomically during its lifecycle:

{
  "component": "sct-sms",
  "version": "1.1.0",
  "build_id": "20261126T080000Z-cd34ef5a7b90",
  "pid": 41237,
  "state": "ready",
  "started_at": "2026-11-26T09:12:03.120Z",
  "updated_at": "2026-11-26T09:12:05.480Z",
  "node_id": "sct-sms-1"
}
Field Description
state starting, ready (after migrations and the Moleculer broker start), failed (fatal startup error or abnormal exit) or stopped (normal exit)
pid Process ID; the updater requires it to equal the systemd MainPID
version, build_id, component Taken from the package passport
started_at, updated_at ISO 8601 timestamps
node_id Moleculer node ID, present when ready
exit_code, error Present for failed / stopped; error describes the failure

The service also announces { "component", "version", "build_id" } in its Moleculer node metadata (the running version in BackOffice) and uses the stable node ID <component>-1 unless config.toml overrides it.

node app.js --version prints the package version and exits without reading the configuration, database or NATS; the updater uses it as a smoke check of a staged package.

systemd units and the sct user

Every managed component runs as a systemd service under the dedicated unprivileged system user sct (created by the installation and migration scripts; no login shell, no home directory). Only the updater runs as root.

Each package contains the unit template systemd/service.in with the placeholders @COMPONENT@, @SERVICE@, @ROOT@ and @USER@. On every installation and update the updater renders it into /etc/systemd/system/<service>.service, so the unit changes together with the package version and is restored together with it on rollback. The rendered unit for sct-sms:

[Unit]
Description=ScaleTrade SMS service (sct-sms)
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=sct
Group=sct
WorkingDirectory=/srv/sct-sms/shared
ExecStart=/srv/sct-sms/current/node/bin/node /srv/sct-sms/current/app/app.js
Environment=NODE_ENV=production
Environment=TZ=UTC
Restart=always
RestartSec=5
TimeoutStopSec=20
KillSignal=SIGTERM
KillMode=mixed
MemoryMax=500M
UMask=0027
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
StandardOutput=journal
StandardError=journal
SyslogIdentifier=sct-sms

[Install]
WantedBy=multi-user.target
Component TimeoutStopSec MemoryMax ready_timeout_seconds
sct-sms 20s 500M 120
sct-click2call 20s 500M 120
sct-mailer 25s 1G 120
sct-ai 95s 1G 300

StartLimitIntervalSec=0 keeps systemd restarting the service indefinitely (for example while the database is unreachable), and TZ=UTC is required by the services. Do not edit the rendered unit: the next update replaces it.

Day-to-day operations:

sudo systemctl status sct-sms
sudo systemctl restart sct-sms
sudo journalctl -u sct-sms -n 200 --no-pager
cat /srv/sct-sms/shared/run/status.json

Update flow and automatic rollback

An update is started from BackOffice (System Updates → Components → Update, SuperAdmin with PIN). The platform checks the request, takes the reservation and starts the updater in a transient systemd unit sttrader-component-updater-<operation_id>. The updater performs these steps; state names and progress are reported by GetUpdateStatus:

# Step State
1 Take the host-wide update lock /etc/sttrader/.update.lock (one update per host, platform or component) and the reservation /etc/sttrader/.component-update-<name>.json before start
2 Download the manifest, verify its Ed25519 signature, check release: true and requires_platform against the installed platform preparing
3 Check free disk space, download the package, check its size and SHA-256 downloading, validating
4 Extract, compare component.json with the manifest, run node app/app.js --version, render the unit, move to releases/<version> staging
5 systemctl stop <service> — component downtime starts stopping
6 Snapshot all top-level regular files of shared/ (config.toml, SQLite databases with -wal/-shm/-journal) and the current unit to backups/<operation_id>/, taken while the service is stopped backing_up
7 Install the new unit, daemon-reload, atomically switch current, systemctl enable installing
8 systemctl start <service>; migrations run at startup starting
9 Wait for run/status.json with state: ready, pid equal to the systemd MainPID and version equal to the target, then 5 seconds of stable activity, within ready_timeout_seconds verifying
10 Remove releases except current and the previous one; remove snapshots older than 7 days, always keeping the 3 newest completed

sttrader.service is never stopped in this flow. Component downtime lasts from step 5 until step 9. SMS and e-mail queues are stored in the component database and are processed after the restart.

If steps 2–4 fail, nothing on the host changes and the result is failed.

Automatic rollback. If steps 5–9 fail — the service enters the systemd failed state, writes a failed marker (this triggers rollback immediately), reports another version or does not become ready in time — the updater stops the service, restores the data files and the unit from backups/<operation_id>/ (SQLite sidecars created after the snapshot are deleted), switches current back to the previous release, starts it and waits for readiness. The final state is rolled_back.

Data written during a failed start is lost

Rollback restores the data snapshot taken before the update. Anything the new version wrote between its start and the rollback (usually a few seconds) is discarded. External databases (for example MySQL) are not part of the snapshot and are not restored.

If the rollback itself fails, the state is failed and an engineer must intervene on the server (see below). The component may be stopped in that case.

Rules that keep this safe:

  • Downgrades and reinstalls are rejected (409 UPDATE_VERSION_NOT_NEWER). Returning to an older version is an emergency server-side operation only.
  • Component database migrations are forward-only and must not break the previous code version within one release (expand/contract). This is a development rule, not something the updater enforces.
  • An update that is running blocks every other platform or component update on the host (409 UPDATE_IN_PROGRESS).
  • Every request is written to the product journal: who started it, which component and version, and the result.

Emergency rollback and recovery

Rollback to an older version is not available in BackOffice. It is an emergency tool run as root on the server:

sudo /etc/sttrader/updater --mode component --component sct-sms --rollback --confirm-data-loss

The updater:

  1. selects the newest snapshot in backups/ whose update went to the installed version (to_version in its meta.json); the snapshot of an initial installation cannot be used;
  2. requires the release it came from to still be in releases/;
  3. stops the service, restores the snapshot's data files and unit, switches current to that release, starts it and waits for readiness.

All data the component wrote since that update is lost, which is why --confirm-data-loss is mandatory; the updater prints the snapshot time before starting. Use it only when the new version misbehaves after a successful update and a fix release cannot be published quickly. Because the updater keeps only one previous release and snapshots for about a week, an emergency rollback is possible only to the version installed immediately before the current one. The operation takes the same lock and reservation as an update; its result is visible in BackOffice as update_state.

If an operation was interrupted (for example the host rebooted during an update), its reservation stays non-terminal and every further update on the host is rejected with UPDATE_IN_PROGRESS. After inspecting the server and the journal, mark that operation as failed:

sudo /etc/sttrader/updater --mode component --component sct-sms --recover-operation <operation_id>

The operation_id is the 32-hex identifier shown in BackOffice (update_state.operation_id) and stored in /etc/sttrader/.component-update-<name>.json; it differs from the update_id of the status channel. --recover-operation only releases the stuck operation under the same lock. It does not download, install, restore or control the service; check that the component runs on a consistent release before starting a new update. The platform equivalent is /etc/sttrader/updater --mode systemd --service sttrader --recover-operation <operation_id>.

Compatibility rules

  • Every component release declares requires_platform. The updater and BackOffice refuse a release whose range is not satisfied by the installed platform (409 COMPONENT_INCOMPATIBLE). BackOffice shows such releases as incompatible. A first installation picks the highest published release compatible with the installed platform.
  • A platform release may declare components — the minimum compatible component versions, for example { "sct-ai": ">=1.0.0" }. Before a platform update BackOffice shows a warning for every installed component that does not satisfy it ("update sct-ai to >=1.0.0 first") and asks for explicit confirmation; it does not block the update. See MngGetSystemUpdates.
  • A version range consists of space-separated tokens: an X.Y.Z version optionally prefixed by >=, >, <=, < or =; a bare version means =. All tokens must hold; an empty range accepts any version. Example: >=1.26.10 <1.28.0.
  • Contract changes between the platform and a component (event and action names, fields) keep both the old and the new variant for at least one platform release, so the update order is not critical.

Installed and running versions

BackOffice shows two independent versions for every component:

  • Installed — from <root>/current/component.json of a managed component.
  • Running — from the Moleculer metadata announced by the live node.

A difference between them, or a managed component without a live node, is shown as a warning. Typical causes: the service is stopped or crash-looping (check journalctl -u <service> and shared/run/status.json), or it was not restarted after a manual change.

Engineer tools

The installation and migration scripts are published in the registry together with a checksum file:

cd /root
base=https://ctl.scaletrade.com/registry/components/tools
curl -fsSLO "$base/install-components.sh"
curl -fsSLO "$base/migrate-components.sh"
curl -fsSLO "$base/SHA256SUMS"
sha256sum -c SHA256SUMS

Both scripts run as root, refresh the bootstrap updater (https://ctl.scaletrade.com/updater → /etc/sttrader/updater) before installing, and stop with "the platform updater does not support components yet" when the platform must be updated first. Running a script without arguments or with --help prints its usage.

New installation

Components are installed after the platform, as two steps per component: prepare creates the layout and the configuration, the engineer completes the configuration, and install installs and starts the service.

# 1. Platform, as described in the Main Server installation guide
curl -fSL https://ctl.scaletrade.com/install.sh -o /tmp/sttrader-install.sh
sudo env INSTALL_TARGET=server bash /tmp/sttrader-install.sh

# 2. Layout and configuration (NATS of this platform)
sudo env NATS_URL=nats://127.0.0.1:4222 NATS_USER=<user> NATS_PASSWORD=<password> \
    bash install-components.sh prepare sct-sms sct-mailer sct-click2call sct-ai

# 3. Review /srv/<component>/shared/config.toml: providers, [platform], API keys

# 4. Install and start
sudo bash install-components.sh install sct-sms sct-mailer sct-click2call sct-ai

# 5. Check
sudo bash install-components.sh status
Command What it does
prepare <component>... Checks that the platform (/etc/sttrader/version.json), systemd and curl are present; creates the sct user if absent; creates /srv/<component>/shared, shared/logs and shared/run owned by sct; downloads the configuration template registry/components/<component>/releases/<latest>/config.example.toml and writes shared/config.toml (mode 0600) with url, user and password in [transporter.options] taken from NATS_URL, NATS_USER and NATS_PASSWORD. An existing config.toml is kept; an already installed component is skipped; a directory holding a legacy pm2 installation is refused (use the migration script)
install <component>... Refreshes and checks the bootstrap updater; warns if the configuration still contains the template NATS credentials; writes /etc/sttrader/components.d/<component>.json; runs /etc/sttrader/updater --mode component --component <component> --install. Without --version the updater picks the highest published release compatible with the installed platform, verifies and stages it, installs the unit, enables and starts the service and waits for readiness. On failure the installation is removed, the entry is deleted and the script points to journalctl -u <component> and shared/run/status.json
status Lists the entries in components.d with installed version, systemctl is-active state and the readiness marker state

Environment:

Variable Default Used by
NATS_URL, NATS_USER, NATS_PASSWORD empty (template value kept) prepare
SCT_REGISTRY_URL https://ctl.scaletrade.com/registry prepare
SCT_SERVICE_USER sct all commands

The updater starts a service only when shared/config.toml exists. No npm ci, nvm or pm2 is involved. Then open System Updates → Components in BackOffice and check that each component shows its installed and running version and is online. Later updates are done from BackOffice.

Migrating existing servers from pm2

Servers installed before components existed run the services from source directories under pm2 (ecosystem.config.js, Node from nvm, code, data and logs in one directory such as /srv/sct-sms). They are converted once by an engineer over SSH with migrate-components.sh, one component at a time. Migration is not started from BackOffice because it changes the directory layout and the process manager.

migrate-components.sh inventory
migrate-components.sh migrate <component> [--dry-run] [--legacy-dir DIR] [--pm2-name NAME] [--accept-local-changes]
migrate-components.sh revert <component> [--restore-pre-migration-data]
migrate-components.sh cleanup <component> --confirm

Only the known components sct-sms, sct-click2call, sct-mailer and sct-ai are accepted. The mailer historically runs as the pm2 process mailer from /srv/mailer; it is found automatically and migrated to /srv/sct-mailer and the service sct-mailer. Environment: PM2 (path to the pm2 binary when it is not on PATH or in root's nvm), SCT_SERVICE_USER (default sct). pm2 itself is never removed: other applications may use it.

Prerequisites

  1. The platform on the server is updated (normally from BackOffice) to a release that supports components.
  2. Component packages of the same or a newer version than the one running on the server are published in the registry. Migration installs the latest published release compatible with the platform, so new database migrations may run on the first start.
  3. The server inventory is complete and reviewed.

Inventory

sudo bash migrate-components.sh inventory

The inventory changes nothing. It reports the host, platform version, pm2 location, free space in /srv, the operating system, glibc and systemd versions (packages need glibc 2.28 or newer), and for every known component whether it is already managed (version and service state), not installed, or a legacy pm2 installation with:

  • directory and package.json version;
  • pm2 name, status and Node version;
  • whether config.toml is present;
  • the database client from [databases.main] and the size of the SQLite files;
  • an ATTENTION line when config.toml contains absolute paths into the legacy directory (migration refuses such a configuration: make the paths relative first, because the working directory becomes shared/);
  • local code state: "clean git checkout matching upstream", or the reason local changes cannot be ruled out — not a git checkout, uncommitted changes (ignoring config.toml and ecosystem.config.js), or commits not pushed. Changes made directly on the server are lost after migration and must be moved into the component repository and released before migrating.

Migrate

# print the plan and the checks, change nothing
sudo bash migrate-components.sh migrate sct-sms --dry-run

# migrate
sudo bash migrate-components.sh migrate sct-sms
Option Purpose
--dry-run Print the plan, warnings and checks; change nothing
--legacy-dir DIR Legacy directory when it is not the standard one (must be under /srv)
--pm2-name NAME pm2 process name when it is not the standard one
--accept-local-changes Proceed although local code changes could not be ruled out (required in that case)

Checks before anything changes: the component is not migrated yet and no unfinished migration exists (/srv/<component>/.migration); the legacy installation and its config.toml exist; config.toml has no absolute paths into the legacy directory; local code changes are ruled out or accepted. A database client other than SQLite produces a warning: that database is not in the updater snapshot — back it up before migrating.

Then the script:

  1. refreshes the bootstrap updater and creates the sct user if needed;
  2. stops the pm2 process;
  3. moves the legacy installation unchanged to /srv/<component>/legacy-<UTC timestamp>/ and records the migration state in /srv/<component>/.migration;
  4. creates shared/, shared/logs, shared/run and copies config.toml and *.sqlite (with -wal/-shm) into shared/; config.toml gets mode 0600;
  5. writes /etc/sttrader/components.d/<component>.json and runs updater --mode component --component <component> --install (latest compatible release, readiness check included);
  6. on success deletes the pm2 process and runs pm2 save.

If the installation fails, the script reverts automatically with the pre-migration data and the pm2 process is running again. Expect about one minute of downtime per component; choose a low-activity window for sct-click2call. After migration open System Updates → Components in BackOffice and check that the version is displayed and the node is online.

Revert

sudo bash migrate-components.sh revert sct-sms
sudo bash migrate-components.sh revert sct-sms --restore-pre-migration-data

revert stops and disables the systemd service, removes the unit and the components.d entry, moves the legacy installation back to its original directory and starts the original pm2 process (or starts it from the legacy ecosystem.config.js, keeping the original sct-ai interpreter), then runs pm2 save. The managed layout is moved aside to /srv/.<component>-reverted-<timestamp> for inspection; delete it manually when no longer needed.

  • By default the current config.toml and SQLite files from shared/ are carried back into the legacy installation, so data written after the migration is kept. This works only while the new release added no database migrations the old code cannot handle.
  • --restore-pre-migration-data keeps the legacy data exactly as it was before the migration; everything written since the migration is lost.

revert is possible as long as /srv/<component>/.migration and the legacy copy exist, that is, until cleanup.

Cleanup

About two weeks after a server was migrated and verified:

sudo bash migrate-components.sh cleanup sct-sms --confirm

It requires the component to run from the managed layout and permanently deletes the legacy copy and .migration. After cleanup revert is no longer possible.

Rollout order

  1. Test stand — full cycle: migration, component update, forced start failure with automatic rollback, revert.
  2. Pilot — one or two client servers with a full inventory, observed for 3–5 days.
  3. Waves of 5–10 servers. Track every server:

    Client Server Components Inventory Local changes Migrated Checked in BackOffice Legacy removed
    [ ] none / moved [ ] [ ] [ ]
  4. After all servers are migrated — the first real component update from BackOffice on the pilot servers. Mass updates through the License Console follow in a later stage.

Publishing component releases

This section is for release engineers. The tools live in tools/components/ of the ion-server repository.

Building a package

Each service repository contains:

  • packaging/component.json — schema_version, requires_platform, ready_timeout_seconds and include, the list of repository files copied into app/ (must contain app.js, package.json, package-lock.json; the services also ship config.example.toml);
  • packaging/service.in — the systemd unit template;
  • release-notes/<version>.md — English release notes for the package.json version, which is raised in every release (semver).

Packages are built in the builder image on Linux x86_64. The image is based on AlmaLinux 8 (glibc 2.28, maintained until 2029). glibc 2.28 is also the minimum of the bundled Node.js 22, so packages load on every distribution Node.js 22 supports (Debian 10+, Ubuntu 20.04+, RHEL 8+). Debian 11 is not used: after its end of life the mirrors started to remove packages.

docker build -t sct-component-builder -f tools/components/Dockerfile.builder tools/components
docker run --rm -v /path/to/sct-sms:/src:ro -v "$PWD/dist:/out" sct-component-builder /src /out

build-component.sh <service-repo> <out-dir>:

  1. downloads the Node.js version pinned in tools/components/node-version (currently v22.23.5) and verifies its checksum;
  2. runs npm ci && npm test on a clean copy of the repository (SKIP_TESTS=1 skips this; never publish such a package);
  3. copies the include list into app/, installs production dependencies with the bundled npm, adds the Node binary, the unit template and the release notes, and writes component.json;
  4. refuses local state in the package (config.toml, *.sqlite*, .env);
  5. smoke-checks the package: app.js --version must print the version without creating files, sqlite3 must load, and the service must read its passport;
  6. writes a reproducible <out-dir>/<component>-<version>-linux-x64.tar.gz and prints its size and SHA-256.

Environment: NODE_VERSION (override), NODE_CACHE, BUILD_ID, SKIP_TESTS.

Registry layout

registry/
  index.json, latest.json, releases/...      # platform, unchanged
  components/
    index.json                               # summary of all components
    tools/                                   # install/migrate scripts and SHA256SUMS
    sct-sms/
      latest.json                            # highest published version
      releases/1.0.0/
        manifest.json
        sct-sms-1.0.0-linux-x64.tar.gz
        release-notes.md
        config.example.toml                  # template used by install-components.sh

components/index.json lists drafts and published releases, newest first:

{
  "schema_version": 1,
  "updated_at": "2026-11-26T09:00:00.000Z",
  "components": {
    "sct-sms": {
      "releases": [
        {
          "version": "1.0.0",
          "release": true,
          "built_at": "2026-11-25T10:00:00.000Z",
          "released_at": "2026-11-26T09:00:00Z",
          "requires_platform": ">=1.26.10",
          "manifest": "sct-sms/releases/1.0.0/manifest.json"
        }
      ]
    }
  }
}

components/<component>/latest.json:

{
  "schema_version": 1,
  "component": "sct-sms",
  "version": "1.0.0",
  "manifest": "releases/1.0.0/manifest.json",
  "updated_at": "2026-11-26T09:00:00Z"
}

manifest.json (release notes are the separate release-notes.md file, not a manifest field):

{
  "schema_version": 1,
  "component": "sct-sms",
  "version": "1.0.0",
  "build_id": "20261125T100000Z-ab12cd3ef456",
  "built_at": "2026-11-25T10:00:00.000Z",
  "platform": "linux-x64",
  "requires_platform": ">=1.26.10",
  "release": true,
  "released_at": "2026-11-26T09:00:00Z",
  "released_by": "release-engineer",
  "artifact": {
    "file": "sct-sms-1.0.0-linux-x64.tar.gz",
    "size": 73400320,
    "sha256": "<64 hex characters>"
  },
  "signature": {
    "alg": "ed25519",
    "key_id": "components-2026",
    "value": "<base64 of 64 bytes>"
  }
}

Publishing

Components are published on the registry host with the same deploy.sh as platform releases, using the same lock and staging:

# draft (release: false), signed; invisible to BackOffice and the updater
export ST_COMPONENT_SIGNING_KEY=/path/to/components-2026.pem
export ST_COMPONENT_SIGNING_KEY_ID=components-2026
./deploy.sh component-prepare dist/sct-sms-1.1.0-linux-x64.tar.gz

# publish the draft (release: true)
./deploy.sh component-release sct-sms 1.1.0

# publish install-components.sh, migrate-components.sh and SHA256SUMS
./deploy.sh component-tools
Command What it does
component-prepare <component>-<version>-linux-x64.tar.gz Validates the archive (name, single top-level directory, no unsafe files or escaping symlinks, passport and app/package.json consistent, required files present, no local state), creates releases/<version>/ with the package, release-notes.md, config.example.toml and a draft manifest, signs it with ST_COMPONENT_SIGNING_KEY / ST_COMPONENT_SIGNING_KEY_ID and verifies the signature against tools/components/trusted-keys.json. An existing release directory is never overwritten
component-release <component> <version> Verifies the artifact checksum and the signature against the pinned keys, sets release: true, released_at and released_by, moves latest.json forward only if this version is newer, and refreshes components/index.json
component-tools Publishes the engineer scripts and SHA256SUMS to registry/components/tools/

Install and test a draft on the test stand before releasing it. A platform release declares its minimum component versions in the components field of version.json; deploy.sh prepare copies them to the platform release manifest and index.json.

Signing key

Component manifests are signed with Ed25519 when a draft is prepared. The updater verifies the signature with public keys compiled into it (services/ComponentSigningKeys.hpp), selected by signature.key_id; a manifest with a missing, unknown or invalid signature is rejected before the package is downloaded.

Production key

Until the production key is generated and its public key is pinned in both services/ComponentSigningKeys.hpp and tools/components/trusted-keys.json, the key lists are empty: deploy.sh refuses to prepare packages and updaters reject every component with "no trusted component signing keys are configured". A new key requires a platform release that pins it before packages signed with it can be installed.

# create the key on the registry host (mode 0600) and print the public key to pin
node tools/components/component-manifest.js keygen /secure/components-2026.pem

tools/components/trusted-keys.json:

{
  "schema_version": 1,
  "keys": {
    "components-2026": "<base64 raw Ed25519 public key>"
  }
}

The signed payload is UTF-8 text with LF line endings:

sct-component-manifest-v1
<component>
<version>
<platform>
<requires_platform>
<artifact.file>
<artifact.size>
<artifact.sha256>

Each line, including the last, ends with \n. The JSON document itself is not signed. The publication fields release, released_at and released_by are not part of the payload, so component-release does not need the signing key. The private key stays on the registry host with access restricted to release engineers and is never committed to a repository.

component-manifest.js command Purpose
keygen <private-key.pem> Create a new Ed25519 private key (mode 0600, never overwrites) and print the raw public key in base64
public-key <private-key.pem> Print the raw base64 public key of an existing private key
sign <manifest.json> <private-key.pem> <key-id> Validate the manifest, add signature and self-verify it
verify <manifest.json> <trusted-keys.json> Verify a manifest against the trusted keys and print the key ID
payload <manifest.json> Print the exact signed payload for troubleshooting