Files
NODEDC_MISSION_CORE/apps/vps-host
..

NODE.DC Mission VPS Host 0.1.41

Version 0.1.41 completes the extracted transport observation batch before a socket closure cancels its sender. Closing a stream can no longer abandon a pending observation commit. All monitoring commands now wait for device input on their selected socket no older than five seconds, as configuration commands already did. Empty send queues alone are insufficient evidence of a live path. The pending intent and original attempt deadlines are preserved; device input wakes the sender without an extra probing command. This mitigates stale-stream dispatch but does not guarantee delivery on a cellular network.

Version 0.1.40 persists command transport observations separately from B2 execution: prepared, written, TCP acknowledged, or unconfirmed with a reason. The Linux send-queue watchdog records when the complete command prefix was acknowledged; it never promotes the command to executed. Socket closure, expiry and process restart preserve uncertainty. Observations are available on command and operation APIs and attempt history, including late observations after a device reply. No payload, password, modem address or SIM identity is logged. Existing deadlines, retry policy and Core-to-VPS polling direction are unchanged.

Version 0.1.39 adds engineering-only probe-diagnostic-mode (INTERNAL SERVER_COM 01 00) for model 231 / firmware 0.01. A separately armed, authenticated observation ID is mandatory; exactly one command may consume each observation. Dispatch is restricted to an existing admitted connection, expires within three seconds, and is never replayed across reconnect/restart. Closing the observation prevents a queued dispatch. There is no raw-command input and this action is absent from the operator catalogue/durable operations. The 180-second lease bounds capture/dispatch, not the device's mode lifetime. A token receipt does not establish a mode change or fresh SIM identity. Physical qualification and termination semantics are recorded separately.

Version 0.1.35 publishes imported state with a single same-filesystem rename. A failed staging copy cannot expose a partial host identity, and restoration does not need a second full-size journal copy.

Version 0.1.34 adds portable, quiesced state export and empty-host import. The source stays fenced across service/OS restarts. TLS identity, ownership, registered devices and the entire durable journal move together. Import uses the exact matching installer and preserves the configured endpoint.

Version 0.1.33 makes service-code directory traversal independent of the root installer caller's umask. Private credentials and state retain their restricted permissions. It otherwise preserves the 0.1.32 durable maintenance runtime.

Version 0.1.31 accepts matching binary command token receipts through either admitted monitoring connection of the same B2, including a reconnected stream. ACK (code 6) remains distinct from a final result. Text replies, revoked devices, unknown sessions and other trackers cannot confirm a binary command.

Version 0.1.30 resumes only independent readback of a committed configure-all image after a VPS process restart or a new B2 connection, preserving its ID, target, original deadline and stage pacing. No image, SIM switch, restart or output action replays. Fresh readback can establish the target, the predecessor or an unknown image; an unavailable device still ends with an uncertain outcome. This is recovery of verification, not proof that the B2 modem can recover autonomously.

Version 0.1.29 additionally defers configuration commands on a silent monitoring stream until the B2 sends fresh input (within five monotonic seconds). A drained TCP queue alone does not prove a live cellular path. The original operation deadline is retained; dispatched stages never replay. Position/output command policy is unchanged. This is a transport admission guard, not a cellular latency guarantee.

Version 0.1.28 answers the observed empty HTTP opcode-7 request with current Unix UTC seconds from the owner's VPS, using the reference-qualified u32be envelope. Only an admitted model-231/0.01 identity with an active matching modem peer can receive it. It does not change settings, complete an operation or extend its deadline. The host clock must be correct. Device dialogue/repeated configuration acceptance is recorded separately; a clock response alone is not that acceptance.

Version 0.1.27 admits a new command only when the selected Linux socket has no unacknowledged kernel bytes or pending asyncio bytes. Among eligible streams the most recently active one wins. Blocked streams cannot steal a command from a drained stream; deadlines remain unchanged and dispatched commands never replay. Transport readiness does not confirm execution.

Version 0.1.26 adds immutable request deadlines for idempotent Core delivery, a durable bounded wait for undispatched position requests, and event-driven idle senders. Terminal operation history is indexed out of the packet/dispatch path. Commands already dispatched to a tracker are never automatically replayed.

The engineering qualify_faults.py harness checks crash recovery, lost HTTP responses, immutable expiry and no replay using the installed package with temporary SQLite and loopback sockets. It does not use production state or physical hardware. See fault qualification.

Version 0.1.25 bounds command bytes in the Linux TCP queue to the earlier of the operation deadline and 30 seconds after dispatch. HTTP settings replies have a 12-second transport bound, capped by the operation deadline. Monotonic watchdogs account for both asyncio and kernel buffers; abortive close prevents queued data from lingering after disconnect. TCP acknowledgement only releases the transport watchdog, never confirms device execution. Interrupted or expired actions are never replayed. Already received commands cannot be cancelled.

Version 0.1.24 adds exclusive SIM selection on qualified B2 model 231 / firmware 0.01: fresh configuration preflight, one image write, exact readback, one restart, and fresh type-1 DS2 evidence of GPRS on the requested SIM over a new connection. The operation has a 360-second bound. Field 72 bits 10/20 prohibit data on the other SIM; this is not automatic failover. APNs and access credentials are kept unless explicitly edited. Interrupted writes/restarts are never replayed. Full cellular-only physical qualification is recorded separately in the ledger.

Version 0.1.23 retains the independently registered numeric-ID reply, but removes the experimental empty settings response: physical 0.1.22 evidence showed an ID/settings loop, not completion. A settings image is still sent only during an explicit, bounded write. Startup qualification remains open.

Version 0.1.22 qualifies the continuous startup exchange: reply with the independently enrolled numeric device ID, then an empty settings response when no explicit image write is pending. Numeric IDs are immutable per IMEI and never inferred from its digits. Unknown IDs and unadmitted peers fail closed. An explicit pending write retains its single-image dispatch/readback contract. Physical qualification of the combined exchange is required before publication.

Version 0.1.21 admits the captured ten-byte command-1 response in a one-shot engineering lease. Its four-byte payload equals the independently known device ID. Product behavior is unchanged pending a fresh, unchanged device upload.

Version 0.1.20 admits one exact empty reply to the observed empty command-1 request in the engineering observation lease. This follows the physical 2→1 transition after an empty command-2 reply. No firmware image can be supplied, and normal product parsing remains closed until the exchange is qualified.

Version 0.1.19 admits one exact, zero-payload command-2 response only in the bounded engineering observation lease for no-image-response qualification. No product-channel behavior changes before physical verification.

Version 0.1.18 adds an engineering-only binary encoding of the documented read-only settings upload request (0109), to qualify post-restart behavior. It does not change the qualified product settings transport or retry writes.

Version 0.1.17 adds the qualified-model restart request (B2 manual §10, binary 0107). Dispatch expires after three seconds; the request is never replayed. A token ACK is recorded separately. Only fresh type-1 telemetry measured after dispatch on a newly opened connection records return, with a 180-second deadline. This is observed network return, not proof of a hardware power cycle. Old sessions, archive packets and replies alone cannot complete the operation.

Version 0.1.16 spaces full-configuration stages and successive operations by 15 seconds after each HTTP image exchange. The bench sometimes ignored a new SERV request shortly after an upload despite TCP acknowledgment. This pacing does not affect position/output commands or replay a settings write.

Version 0.1.15 adds complete configuration reads and profile writes on the qualified B2 model 231 / firmware 0.01 HTTP settings channel. It reads the current image before writing, requires an exact predecessor, preserves recovery channels, sends the image once and verifies by an independent full readback. Command-5 ACK is the captured seven-byte response with payload 01. Restart or timeout after dispatch does not silently replay a write. No manufacturer API is contacted by this runtime.

Version 0.1.14 chooses the active TCP session with the most recent incoming data for command dispatch. A half-open predecessor left by a device configuration reload cannot take a new command while a fresher session exists. It also allows a bounded engineering upload-ACK qualification using the observed reply-envelope structure, matching the complete validated upload body. Up to 64 observation leases are retained (four 16-KiB captures each); raw evidence remains private.

Version 0.1.13 qualifies the observed configuration reply framing with the shared B2 CRC/TLV codec. An engineering observation lease can serve a validated configuration once to a byte-identical admitted B2 settings request. Explicit close disarms the lease while retaining evidence. This is a real write path: prepare an exact baseline and rollback image and verify a fresh device upload; dispatch alone never establishes successful application. No vendor HTTP calls.

Version 0.1.12 additionally permits the documented SERV*1.8 configuration download request for protocol qualification. It can apply a configuration from the device's configured endpoint; that endpoint must be owned and its payload qualified before use. The current observation lease serves only a captured identity answer, never a configuration. No firmware/erase/reset commands exist.

Version 0.1.11 adds an engineering-only, allowlisted B2 settings upload request (SERV*1.9), preserving active-session expiry and no replay. It also permits one captured seven-byte configuration identity answer to the exact corresponding 21-byte request, under an authenticated 180-second observation lease. The device must be admitted; expiry, byte mismatch, duplicate HTTP framing and repeat dispatch fail closed. This is bounded protocol qualification, not a general proxy or full configuration support. The service never contacts a vendor.

Version 0.1.10 adds explicit set-output using the B2 manual section 10 FC command password*SERV*8.PIN.STATE. PIN4..6 only, strict boolean enabled, model 231 / firmware 0.01, instance password required. This sets a persistent output state; it is not a timed pulse or a physical-contact confirmation. It uses the existing active-session, three-second dispatch expiry and no-replay contract. Unknown fields and arbitrary commands are rejected. Bench operators must verify manual output mode and deliberately restore the observed baseline.

Version 0.1.9 adds the documented FC text encoding for the same bounded pulse-output operation: PIN4..6, 1..5 seconds, model 231 / firmware 0.01. An explicit encoding: text requires the instance's six-digit password; the generated command remains private. No arbitrary text is accepted. This format has no token-correlated confirmation: the receipt stays unconfirmed even when unrelated token or text replies arrive. Dispatch still requires a current session and expires after three seconds; commands never replay after restart. A text PIN5 pulse produced an operator- and subsequently camera-observed LED on/off transition. Earlier binary PIN4/PIN5 pulses had no visible effect. A token ACK alone is not relay feedback; other outputs require qualification.

Headless receiver owned by Mission Core, independently of any rover's onboard PC. Supported installation profile: Ubuntu Server 24.04 amd64, Python 3.12, OpenSSL 3, systemd. Other OS/architectures fail preflight. No pip, Docker, GUI, Node.js, compiler or vendor cloud is required. Minimal images missing OS prerequisites are rejected with the missing capability; no blind system repair.

Reproduce

From this repository:

.venv/bin/python scripts/build_vps_host.py --output /tmp/ndc-mission-vps.tar

The builder produces both a .tar engineering archive and a single .pyz operator installer. Mission Core serves an explicitly published, checksum-verified .pyz in Equipment → root plus → VPS Host ARNavi. The same window contains the supported OS, installation instructions and pairing-key field. The installer carries no tracker identities, SIM data, address, keys or private evidence.

Copy the downloaded file to the VPS and run:

sudo python3 ndc-mission-vps.pyz --host trackers.example.org

Use the actual downloaded filename. Omitting --host prompts for the public address. The wrapper runs the same preflight/plan/apply engine, with an exact plan digest; it does not require a separate installer GUI. The engineering tar retains the explicit plan/apply interface:

python3 ndc-mission-vps/install.py plan --host trackers.example.org
python3 ndc-mission-vps/install.py apply --host trackers.example.org --expect PLAN_SHA256

Run apply as root. The exact current plan hash is required. DNS/IP is an install parameter, never source code. Use stable DNS so a VPS migration does not require rewriting thousands of trackers. Default ports: TCP 9922 (B2 INTERNAL), TLS 19443 (Mission Core). Cloud firewall must allow these exact ports. The installer preserves existing services, including DeviceCore on 443/9921. For the detected legacy NODE.DC nodedc_b2_vps nftables policy it adds two comment-owned allow rules and a persistent include, checks predecessor hashes, and records a bounded rollback. It never flushes rules. Unknown firewall policies remain external and require public endpoint acceptance. Existing listener/foreign installation conflicts stop first install.

Installation paths:

  • /opt/nodedc-mission-vps/current: immutable release selected by content digest.
  • /opt/nodedc-mission-vps/connect.key: fixed root-level pairing file, symlink to protected state; read as root.
  • /var/lib/ndc-mission-vps: host identity, TLS key, owner and durable journal, mode 0700, files 0600, owned by dedicated system user ndc-mission-vps.
  • /etc/systemd/system/ndc-mission-vps.service: versioned managed system unit.

Open an apparatus → Equipment → top plus → VPS Host ARNavi. Paste the key, choose a name and served apparatuses. It expires after 24 hours and is consumed once. The same VPS appears under every assigned rover. To attach an existing VPS to another rover, choose it in the connection dialog, or change the host's apparatus list in settings. One host retains one identity and one Mission Core owner.

An unused expired key can be renewed with the shipped CLI:

cd /opt/nodedc-mission-vps/current
sudo -u ndc-mission-vps /usr/bin/python3 -m ndc_vps invitation

Paired hosts cannot silently regenerate/reassign ownership. Back up the whole private state directory and Mission Core fleet state. A new host has a new key. An update retains the same identity and queue. Applying the current release is a health-checking no-op. Failed updates restore the previous release and unit. Explicit rollback preserves private state and the journal:

python3 ndc-mission-vps/install.py rollback --host trackers.example.org --expect INSTALLED_ARTIFACT_DIGEST

For the first release rollback disables the new service; it does not delete identities, evidence or any unrelated service. Schema v1 updates are additive; a future incompatible migration must supply its own reversible migration.

Clean product reinstallation

sudo python3 ndc-mission-vps.pyz --host trackers.example.org --fresh

This explicitly replaces this product's installation and identity. First the installer stops its own unit and creates a private, hash-recorded backup under /var/backups/ndc-mission-vps/. It preserves original application/state trees, then installs empty product state and creates a new pairing key. A failed fresh installation restores the backup and health-checks the old service. Foreign services and unrelated files are preserved. This is not an OS reimage.

In the Core admission form select the previous record under «После переустановки» and paste the new key. Replacement is explicit: duplicate live host records at the same endpoint are refused. The former record and telemetry journal remain in private history; only the newly paired identity is synchronized.

To restore a selected backup with the same installer:

sudo python3 ndc-mission-vps.pyz --host trackers.example.org --restore /var/backups/ndc-mission-vps/BACKUP_ID

After a successful new pairing, restoring the server alone does not restore the Core's host registration. Restore a matching private Core fleet backup as part of disaster recovery; do not substitute identities or disclose tokens manually.

Publish qualified downloads

The operator runtime keeps installers under its private fleet root, outside Git. Publishing a release only changes the download; it never installs on a board or VPS. Run the publisher with the exact SHA from the accepted build receipt:

.venv/bin/python scripts/publish_fleet_installer.py \
  --fleet-root /path/to/operator/fleet --kind vps-arnavi \
  --file /path/to/qualified-vps.pyz --version 0.1.3 --sha256 ACCEPTED_SHA256

For the onboard computer use --kind node and the version/SHA of the already qualified owner installer. Copy the finished installer back from the build host before publishing it. A source-build bundle is not an owner installer. Publishing the Node archive does not update the board. Catalog and download endpoints verify size and SHA; a missing or changed archive is unavailable instead of silently falling back to an older build.

Tracker admission and delivery

Register/read a B2 over USB in Mission Core, select the registered VPS in its connection settings, save, then apply over USB. Slot 2 is initially proposed to preserve an existing slot 1. Profiles contain common settings, not IMEI/ICCID, SIM phone number or assignment. Firmware-qualified writer performs backup, identity/config preconditions, acknowledgement and independent readback.

Core synchronizes an allowlist of registered IMEIs assigned to that host's apparatuses and configured endpoint. Unknown devices receive no telemetry ACK. IMEI is a claimed identity, not cryptographic tracker authentication: legacy INTERNAL is plaintext. For untrusted deployments use an operator private APN or network protection; this release does not claim end-to-end tracker encryption.

VPS ACKs a B2 package only after a SQLite FULL commit. Core pulls a bounded batch, stores raw evidence, derives valid coordinates and advances its cursor in the same transaction, then acknowledges the VPS queue. Replays are idempotent; package sequence reuse cannot replace content. Header-time and package ACKs follow the published INTERNAL framing. No arbitrary tracker command API exists.

The authenticated VPS API also qualifies the allowlisted, read-only GETP command over an existing tracker TCP session. Commands have durable IDs and bounded expiry; a dispatched command is never automatically replayed after a restart. A text response means reply_received, not «settings applied». Version 0.1.6 adds the bounded configure-server1 operation for B2 model 231 / firmware 0.01. Fresh GETP must match the expected primary endpoint and show this VPS as the secondary server. Only documented SETP #1 host/port is changed; a separate GETP must verify the endpoint and preservation of every other group. Operations bind to one TCP session, reject stale/duplicate responses, expire after 120 seconds and never replay writes after restart. Reversal is a separate preconditioned operation. FC has no correlation token: timestamp/session checks bound freshness but do not create cryptographic command attribution. Device clock skew is bounded to 10 seconds behind / 5 seconds ahead of VPS time; successive operation stages require strictly increasing device timestamps. After a dispatched SETP the host waits at least 15 seconds before its separate GETP. Only this read may bind to a new TCP session after tracker reconnection; SET P is never resent. Verification also runs when SETP's acknowledgement is lost. The 0.1.4 experiment stopped before writing because its timestamp comparison incorrectly required synchronized clocks; the measured B2 was about 4 s behind.

Full profiles, APN/active-channel migration, other server slots and disabling the vendor configurator remain unqualified. The authenticated API is private: raw GETP replies contain credentials and must never be proxied into the browser. See network configuration audit.

The VPS queue has a 512 MiB budget and preserves a 256 MiB disk reserve. When full/unwritable it withholds ACK, never drops unconsumed packages. Receipts retain retransmission deduplication for seven days. Core must remain available often enough to drain the queue. Capacity for thousands of simultaneously active trackers has not been load-qualified; the first profile caps 256 connections and service memory at 192 MiB. Scale/retention qualification is a separate gate.

Core API uses TLS 1.3 with certificate fingerprint verified before sending a pairing secret or bearer token. Invitation is obtained through the owner's SSH channel. DNS resolves only to public IPv4. Redirects/ambient HTTP proxies are not followed. Node's private-network pairing contract is unchanged.

Coordinates are derived from valid packet tags. Missing/invalid/zero coordinates are not invented. Device measurement time and reception time remain separate; an older replay cannot move the map backwards in time. UI shows freshness and last contact, independently of the onboard computer.

Acceptance boundary

tests/test_vps_host.py covers framing, partial TCP reads, checksum rejection, one-time enrollment, retry identity, admission, durable delivery, deduplication, Core cursor transaction, stale data and shared rover reassignment. Hardware and operator VPS acceptance are recorded separately in a private deployment ledger. A successful install on the existing Ubuntu VPS is not clean-image qualification.

Portable transfer to a clean VPS

Use the same qualified installer file on both hosts. Upgrade the source to it first. Then on the source:

sudo python3 ndc-mission-vps.pyz --export-state /root/mission-vps-state.tar.gz

This stops this service and persistently fences it before taking the snapshot. The source remains stopped, including after reboot. Export prints the archive's SHA-256. The archive contains credentials and the SQLite journal: keep it private and transfer it through the owner's SSH channel together with the installer. No executable, system unit, account ID or firewall configuration crosses hosts. A failure after fencing leaves the source stopped and preserves its state.

On the clean supported Ubuntu VPS:

sudo python3 ndc-mission-vps.pyz --import-state /root/mission-vps-state.tar.gz --sha256 ARCHIVE_SHA256

Import checks the exact archive SHA, complete file manifest, matching installer release, TLS key/certificate identity and SQLite integrity before installation. Existing product paths are refused. It creates the system account, code and unit through the same installer and verifies service health. TLS identity and Core pairing survive; commands retain IDs, attempts, deadlines and stop markers. The normal runtime reconciles interrupted attempts; a snapshot is not proof of tracker execution. No old live TCP session is restored.

Keep the existing DNS name and ports, then direct that DNS name to the target after its health and external reachability checks. For an endpoint configured as a literal IP, this operation alone does not migrate Core or tracker addresses; a transferable IP or a separately verified endpoint change is required. Provider firewalls and DNS changes require their owner's controls/API and are not inferred from guest installation success. The receiving installation needs 2.25 GiB of free staging space; portable state is capped at 2 GiB.

To abandon migration, stop the target first, then explicitly resume the source:

sudo python3 ndc-mission-vps.pyz --resume-source

The source cannot observe the target across an outage. The installer therefore never resumes it automatically. Retain the private archive and exact installer for recovery. Do not run both identities simultaneously. A stale archive also cannot contain commands or confirmations recorded after its snapshot.