Docs / Reference
Reference
Ports, environment variables, files and endpoints for every service.
Port layout
| Port | Service | Where |
|---|---|---|
8089 | MonkeyTester viewer (app.py, ThreadingHTTPServer) | Linux host |
8090 | Mobile Controller (starts Appium on :4723) | Mac |
8091 | MonkeyTester-Plugin-AI (vision plugin; private Ollama on :11435) | Mac |
8094 | build-local build plugin (fetches Gitea/GitHub branches, builds, uploads) | Mac or Linux host |
3000 / 2222 | Gitea web + API / Gitea SSH (the lab's code host; GitHub needs none of this) | Linux host |
8001 | This website (static, origin/master worktree) | Linux host |
Environment variables
Viewer + runner (MonkeyTester)
| Variable | Default | Purpose |
|---|---|---|
CONTROLLER_URL | required | Mobile Controller base URL |
CONTROLLER_TOKEN | none | Legacy: imported once into Settings (where the controller token now lives) when Settings has none, then ignored |
MT_CI_TOKEN | none | Legacy: imported once as the CI token when Settings has none, then ignored. Generate the CI token in Settings instead; app repos keep it as the MT_CI_TOKEN secret |
MT_VIEWER_BIND | 0.0.0.0 | Viewer listen address (login is required on every bind) |
VISION_MODEL_API_URL / VISUAL_MODEL_API_KEY | 127.0.0.1:8081 / none | Fallback vision endpoint when nothing is saved in Settings |
VISION_TIMEOUT_SECS | 310 | Seconds per vision reply |
MT_PLUGINS | empty | name=url[,…]; imported into Run/config.json's plugins map once at viewer start, then ignored. Not for AI. |
PLUGIN_TOKEN / MT_PLUGIN_TOKEN_<NAME> | empty | Legacy: imported once into Settings as plugin tokens (<NAME> upper-cased, other chars as _, wins for one plugin) when Settings has none, then ignored |
MT_TEST_VARS | empty | Test variables as JSON; overrides saved values; read at runner start |
MT_REPO | set per run | The run's project owner/repo (a build plugin passes it; the viewer never inherits it) |
MT_DEVICE_WAIT_SECS | 3600 | How long a run queues for a busy device before failing |
MT_DEVICE_CONNECT_WAIT_SECS | 300 | Wait for a platform's devices to connect when a run starts |
MT_STALE_RUN_SECS | 3600 | A run with no filesystem activity for this long is interrupted |
MT_DISABLE_WEB_RUNS | empty | 1 hides Build & Test from the nav (UI only; pages and APIs keep working) |
CAPTURE_OUTPUT_DIR / DEBUG / DEVICE_ID | outputs/ / false / set by runner | Recording destination / debug output / targeted device |
Mobile Controller
See Mac → Controller settings: CONTROLLER_PORT BIND TOKEN, APPIUM_URL ORG_ID SIGNING_ID WDA_BUNDLE_ID CAPS_JSON ALLOW_INSECURE, DEVICECTL, ANDROID_HOME ADB_BIN JAVA_HOME ADB_CONNECT.
MonkeyTester-Plugin-AI
See Mac → AI settings: MTAI_MODEL TOKEN PORT OLLAMA_PORT MAX_PIXELS RUNTIME_DIR COPILOT_CONFIG REMOTE_CONFIG.
Build plugin (build-local)
| Variable | Default | Purpose |
|---|---|---|
PLUGIN_HOST / PLUGIN_PORT | 0.0.0.0 / 8094 | Listen address / port |
PLUGIN_TOKEN | unset | Pairing token; required unless PLUGIN_HOST is loopback (refuses to start without it). Every request except GET /health must send it as X-Plugin-Token or Authorization: Bearer |
BUILD_PLUGIN_STATE_DIR | ~/.config/monkeytester-build-local/ | config.json (code host + token + viewer URL, mode 0600), builds.json, checkouts/, out/ |
BUILD_LOCAL_PLATFORMS | auto-detect | e.g. android to force Android only |
BUILD_LOCAL_TIMEOUT_ANDROID / BUILD_LOCAL_TIMEOUT_IOS | 3600 | Seconds a platform's build script may run |
BUILD_LOCAL_IMPORT | unset | First start only: import url + token + user from an old gitea_config.json as a Gitea code host |
On the viewer side there is no code host variable any more: the viewer's old gitea_config.json and MT_BUILD_PLUGINS=name=url[,name=url] are each imported once into the build-local plugin at MT_BUILD_LOCAL_URL (default http://127.0.0.1:8094), after which the viewer holds no code host token.
Files on disk
MonkeyTester (next to app.py)
Run/
run_<YYYYMMDD_HHMMSS>/
outputs/ screenshots, videos (outputs/snapshots/<name>.{actual,baseline,diff}.png)
results/ <test>_result.json
logs/ model and backend logs
run_metadata.json status, counts, project, cases
summary.txt console.log pending_tests.json exit_code
tests/ the .txt files the run used ([<case>/]<test>.txt + INSTRUCTION.txt)
devices/device_N/ per-device artifacts in multi-device runs (same layout)
config.json viewer settings (plugins, visual_plugin_url, theme, test_variables…)
.builds/ Build & Test records .uploads/ transient staging .cache/ WebM cache
.locks/ per-device run locks
Conf/device_names.json device id -> friendly name
build_config.json Build & Test settings: plugins + projects (mode 0600, git-ignored)
gitea_config.json.migrated old Gitea settings, once moved into a build plugin
Other services
- MonkeyTester-Plugin-AI: everything in
.runtime/inside its checkout — Ollama, model,settings.json,copilot.json,remote.json(all mode 600),logs/ollama.log,logs/service.log. - Mobile Controller: recordings land on the Mac and download into the run's
outputs/; its LaunchAgent logs to/tmp/monkeytester-mobile-controller.log. - build-local:
BUILD_PLUGIN_STATE_DIR(default~/.config/monkeytester-build-local/):config.json(mode 0600: code host, read-only token, viewer URL),builds.json,checkouts/,out/(the newest 50 builds keep their files).
Endpoints you will actually call
| Endpoint | What |
|---|---|
GET /health (every service) | Open liveness: {ok, service, api_version} |
GET /api/status (viewer) | Every dependency's state in one call — check this after any setup change |
GET /api/runs / /api/runs/<run> / …/result | Run list, one run, run verdict (running|passed|failed|recording) |
POST /api/run-test | Multipart upload: app + test files (+ snapshots/payloads parts), launches a run; needs a build_request from a known Build & Test build |
GET /devices, /stream/<id>, /api/frame/<id> (viewer → controller) | Device list and live views |
POST /api/press-event | Fire-and-forget press markers for the run page; a dead viewer never breaks a run |
GET/POST /api/config/build, /api/config/build/plugins, GET/POST /api/config/build/plugins/<name>/config, GET /api/config/build/template?plugin=, GET/POST /api/builds (viewer) | Build & Test settings: build plugins, projects and their checks, the plugin's example build scripts, build records |
GET/POST /api/config/visual-model, /api/visual-model/plugin… (viewer) | Vision plugin address, provider, models, Copilot device flow |
GET /actions, POST /jobs, GET /jobs/<id>?wait= (plugins) | The Device Plugin API |
GET /health, GET /config, POST /config, GET /models, POST /v1/chat/completions (AI plugin) | Config-owning plugin extensions (pairing token as Authorization: Bearer or X-Plugin-Token) |