Device Manager is a Go-based microservice system designed to manage the lifecycle of device leases (both physical DUTs and virtual machines) within the ChromiumOS ecosystem. It provides a gRPC API for leasing, releasing, and querying devices, integrating with the Unified Fleet System (UFS) for device metadata and using Postgres (AlloyDB) for persistent storage.
The DeviceLeaseService is defined in infra/go/src/go.chromium.org/chromiumos/config/proto/chromiumos/test/api/device_manager_service.proto.
idempotency_key.lease_id.devices/{device_id}).device_id or dut_id).The project is composed of several key services and internal components:
device_lease_service: The primary gRPC service (cmd/device_lease_service) that handles lease requests, extensions, and releases.notifier_service: A background service (cmd/notifier_service) that monitors device changes and publishes events to Google Cloud Pub/Sub.expirer_service: A service (cmd/expirer_service) responsible for identifying and processing expired leases.internal/frontend: Implements the gRPC server and handles request routing.internal/controller: Contains the core business logic for leasing and device management.internal/model: Defines the database schema and provides data access objects (DAOs) for Postgres.internal/jobs: Implements cron-like background tasks such as UFS device import, lease expiration, and BigQuery data persistence.internal/external: Provides clients for interacting with external systems like UFS, Pub/Sub, and BigQuery.The project uses a Makefile to streamline common development tasks.
make build - Compiles the service binaries.make dev - Runs the Device Lease service locally with default flags.make docker-db: Starts the Postgres database container.make docker-pubsub: Starts the PubSub emulator.make docker-service: Builds and runs the Device Lease service in Docker.make docker-notifier: Builds and runs the Notifier service in Docker.pip install -r requirements.txtALEMBIC_ENV=alloydb.local alembic upgrade headmake test (runs go test ./...)make e2ego.chromium.org/luci/common/logging.idempotency_key to prevent duplicate operations.JSONB for flexible schedulable labels. Schema changes must be performed via Alembic migrations in database/versions/.