Skip to content

OpenTea DX-OS v1.9.0

Choose a tag to compare

@github-actions github-actions released this 13 Nov 01:03
· 1152 commits to main since this release

Added

  • Optional description in the mini-app manifest (1-200 characters), shown by the upcoming app store; hello and tea-tour now declare one. docs/miniapps.md documents it and the rule that public pages live under /public/<htxCode>/... (from v1.9.0 the web proxy serves a public page only when that HTX has enabled the app). Web package version is now 1.9.0
  • App Store: install mini-apps per cooperative (the manifest description above feeds it). A manager opens "Kho ứng dụng" (/manager/app-store) and installs or removes an app for their own HTX; the card shows Chưa cài, Đang cài…, Đã cài, Đang gỡ…, Lỗi (with Thử lại) or "Đã cài cho mọi HTX (quản trị máy chủ)", and polls every 3 s only while something is in progress, then refreshes the sidebar menu of the manager who pressed the button (other signed-in users of the HTX see the change at their next page load). A mini-app is now served, and listed in the menu, only to the HTXs that enabled it: the proxy answers 404 to any other HTX on protected and public paths, and a public page names its HTX in /public/<htxCode>/.... New tables in schema platform (platform/postgres/init/06-app-store.sql, applied by platform-init): app_catalog (synced from miniapps/*/app.yaml by make platform-up and by the worker; an installed app keeps its card when its directory is gone), app_enablements (* means every HTX), app_requests (one open request per app and HTX, enforced by a unique index) and app_worker (heartbeat); requests and enablements are audited. ./dxos worker is the host process that claims requests one at a time (ENABLE installs the app when needed, DISABLE removes the container once no HTX is left, and keeps the data), takes a lock in docker/runtime/<project>/worker.lock, fails requests a crashed worker left running (undoing the half install) and logs one line per job; without it the page warns that requests wait for the administrator. ./dxos install <dir> is unchanged and enables the app for *. New API: GET /api/app-store, POST /api/app-store/requests (docs/api-contract.md)
  • Mini-app leaf-purchase (Thu mua búp tươi): officers and managers write fresh-leaf weighing tickets (household, date, grade, kg with one decimal, price copied from the grade when written; money is integer VND shown as 9.000 ₫) and can edit or void a ticket until its period closes; managers set the price per grade (/prices), close a payment period over a date range (/periods: every non-voided ticket in the range joins it and gets one payout per household) and mark each payout paid; a farmer sees their own tickets and payouts at /mine. The household lists come from Hasura with the caller's own token and role, so a farmer sees only their household. Periods of one HTX never overlap (checked in a transaction under an advisory lock, since the app role cannot create btree_gist), and a ticket cannot be written or moved into a closed period's dates. Menu: "Thu mua búp tươi" (officer, manager), "Kỳ thanh toán" (manager), "Phiếu cân của tôi" (farmer). Schema app_leaf_purchase
  • Mini-app tea-shop (Cửa hàng chè): managers list products (name, pack, price, stock, optional trace lot code) and process orders (Mới → Đã xác nhận → Đang giao → Hoàn tất, or cancel, which gives the stock back); guests order without an account at /apps/tea-shop/public/<htxCode> (cash on delivery), get an 8-character order code and look the order up with code and phone together. Stock is locked per order in a fixed product order, so concurrent orders never oversell and never deadlock; an order keeps the product name and price it was placed with; a manager's stock edit is an adjustment (+/-), never an overwrite. Personal data (name, phone, address, note) is shown only to the HTX's manager and never on a public page. Menu: "Cửa hàng chè" (manager). Schema app_tea_shop
  • Mini-app farm-supply (Vật tư mua chung): managers open a group-buying round with a deadline and add items (name, unit, price) while it is open; each farmer registers quantities for their own household (the household comes from Hasura with the farmer's token, never from the form) until the round closes; closing creates one settlement per registered household, and the manager marks each delivered and paid and sees totals per item and per household. Menu: "Vật tư mua chung" (manager), "Đăng ký vật tư" (farmer). Schema app_farm_supply
  • Tests for the store and the three apps: make apps-smoke now also installs, calls through the gateway (200 with the right role, 404 on the published port, the gateway's refusal for a wrong role, including /tickets/* and /periods/* of leaf-purchase), reads the real Hasura household lists as officer, manager and farmer, makes one write per app (a ticket, a closed period and a payout, a public order, a registration) and purges each app; through the queue it enables tea-shop for TC, checks that the web proxy answers 404 for LB when the web container runs, disables it, enables it again and checks that the product created before is still there. It refuses to start when one of the five apps is installed, and starts its own ./dxos worker. Browser: tests/e2e/story/app-store.spec.ts (TC installs the shop from the page and sees Đang cài… then Đã cài; LB does not see it and gets 404; a guest orders on a 390 px phone; the manager advances the order, presses Gỡ, installs again and finds the order) and business-apps.spec.ts (the leaf-purchase and farm-supply stories); screens.spec.ts adds the store page and one screen per app and role at 1280 and 390 px, light and dark. CI runs the pytest suites of the three apps next to tea-tour's and, in platform-smoke, a ./dxos worker for the store stories

Upgrade notes

  • First make platform-up recreates postgres once: it mounts the new platform/postgres/init/06-app-store.sql. The data in docker_pgdata is kept, and platform-init creates the store tables on the existing database. Never delete the docker_* volumes
  • Apps installed before the upgrade stay enabled for every HTX: the platform-init run that creates platform.app_enablements enables each already-installed app for * once (enabled_by = 'dxos-upgrade'), so nothing disappears from the menu. Later runs never do it again: an installed app with no enablement is a valid state (every HTX turned it off) and is not handed back to everyone
  • Start ./dxos worker: the store only queues a request until a worker runs. Start it from the repo root (README, "Kho ứng dụng và ./dxos worker", has a systemd unit); until it runs, the page warns "Trình cài đặt chưa chạy". ./dxos install and ./dxos remove work without it
  • The web image must be rebuilt (up -d --build web): the proxy, the menu and the store page read platform.app_enablements; the package version is now 1.9.0, which the new manifests require
  • Demo: build the images of the three new apps ahead (install each once, then ./dxos remove <id> --purge) and start the worker before the demo; the first Cài otherwise builds an image, which takes minutes

Known limits

  • Apps still trust each other (ruling R24, unchanged): enabling an app per HTX only decides who sees it; every installed app shares dxos-apps-net and decodes the token without verifying it, so another installed app can read or change the data of leaf-purchase, tea-shop and farm-supply. Install only apps of this repository. Real per-app isolation is deferred
  • The worker is a host process, not a container (the web app must never hold the Docker socket): it must be started and kept alive by the operator, and one worker serves one compose project
  • The farm-supply item form shows a rejected item (empty name, bad price) as a plain error page (heading and one message, no form and no link back; the browser's Back button returns to the round) instead of an inline error; nothing is stored
  • The gateway can answer 503 for up to about 30 seconds after a core service restarts (for example Hasura): its DNS client caches the "name not found" answer it got while the service was down, and apisix.dns_resolver_valid only shortens the cache of valid answers. Unchanged from earlier releases

Container images

  • ghcr.io/maiychrus25/opentea-dx-os-web:1.9.0
  • ghcr.io/maiychrus25/opentea-dx-os-api:1.9.0
  • ghcr.io/maiychrus25/opentea-dx-os-postgres:1.9.0
  • ghcr.io/maiychrus25/opentea-dx-os-scanner:1.9.0
  • ghcr.io/maiychrus25/opentea-dx-os-migrate:1.9.0
  • ghcr.io/maiychrus25/opentea-dx-os-dataops:1.9.0

Deploy

Download opentea-dx-os-1.9.0.tar.gz, verify it with SHA256SUMS, then follow the
release deployment guide (6-step order: postgres, platform-init, migrate, platform-init again, rest, then --profile tools run --rm ollama-init to pull the pinned LLM model).
Set DXOS_MQTT_DEVICES and DXOS_MQTT_INGEST_PASSWORD in docker/.env.local first: the broker refuses to start while any MQTT password begins with change_me.
Also set MINIO_ACCESS_KEY, MINIO_SECRET_KEY (SeaweedFS refuses placeholders), KEYCLOAK_ADMIN and KEYCLOAK_ADMIN_PASSWORD, and run every command as docker compose --env-file docker/.env.local -f docker/docker-compose.yml -f docker/docker-compose.release.yml ..., otherwise Compose ignores those values.