Skip to content

Runtime Configuration

This page includes only settings confirmed by the current Docker Compose, Dockerfile, CMake, and startup scripts. See the Build Guide for complete build entry points and the Deployment Guide for installation and upgrade.

Docker Compose Entry Points

PurposeFile / entry pointService
x86 Linuxdocker-compose.x86.ymlcosmo-x86
x86 Windowsdocker-compose.x86.windows.ymlcosmo-x86
Apple Silicon macOS Previewscripts/macos-docker-preview.shdocker-compose.x86.macos.ymlcosmo-x86-macos
Sophon packagedocker-compose.sophon.ymlcosmo-sophon-package
Rockchip packagedocker-compose.rockchip.ymlcosmo-rockchip-package

Prefer scripts/docker-compose.sh for one-shot build services. It selects an available Compose V2/V1 implementation.

x86 Docker Settings

Main Dockerfile.x86 build arguments:

ArgumentDefaultDescription
RESOURCE_DIRdata/resource/aiboxresource_x86Resource directory installed into the runtime image
COSMO_BUILD_JOBSThe build script uses nproc when unsetCPU build parallelism; Mac Preview overrides it to 1 by default

The runtime image sets:

VariableDefaultDescription
INSTALLPATH/appfs/cosmo_wander/cwai_dataMain installation directory
COSMO_PLATFORM_TYPEx86_64Runtime platform type

Windows and macOS Preview support these host overrides:

VariableDefaultDescription
COSMO_X86_WEB_PORT8080Host web port; Mac remains bound to 127.0.0.1
COSMO_X86_BUILD_JOBS1 (Mac Preview only)Build parallelism under amd64 emulation

scripts/docker-entrypoint.x86.sh creates data and log directories, then executes:

bash
${INSTALLPATH}/scripts/run_start.sh start /data/cwaiuserdata/log/logs/INTE_RUN_container.log

Management-Platform Signing Credentials

Signed requests to the management platform require both variables below. Each value is an absolute credential-file path:

VariableDescription
COSMO_APP_KEY_FILEApp Key file
COSMO_APP_SECRET_FILEApp Secret file

Both files must be regular files, no larger than 4096 bytes, with one non-empty line. Mount them read-only with restricted permissions; never place credentials in images, Compose files, or the repository. When both variables are absent, signed management-platform requests remain disabled. A partial setting, relative path, or invalid file is rejected.

Sophon Build Settings

Pass the chip after the Compose service as --chip <model>:

ArgumentSupported valuesDefault
--chipbm1688, cv186xbm1688

docker-compose.sophon.yml passes these values into the build container:

VariableDefaultDescription
COSMO_MODEL_GUARD_BUILD_PROFILEpublic-runtimepublic-runtime (Open) or production-release (Protected)
COSMO_PACKAGE_MODELSincludeinclude or preserve; public deployable packages use include
NPM_CONFIG_MAXSOCKETS1Maximum npm connections
NPM_CONFIG_PROGRESSfalseDisable npm progress output
NPM_CONFIG_FETCH_RETRIES3npm fetch retries
NPM_CONFIG_FETCH_TIMEOUT120000npm fetch timeout in milliseconds
NPM_CONFIG_PREFER_OFFLINEtruePrefer the Compose npm cache
NPM_CONFIG_UPDATE_NOTIFIERfalseDisable the npm update notifier

This Compose service uses a prebuilt GHCR image and no longer exposes the apt, Node, or Rustup mirror variables described by older guides. Diagnose GHCR pulls, npm-cache population, and the current build log instead.

Rockchip Build Settings

Variable / argumentDefaultDescription
COSMO_TARGET_CHIPrk3576rk3576 or rv1126b; Compose passes it to --chip
COSMO_PACKAGE_MODELSincludeinclude or preserve, which is only for code/structure validation
COSMO_BUILD_JOBS4Cross-build parallelism
COSMO_ROCKCHIP_BUILDER_IMAGERepository-pinned GHCR digestControlled builder-image override
COSMO_RKNN_ARTIFACT_MANIFESTManifest from the platform profileSelects a model bundle with source, hash, usage, and license identity; commercial or proprietary inputs use a separate manifest in an ignored task directory

The builder also uses the npm cache/retry variables listed for Sophon. An RV1126B include build generates and verifies output/platform-artifacts/rv1126b/resource-overlay from the selected artifact manifest; preserve validates only code and package structure and is not device acceptance. The repository default is an AGPL-3.0 community example bundle, not a commercial model deliverable. Commercial or proprietary models require an independent manifest and license record.

Resource Directories

Build pathResource directory
x86 Dockerdata/resource/aiboxresource_x86
Sophon BM1688data/resource/aiboxresource_bm1688
Sophon CV186Xdata/resource/aiboxresource_cv186x
Rockchip RK3576data/resource/aiboxresource_rknn
Rockchip RV1126BShared data/resource/aiboxresource_rknn templates plus the model-artifacts/rv1126b community example manifest; the target overlay is generated

The build scripts pass the selected path as RESOURCE_DIR to the install rules. Binary models for different chips still require separate conversion and validation, while algorithm/config templates and staging code remain shared. Packages retain resource/model-bundle.json and the applicable license, and package audit verifies model inventory, size, and SHA-256.

Runtime Directories

PathDescription
/appfs/cosmo_wander/cwai_dataDefault application installation directory
/data/cwaiuserdataDefault user-data root
/data/cwaiuserdata/log/logsApplication logs
/data/cwaiuserdata/upgradeUpgrade staging directory
/data/cwaiuserdata/tmp/*nginx temporary directories

Device deployments may override the application and data roots with COSMO_APP_DATA_DIR and COSMO_DATA_DIR. Overrides must be controlled absolute paths consistent with the service and persistence policy.

Ports

PortDescription
8080Default x86 Docker host web port
80nginx inside the container
8000Backend HTTP; x86 Compose publishes only same-number UDP device discovery directly to the host
9000Backend WebSocket; normally accessed through nginx
1936SRS RTMP
1985SRS API
18088SRS HTTP stream

Stream Variables

scripts/run_start.sh sets these defaults:

bash
COSMO_STREAM_PLAY_MODE=srs
COSMO_STREAM_RTMP_BASE=rtmp://127.0.0.1:1936/live
COSMO_STREAM_RTC_API_PORT=1985
COSMO_STREAM_HTTP_PORT=18088

macOS Preview overrides COSMO_STREAM_PLAY_MODE=httpflv-srs and continues to use 18088 for HTTP-FLV playback.

CMake Cache Settings

These values can be configured with -D<name>=<value>, but repository build scripts should select compatible combinations:

NameType / defaultDescription
COSMO_TARGET_ARCHSTRING / aarch64aarch64 or x86_64
COSMO_TARGET_CHIPSTRING / emptyRecords the target chip; backend scripts pass supported values
BUILD_TESTSBOOL / OFFBuild cosmo-tests
COSMO_ENABLE_COVERAGEBOOL / OFFEnable gcov for the test build
COSMO_DEV_MODEBOOL / OFFDisable watchdog and related production behavior and enable development log output
COSMO_NN_USE_SOPHON_BACKENDBOOL / ONSophon inference backend
COSMO_NN_USE_CPU_BACKENDBOOL / OFFONNX Runtime CPU backend
COSMO_NN_USE_RKNN_BACKENDBOOL / OFFRockchip RKNN backend
COSMO_MEDIA_USE_SOPHON_BACKENDBOOL / derived defaultSophon media backend
COSMO_MEDIA_USE_CPU_BACKENDBOOL / derived defaultFFmpeg software media backend
COSMO_MEDIA_USE_ROCKCHIP_BACKENDBOOL / derived defaultRockchip MPP/RGA media backend
COSMO_ENABLE_OPENH264BOOL / derived defaultEnabled by default for x86 CPU media and explicitly configurable
COSMO_MODEL_GUARD_BUILD_PROFILESTRING / public-runtimepublic-runtime or production-release
COSMO_PACKAGE_MODELSSTRING / includeinclude or preserve

Exactly one NN backend and exactly one media backend must be enabled. Sophon media requires the Sophon runtime; Rockchip media requires an aarch64 target.

These values are derived or fixed internally and should not be overridden by callers:

NameCurrent behavior
COSMO_OPENH264_USE_ASMAlways OFF
COSMO_MODEL_GUARDON for the Sophon inference backend, OFF for other inference backends

Released under the Apache 2.0 License.