Skip to content

MARS Android → Linux L2 migration

This document describes the one-shot migration from the legacy MARS Android L2 application to the new Linux edge-service (okto-edge-service package).

Prerequisites

  • root access on the Android host (MARS lines already run rooted).
  • adb on the operator laptop.
  • Linux IPC pre-installed with okto-edge-service (Debian) or the RPM (RED OS).
  • okto-migrate JAR:
    ./gradlew :okto-migrate:shadowJar
    cp packages/okto-migrate/build/libs/okto-migrate-*-all.jar okto-migrate.jar
    

Step-by-step

1. Capture the Android dump

mkdir android-dump && cd android-dump
adb shell run-as ru.okto.android tar c shared_prefs databases | tar x

2. Convert SharedPreferences → edge-service.yaml

java -jar okto-migrate.jar convert ./android-dump \
    --out /etc/okto/edge-service.yaml --overwrite

Edit the generated file and set:

  • device.identifier (match the MARS line ID).
  • line.variant (DRY / WET), line.site (LUZ / NOV / MIR / RND).
  • Adjust scanner / printer / PLC entries to reflect the physical wiring.

3. Export SQLite history

java -jar okto-migrate.jar export-history ./android-dump \
    --out android-history.jsonl

Replay the history into the new service after provisioning:

# Pilot-only helper — not production-ready, intended for cutover week.
python3 scripts/replay-history.py android-history.jsonl \
    --target http://<ipc>:8080

4. Start the service

sudo systemctl restart okto-edge
curl http://localhost:8080/health

5. Validate

  • Operator UI loads at http://<ipc>:3000 (Tauri / kiosk).
  • Dashboard shows the new cabinet entry with the correct variant / site.
  • Fire a test scan from each configured scanner (through POST /api/v1/scanners/{index}/test).
  • Simulate a UPS event (WET only):
    curl -X POST http://<ipc>:8080/api/v1/ups/simulate \
         -H 'Content-Type: application/json' \
         -d '{"onBattery":true,"batteryPercent":35}'
    
    Confirm the journal shows the UPS_ON_BATTERY event.

Rollback

  1. Stop the Linux service:
    sudo systemctl stop okto-edge
    
  2. Power the Android host back on.
  3. The Android host is kept on-site for 14 days before decommissioning.

SharedPreferences mapping

OLD_APP key (snake_case) Linux config Notes
device_id / DEVICE_ID device.identifier
device_name / DEVICE_NAME device.name
line_id / production_line_id device.productionLineId
scanner_ip / matrix_scanner_ip scanners[0].host Primary scanner
scanner_port scanners[0].port
printer_ip printers[0].host
printer_port printers[0].port
printer_type printers[0].type UPPERCASE
modbus_ip / plc_ip plcs[0].host protocol=MODBUS_TCP
modbus_port / plc_port plcs[0].port default 502
copacking_mode, task_mode OperationModes (DB-persisted) re-enabled from UI

New keys — enter manually or via the L2SettingsPage:

  • line.variant (DRY / WET)
  • line.site (LUZ / NOV / MIR / RND)
  • line.plcVisualisationUrl (MARS PLC UI iframe URL)
  • ups.type (OWEN_IBP120K on WET)
  • gpio.backend (libgpiod on DRY, USB fallback otherwise)

Known differences

  • Scanner IP list — legacy MARS hosts have up to 8 scanners; the new config supports 10.
  • Printer multi-instance — legacy is single printer; new schema allows several (MARS SDX + mobile ZPL side-by-side).
  • Event journal — new subsystem, no parity on the Android side.
  • Batch accounting (Партионный учёт) — new functionality, no prior mapping.