### Starting STF Local Development Server - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.md This command launches the STF application in local development mode. It initiates all necessary processes and starts the webpack build, making the STF instance accessible via a web browser. ```bash stf local ``` -------------------------------- ### Starting Local MongoDB Instance with Docker - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.ru.md This command starts a MongoDB instance locally using Docker, configured as a replica set for STF. It removes the container on exit, maps port 27017, sets the hostname, and initializes the replica set. MongoDB must be running before starting STF. ```bash docker run --rm -d -p 27017:27017 -h 127.0.0.1 --name mongo mongo:6.0.10 --replSet=test && sleep 4 && docker exec mongo mongosh --eval "rs.initiate();" ``` -------------------------------- ### Installing STF Globally Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command installs the STF (Smartphone Test Farm) command-line interface (CLI) globally on the system, making the `stf` command available from any directory. It requires Node.js and npm to be installed as prerequisites. ```Shell $ npm i stf -g ``` -------------------------------- ### Installing Node.js and Bower Dependencies - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.ru.md This command fetches and installs all required Node.js (NPM) and Bower modules for the project. It is a prerequisite step after installing system requirements to prepare the development environment. ```bash npm install ``` -------------------------------- ### Starting Local MongoDB for STF Development - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.md This Docker command starts a local MongoDB instance with a replica set, which is a prerequisite for running STF in development mode. It exposes port 27017 and initializes the replica set after a short delay. ```bash docker run --rm -d -p 27017:27017 -h 127.0.0.1 --name mongo mongo:6.0.10 --replSet=test && sleep 4 && docker exec mongo mongosh --eval "rs.initiate();" ``` -------------------------------- ### Installing Node.js and Bower Dependencies - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.md This command fetches and installs all required Node.js (NPM) and Bower modules for the STF project. It is a prerequisite for building and running the application. ```bash npm install ``` -------------------------------- ### Starting Minicap Listener on Device (Bash) Source: https://github.com/vkcom/devicehub/blob/master/minicap-prebuilt/README.md This command initiates the minicap process on the Android device, causing it to start listening on an abstract Unix domain socket. As with other minicap commands, 'LD_LIBRARY_PATH' must be set, and the display projection parameters are required. ```bash adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -P 1080x1920@1080x1920/0 ``` -------------------------------- ### Starting STF Local Development Instance - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.ru.md This command launches all required STF processes for development purposes, including a mock login implementation. It assumes MongoDB is already running. After a successful webpack build, the STF instance will be accessible at http://localhost:7100. ```bash stf local ``` -------------------------------- ### Displaying Help for STF Local Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This command executes `stf local` with the `--help` flag, which outputs a detailed list of all available command-line options for configuring a local STF (Smartphone Test Farm) instance. The output includes option names, types, default values, and brief descriptions, enabling users to understand and customize their local STF setup. ```sh $ stf local --help ``` -------------------------------- ### Installing STF Globally with npm Source: https://github.com/vkcom/devicehub/blob/master/units.md This command installs the STF (Smartphone Test Farm) tool globally on the system using npm, making the `stf` command available from any directory. This is the first step to set up the STF environment. ```Shell $ npm i stf -g ``` -------------------------------- ### Running STF with Scrcpy Support Source: https://github.com/vkcom/devicehub/blob/master/README.md This command starts the STF local instance with experimental Scrcpy support enabled. This allows using Scrcpy for device mirroring instead of the default minicap, though the functionality is currently unstable. ```bash stf local --need-scrcpy true ``` -------------------------------- ### Launching VK DeviceHub Production Environment Source: https://github.com/vkcom/devicehub/blob/master/README.md This command launches a local production-like installation of VK DeviceHub using Docker Compose. It utilizes `docker-compose-prod.yaml` for service definitions and `scripts/variables.env` for environment variables, making the application accessible on port 8082. ```Shell docker compose -f docker-compose-prod.yaml --env-file scripts/variables.env up ``` -------------------------------- ### Starting STF with Public IP Access - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.ru.md This command starts the STF local development instance, allowing it to be accessed from other machines on the network. The `` placeholder should be replaced with the actual internal network IP address of the machine running STF. ```bash stf local --public-ip ``` -------------------------------- ### Displaying Help for STF Provider Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This snippet shows how to invoke the help documentation for the `stf provider` command using the `--help` flag. It's a standard way to get information about command-line tool options and usage. ```sh $ stf provider --help ``` -------------------------------- ### Starting ADB Server for macOS Source: https://github.com/vkcom/devicehub/blob/master/README.md This command initiates the ADB (Android Debug Bridge) server on the host machine. It is a prerequisite for running VK DeviceHub on macOS, as some features require direct access to the provider instance. ```Shell adb start-server ``` -------------------------------- ### Installing Local Python Wheel Package with Pip Source: https://github.com/vkcom/devicehub/blob/master/test/api/devicehub_client/README.md This command installs a local Python wheel file into a project using pip. This method is used when the consuming project does not use Poetry for dependency management. ```Shell pip install ``` -------------------------------- ### Installing Python Dependencies for DeviceHub API Tests Source: https://github.com/vkcom/devicehub/blob/master/doc/TESTING.md This command uses Poetry to install all required Python dependencies for the DeviceHub API tests. It's recommended to create a Python virtual environment first to isolate dependencies. ```Shell poetry install ``` -------------------------------- ### Listing All STF Devices using Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example uses the 'swagger-client' to fetch a list of all STF devices. It logs the total number of devices returned by the API. ```javascript clientWithPromise.then(function(api) { api.devices.getDevices() .then(function(res) { console.log(res.obj.devices.length) // 50 }) }) ``` -------------------------------- ### Displaying Help for STF Migrate-To-Mongo Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet illustrates how to get help for the `stf migrate-to-mongo` subcommand. This specific migration command is likely used for migrating data to a MongoDB database. ```sh $ stf migrate-to-mongo --help ``` -------------------------------- ### Running Minicap on Device using run.sh Source: https://github.com/vkcom/devicehub/blob/master/minicap-prebuilt/README.md These commands demonstrate how to use the `run.sh` script to deploy and execute minicap on an Android device. It includes options for a preliminary device compatibility check (`-t`), displaying help (`-h`), and starting minicap with automatic screen size detection (`autosize`). The script handles copying the correct binary and shared library to the device. ```Bash # Run a preliminary check to see whether your device will work ./run.sh autosize -t # Check help ./run.sh autosize -h # Start minicap ./run.sh autosize ``` -------------------------------- ### Displaying Help for STF Reaper (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This snippet shows the shell command to display the available command-line options and usage information for the 'stf reaper' component. It's a standard way to get quick help on CLI tools. ```sh $ stf reaper --help ``` -------------------------------- ### Accessing STF from Other Machines - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.md This command starts the STF local development server and binds it to a specified public IP address, allowing access from other machines on the same network. Replace `` with the actual IP. ```bash stf local --public-ip ``` -------------------------------- ### Migrating Data from RethinkDB to MongoDB (Bash) Source: https://github.com/vkcom/devicehub/blob/master/mongo.md This command is used to migrate existing data from a RethinkDB instance to the new MongoDB setup. It is part of the `stf` toolkit, designed to facilitate the data transfer during the database transition. ```bash stf migrate-to-mongo ``` -------------------------------- ### Launching VK DeviceHub on macOS Source: https://github.com/vkcom/devicehub/blob/master/README.md This command is specifically for macOS users to launch VK DeviceHub using Docker Compose. It uses `docker-compose-macos.yaml` and `scripts/variables.env`. This setup also requires an ADB server to be running on the host machine. ```Shell docker compose -f docker-compose-macos.yaml --env-file scripts/variables.env up ``` -------------------------------- ### Running STF Local with Scrcpy Enabled (Bash) Source: https://github.com/vkcom/devicehub/blob/master/README.ru.md This command starts the STF local instance, enabling the use of Scrcpy instead of Minicap for screen mirroring. This feature is currently in an unstable state and is intended for testing or specific use cases where Scrcpy is preferred. ```bash stf local --need-scrcpy true ``` -------------------------------- ### Building Android Project with NDK Debugging Enabled (Bash) Source: https://github.com/vkcom/devicehub/blob/master/minicap-prebuilt/README.md This command builds an Android project using `ndk-build`, enabling debug symbols and configurations by setting `NDK_DEBUG=1`. This is a prerequisite for effective `gdb` debugging, creating necessary setup files and binaries. ```bash ndk-build NDK_DEBUG=1 ``` -------------------------------- ### Initializing RethinkDB with Password (Bash) Source: https://github.com/vkcom/devicehub/blob/master/doc/DEPLOYMENT.md This Bash command provides an alternative method to initialize a RethinkDB instance with an initial password. It runs a Docker container to set the password before the main RethinkDB service unit is started, ensuring the database is secured from its first launch. ```bash docker run --rm -v /srv/rethinkdb:/data rethinkdb:2.3 rethinkdb --initial-password yourBrandNewKey ``` -------------------------------- ### STF Provider Command Line Options Reference (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This comprehensive snippet lists all available command-line options for the `stf provider` tool, along with their descriptions, data types, and default values. It details configurations for ADB, ZeroMQ connections, device cleanup, screen streaming, VNC, and various timeouts, allowing fine-grained control over device provisioning and management within the STF system. It also notes that options can be overridden by environment variables. ```sh stf provider [serial..] Options: -h, --help Show help. [boolean] --adb-host The ADB server host. [string] [default: "127.0.0.1"] --adb-port The ADB server port. [number] [default: 5037] --allow-remote, -R Whether to allow remote devices in STF. Highly unrecommended due to almost unbelievable slowness on the ADB side and duplicate device issues when used locally while having a cable connected at the same time. [boolean] --boot-complete-timeout How long to wait for boot to complete during device setup. [number] [default: 60000] --cleanup Attempt to reset the device between uses by uninstallingapps, resetting accounts and clearing caches. Does not do a perfect job currently. Negate with --no-cleanup. [boolean] [default: true] --connect-push, -p Device-side ZeroMQ PULL endpoint to connect to. [array] [required] --connect-sub, -s Device-side ZeroMQ PUB endpoint to connect to. [array] [required] --connect-url-pattern The URL pattern to use for `adb connect`. [string] [default: "${publicIp}:${publicPort}"] --group-timeout, -t Timeout in seconds for automatic release of inactive devices. [number] [default: 900] --heartbeat-interval Send interval in milliseconds for heartbeat messages. [number] [default: 10000] --lock-rotation Whether to lock rotation when devices are being used. Otherwise changing device orientation may not always work due to sensitive sensors quickly or immediately reverting it back to the physical orientation. [boolean] --max-port Highest port number for device workers to use. [number] [default: 7700] --min-port Lowest port number for device workers to use. [number] [default: 7400] --mute-master Whether to mute master volume. [choices: "always", "inuse", "never"] [default: "never"] --name, -n An easily identifiable name for the UI and/or log output. [string] [default: "di-smirnov"] --public-ip The IP or hostname to use in URLs. [string] [default: "192.168.88.242"] --screen-frame-rate The frame rate (frames/s) to be used for screen transport on the network. Float value must be > 0.0 otherwise the default behavior is kept [number] [default: 20] --screen-jpeg-quality The JPG quality to use for the screen. [number] [default: 80] --screen-grabber The tool to be used for screen capture. Value must be either: minicap-bin (default) or minicap-apk [string] [default: "minicap-bin"] --screen-ping-interval The interval at which to send ping messages to keep the screen WebSocket alive. [number] [default: 30000] --screen-reset Go back to home screen and reset screen rotation when user releases device. Negate with --no-screen-reset. [boolean] [default: true] --screen-ws-url-pattern The URL pattern to use for the screen WebSocket. [string] [default: "wss://${publicIp}:${publicPort}"] --storage-url, -r The URL to the storage unit. [string] [required] --vnc-initial-size The initial size to use for the experimental VNC server. [string] [default: "600x800"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_PROVIDER_` (e.g. `STF_PROVIDER_NAME`). ``` -------------------------------- ### Displaying Help for STF Triproxy Service (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command shows the available command-line options for the `stf triproxy` service. It details parameters for binding ZeroMQ DEALER, PUB, and PULL endpoints, and for setting a recognizable name for log output. Options can also be overridden using environment variables. ```Shell $ stf triproxy --help ``` ```Shell stf triproxy [name] Options: -h, --help Show help. [boolean] --bind-dealer, -d The address to bind the ZeroMQ DEALER endpoint to. [string] [default: "tcp://*:7112"] --bind-pub, -u The address to bind the ZeroMQ PUB endpoint to. [string] [default: "tcp://*:7111"] --bind-pull, -p The address to bind the ZeroMQ PULL endpoint to. [string] [default: "tcp://*:7113"] --name An easily identifiable name for log output. [string] [default: "di-smirnov"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_TRIPROXY_` (e.g. `STF_TRIPROXY_BIND_PUB`). ``` -------------------------------- ### Displaying Help for STF Auth Mock (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This snippet shows how to access the command-line help for the `stf auth-mock` module, which provides options for a mock authentication server. It details various configuration parameters including app URL, basic authentication settings, port, secret, session ID, and support/docs URLs. ```sh $ stf auth-mock --help ``` ```text stf auth-mock Options: -h, --help Show help. [boolean] --app-url, -a URL to the app unit. [string] [required] --basic-auth-password Basic auth password (if enabled). [string] --basic-auth-username Basic auth username (if enabled). [string] --port, -p The port to bind to. [number] [default: 7120] --secret, -s The secret to use for auth JSON Web Tokens. Anyone who knows this token can freely enter the system if they want, so keep it safe. [string] [required] --ssid, -i The name of the session ID cookie. [string] [default: "ssid"] --use-basic-auth Whether to "secure" the login page with basic authentication. [boolean] --support, --sl url thats need be opened to access support [string] [default: "https://vk.com"] --docsUrl, --du url thats need be opened to access docs [string] [default: "https://vk.com"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_AUTH_MOCK_` (e.g. `STF_AUTH_MOCK_SECRET`). Legacy environment variables like BASIC_AUTH_USERNAME are still accepted, too, but consider them deprecated. ``` -------------------------------- ### Displaying STF Local Command Help (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md Executes the `stf local` command with the `--help` flag to display all available command-line options and their default values. This provides a comprehensive overview of configurable parameters for running a local STF instance, including network settings, authentication, and device management. ```Shell $ stf local --help ``` -------------------------------- ### Displaying Help for STF App Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This snippet demonstrates how to view the help documentation for the `stf app` command, responsible for the main application unit. It lists essential configuration options like authentication URL, port, secret, session ID, user profile URL, and websocket URL, including their types and default settings. ```Shell $ stf app --help ``` -------------------------------- ### Displaying STF CLI Help Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the help output for the STF CLI, listing all available commands and general options. It provides a quick reference for how to use the `stf` tool and its various sub-commands, detailing their purpose and usage. ```Shell $ stf --help ``` -------------------------------- ### Initializing Git Submodules Source: https://github.com/vkcom/devicehub/blob/master/minicap-prebuilt/README.md This snippet initializes and updates Git submodules, specifically fetching the `libjpeg-turbo` submodule required for building minicap. This step ensures all necessary external dependencies are available before compilation. ```Bash git submodule init git submodule update ``` -------------------------------- ### Retrieving User Information Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This endpoint returns details about the authenticated user. It requires an authorization token. The Node.js example demonstrates how to access the user's email from the response object. ```bash GET /api/v1/user ``` ```bash curl -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user ``` ```javascript clientWithPromise.then(function(api) { api.user.getUser() .then(function(res) { console.log(res.obj.user.email) // vishal@example.com }) }) ``` -------------------------------- ### STF Command-Line Interface Overview Source: https://github.com/vkcom/devicehub/blob/master/units.md This output details the various commands available in the STF CLI, each representing a different unit or functionality of the STF system. It also lists global options like `--help` and `--version`. ```Text Usage: stf [options] Commands: api Start an API unit. app Start an app unit. auth-ldap Start an LDAP auth unit. auth-mock Start a mock auth unit that accepts any user. auth-oauth2 Start an OAuth 2.0 auth unit. auth-openid Start an OpenID auth unit. auth-saml2 Start a SAML 2.0 auth unit. groups-engine Start the groups engine unit. ios-device Start an ios device provider. doctor Diagnose potential issues with your installation. local [serial..] Start a complete local development environment. log-mongodb Start a MongoDB log unit. migrate Migrates the database to the latest version. migrate-to-mongo Migrates the database to mongoDB. processor [name] Start a processor unit. provider [serial..] Start a provider unit. reaper [name] Start a reaper unit. storage-plugin-apk Start an APK storage plugin unit. storage-plugin-image Start an image storage plugin unit. storage-s3 Start an S3 storage unit. storage-temp Start a temp storage unit. triproxy [name] Start a triproxy unit. websocket Start a websocket unit. Options: -h, --help Show help. [boolean] -V, --version Show version number [boolean] ``` -------------------------------- ### Retrieving Specific STF Device by Serial using Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example uses 'swagger-client' to retrieve information about a single STF device by its serial number. It logs the serial number of the retrieved device. ```javascript clientWithPromise.then(function(api) { api.devices.getDeviceBySerial({serial: 'xxxx'}) .then(function(res) { console.log(res.obj.device.serial) // xxxx }) }) ``` -------------------------------- ### Updating Development Dependencies - Bash Source: https://github.com/vkcom/devicehub/blob/master/README.ru.md This command is used to update the project's development version by fetching and installing any new or updated Node.js (NPM) and Bower modules after pulling the latest repository changes. ```bash npm install ``` -------------------------------- ### Displaying Help for STF Triproxy Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to access the help documentation for the `stf triproxy` command. It details the various ZeroMQ binding options for DEALER, PUB, and PULL endpoints, along with the option to specify a name for logging purposes. All options can be overridden using environment variables prefixed with `STF_TRIPROXY_`. ```sh $ stf triproxy --help ``` ```sh stf triproxy [name] Options: -h, --help Show help. [boolean] --bind-dealer, -d The address to bind the ZeroMQ DEALER endpoint to. [string] [default: "tcp://*:7112"] --bind-pub, -u The address to bind the ZeroMQ PUB endpoint to. [string] [default: "tcp://*:7111"] --bind-pull, -p The address to bind the ZeroMQ PULL endpoint to. [string] [default: "tcp://*:7113"] --name An easily identifiable name for log output. [string] [default: "di-smirnov"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_TRIPROXY_` (e.g. `STF_TRIPROXY_BIND_PUB`). ``` -------------------------------- ### Updating STF Device Information using Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example updates the 'note' and 'status' properties of a specific STF device using its serial number. It sends a JSON object as the payload to the putDeviceBySerial method. ```javascript clientWithPromise.then(function(api) { api.devices.putDeviceBySerial({"device":{"note": "Change battery", "status": "Disconnected"}}) .then(function(res) { // xxxx }) }) ``` -------------------------------- ### Displaying Help for STF Websocket Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet demonstrates how to view the help documentation for the `stf websocket` command. It outlines critical options such as ZeroMQ PULL and PUB endpoint connections, the binding port, a required secret for JWT authentication, the session ID cookie name, and the URL to the storage unit. Similar to `triproxy`, options can be configured via environment variables prefixed with `STF_WEBSOCKET_`. ```sh $ stf websocket --help ``` ```sh stf websocket Options: -h, --help Show help. [boolean] --connect-push, -c App-side ZeroMQ PULL endpoint to connect to. [array] [required] --connect-sub, -u App-side ZeroMQ PUB endpoint to connect to. [array] [required] --port, -p The port to bind to. [number] [default: 7110] --secret, -s The secret to use for auth JSON Web Tokens. Anyone who knows this token can freely enter the system if they want, so keep it safe. [string] [required] --ssid, -i The name of the session ID cookie. [string] [default: "ssid"] --storage-url, -r URL to the storage unit. [string] [required] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_WEBSOCKET_` (e.g. `STF_WEBSOCKET_STORAGE_URL`). ``` -------------------------------- ### Listing Authenticated User's Devices Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This endpoint retrieves a list of devices currently in use by the authenticated user. It supports an optional 'fields' parameter to filter the returned device properties. Both cURL and Node.js examples are provided. ```bash GET /api/v1/user/devices ``` ```bash curl -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user/devices ``` ```javascript clientWithPromise.then(function(api) { api.user.getUserDevices() .then(function(res) { console.log(res.obj.devices.length) // 1 }) }) ``` ```javascript clientWithPromise.then(function(api) { api.user.getUserDevices({fields: 'serial,using,ready'}) .then(function(res) { console.log(res.obj.devices) // [ { serial: 'xxxx', using: true, ready: true } ] }) }) ``` -------------------------------- ### Displaying STF Provider Command Help (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md Executes the `stf provider` command with the `--help` flag to display all available command-line options and their descriptions. This is useful for understanding the various configurations and parameters supported by the STF provider component. ```Shell $ stf provider --help ``` -------------------------------- ### Setting NDK_ROOT Environment Variable (Bash) Source: https://github.com/vkcom/devicehub/blob/master/minicap-prebuilt/README.md This command sets the `NDK_ROOT` environment variable, pointing to the Android NDK installation directory. This is crucial for `ndk-build` and `gdb` to locate necessary NDK tools and libraries, ensuring proper build and debugging environments. ```bash export NDK_ROOT="$HOME/Library/Android/sdk/ndk-bundle" ``` -------------------------------- ### Displaying STF Processor Help (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows the basic command to display the help documentation for the `stf processor` utility, providing an overview of its usage and available options. ```sh $ stf processor --help ``` -------------------------------- ### Displaying Help for STF Temporary Storage Service (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This command-line snippet illustrates how to access the help documentation for the `stf storage-temp` service. The help output provides a comprehensive list of configuration options for the temporary storage service, covering aspects like maximum file size, listening port, ZeroMQ connection endpoints, the directory for saving files, bundletool path, and various keystore parameters for APK signing. Security-related options like the JWT secret and session ID cookie name are also detailed, along with the environment variable override mechanism using the `STF_STORAGE_TEMP_` prefix. ```sh $ stf storage-temp --help ``` -------------------------------- ### Partially Updating STF Device Information using Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example demonstrates a partial update of a specific STF device, modifying only the 'note' property. The putDeviceBySerial method accepts a JSON object containing the fields to be updated. ```javascript clientWithPromise.then(function(api) { api.devices.putDeviceBySerial({"device":{"note": "Change battery"}}) .then(function(res) { // xxxx }) }) ``` -------------------------------- ### Displaying Help for SAML2 Authentication Module (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the available command-line options and their descriptions for configuring the `stf auth-saml2` authentication module. It provides details on required parameters such as `app-url`, `saml-id-provider-entry-point-url`, `saml-id-provider-issuer`, and `secret`, along with optional parameters and their default values. Options can be overridden by environment variables prefixed with `STF_AUTH_SAML2_`. ```Shell $ stf auth-saml2 --help ``` -------------------------------- ### Displaying SAML2 Authentication Help (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to display the help documentation for the `stf auth-saml2` command. It details various options for configuring SAML 2.0 identity provider settings, including URLs, certificates, and secrets, essential for secure authentication. Options can also be set via environment variables. ```Shell $ stf auth-saml2 --help ``` ```CLI Output stf auth-saml2 Options: -h, --help Show help. [boolean] --app-url, -a URL to the app unit. [string] [required] --port, -p The port to bind to. [number] [default: 7120] --saml-id-provider-entry-point-url SAML 2.0 identity provider URL. [string] [required] --saml-id-provider-issuer SAML 2.0 identity provider issuer. [string] [required] --saml-id-provider-cert-path SAML 2.0 identity provider certificate file path. [string] --saml-id-provider-callback-url SAML 2.0 identity provider callback URL in the form of scheme://host[:port]/auth/saml/callback. [string] --secret, -s The secret to use for auth JSON Web Tokens. Anyone who knows this token can freely enter the system if they want, so keep it safe. [string] [required] --ssid, -i The name of the session ID cookie. [string] [default: "ssid"] --support, --sl url which needed to access support [string] [default: "example.com"] --docsUrl, --du url which needed to access docs [string] [default: "example.com"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_AUTH_SAML2_` (e.g. `STF_AUTH_SAML2_SECRET`). Legacy environment variables like SAML_ID_PROVIDER_ISSUER are still accepted, too, but consider them deprecated. ``` -------------------------------- ### Displaying Help for STF Websocket Service (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command provides the available command-line options for the `stf websocket` service. It specifies parameters for connecting to ZeroMQ PULL and PUB endpoints, binding to a port, setting a secret for JWT authentication, defining the session ID cookie name, and providing the storage unit URL. All required options must be provided, and environment variables can override them. ```Shell $ stf websocket --help ``` ```Shell stf websocket Options: -h, --help Show help. [boolean] --connect-push, -c App-side ZeroMQ PULL endpoint to connect to. [array] [required] --connect-sub, -u App-side ZeroMQ PUB endpoint to connect to. [array] [required] --port, -p The port to bind to. [number] [default: 7110] --secret, -s The secret to use for auth JSON Web Tokens. Anyone who knows this token can freely enter the system if they want, so keep it safe. [string] [required] --ssid, -i The name of the session ID cookie. [string] [default: "ssid"] --storage-url, -r URL to the storage unit. [string] [required] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_WEBSOCKET_` (e.g. `STF_WEBSOCKET_STORAGE_URL`). ``` -------------------------------- ### Displaying Help for STF Groups Engine Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the help documentation for the `stf groups-engine` tool, detailing all available command-line options and their descriptions. It is used to understand the tool's functionality and required parameters for connecting to ZeroMQ endpoints. ```sh $ stf groups-engine --help ``` -------------------------------- ### Displaying Help for STF Storage-Temp Service (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the available command-line options for the `stf storage-temp` service. It provides details on configuring file size limits, port binding, save directories, bundletool paths, and keystore parameters for signing APKs built from AABs. Each option can also be configured via environment variables. ```Shell $ stf storage-temp --help ``` ```Shell stf storage-temp Options: -h, --help Show help. [boolean] --max-file-size Maximum file size to allow for uploads. Note that nginx may have a separate limit, meaning you should change both. [number] [default: 1073741824] --port, -p The port to bind to. [number] [default: 7100] --save-dir The location where files are saved to. [string] [default: "/var/folders/7z/vpsprbws1tdbdp5vwxbvdv400000gp/T"] --bundletool-path The path to bundletool binary. [string] [default: "/app/bundletool/bundletool.jar"] --ks The name of the keystore to sign APKs built from AAB. [string] [default: "openstf"] --ks-key-alias Indicates the alias to be used in the future to refer to the keystore. [string] [default: "mykey"] --ks-pass The password of the keystore. [string] [default: "openstf"] --ks-key-pass The password of the private key contained in keystore. [string] [default: "openstf"] --ks-keyalg The algorithm that is used to generate the key. [string] [default: "RSA"] --ks-validity Number of days of keystore validity. [number] [default: "90"] --ks-keysize Key size of the keystore. [number] [default: "2048"] --ks-dname Keystore Distinguished Name, contain Common Name(CN), Organizational Unit (OU), Oranization(O), Locality (L), State (S) and Country (C). [string] [default: "CN=openstf.io, OU=openstf, O=openstf, L=PaloAlto, S=California, C=US"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_STORAGE_TEMP_` (e.g. `STF_STORAGE_TEMP_SAVE_DIR`). ``` -------------------------------- ### Removing a Device from User Control Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This endpoint removes a specific device from the authenticated user's control, analogous to 'Stop using' in the UI. The device serial number is required in the URL path. Both cURL and Node.js examples demonstrate the deletion process. ```bash DELETE /api/v1/user/devices/{serial} ``` ```bash curl -X DELETE -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user/devices/{serial} ``` ```javascript clientWithPromise.then(function(api) { return api.user.deleteUserDeviceBySerial({serial: 'yyyy'}) .then(function(res) { console.log(res.obj) // { success: true, description: 'Device successfully removed' } }) }) .catch(function(err) { console.log(err) }) ``` -------------------------------- ### Adding a Device for the Authenticated User Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This endpoint allows the authenticated user to add a device to their control, similar to the 'Use' action in the UI. It requires the device's serial number and an optional timeout. The cURL example shows how to send JSON data. ```bash POST /api/v1/user/devices ``` ```bash curl -X POST --header "Content-Type: application/json" --data '{"serial":"EP7351U3WQ"}' -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user/devices ``` ```javascript var device = {serial: 'yyyy', timeout: 900000 } clientWithPromise.then(function(api) { return api.user.addUserDevice({device: device}) .then(function(res) { console.log(res.obj) // { success: true, description: 'Device successfully added' } }) }) .catch(function(err) { console.log(err) }) ``` -------------------------------- ### Listing Specific STF Device Fields using Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example demonstrates how to retrieve a list of STF devices, specifying only certain fields (serial, using, ready) in the request. This helps in fetching only relevant data and reducing payload size. ```javascript clientWithPromise.then(function(api) { api.devices.getDevices({fields: 'serial,using,ready'}) .then(function(res) { console.log(res.obj.devices) // [ { serial: 'xxxx', using: false, ready: true }, // { serial: 'yyyy', using: false, ready: true }] }) }) ``` -------------------------------- ### Running Project Tests Source: https://github.com/vkcom/devicehub/blob/master/CONTRIBUTING.md This command executes the project's test suite, primarily used to verify code styling and ensure adherence to established coding standards before a pull request is submitted. It's a crucial step for maintaining code quality and consistency. ```Shell npm test ``` -------------------------------- ### Displaying Groups Engine Help (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to display the help documentation for the `stf groups-engine` command. It outlines options for configuring ZeroMQ PULL and PUB endpoints for both app-side and device-side connections, crucial for inter-process communication within the STF system. Options can also be set via environment variables. ```Shell $ stf groups-engine --help ``` ```CLI Output stf groups-engine Options: -h, --help Show help. [boolean] --connect-push, -c App-side ZeroMQ PULL endpoint to connect to. [array] [required] --connect-sub, -u App-side ZeroMQ PUB endpoint to connect to. [array] [required] --connect-push-dev, --pd Device-side ZeroMQ PULL endpoint to connect to. [array] [required] --connect-sub-dev, --sd Device-side ZeroMQ PUB endpoint to connect to. [array] [required] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_GROUPS_ENGINE_` .) ``` -------------------------------- ### Displaying Help for STF Migrate Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the help output for the `stf migrate` subcommand, providing information on its usage and available general options like `--help` and `--version`. ```sh $ stf migrate --help ``` -------------------------------- ### STF Storage Plugin APK Command-Line Options (Text) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This output describes the configuration options for the 'stf storage-plugin-apk' component, including the binding port, the URL to the storage unit, and the directory for caching APK files. It also explains how to use environment variables for configuration. ```text stf storage-plugin-apk Options: -h, --help Show help. [boolean] --port, -p The port to bind to. [number] [default: 7100] --storage-url, -r URL to the storage unit. [string] [required] --cache-dir The location where to cache APK files. [string] [default: "/var/folders/7z/vpsprbws1tdbdp5vwxbvdv400000gp/T"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_STORAGE_PLUGIN_APK_` (e.g. `STF_STORAGE_PLUGIN_APK_CACHE_DIR`). ``` -------------------------------- ### Disconnecting Remote Debugging Session Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This endpoint terminates an active remote debugging session for a specific device controlled by the authenticated user. The device serial number is required in the URL path. Both cURL and Node.js examples demonstrate how to perform the disconnection and handle potential errors. ```bash DELETE /api/v1/user/devices/{serial}/remoteConnect ``` ```bash curl -X DELETE -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user/devices/{serial}/remoteConnect ``` ```javascript clientWithPromise.then(function(api) { return api.user.remoteDisconnectUserDeviceBySerial({serial: 'CB5125LBYM'}) .then(function(res) { console.log(res.obj) // { success: true, // description: 'Device remote disconnected successfully' } }) }) .catch(function(err) { console.log(err) // {"success":false,"description":"Device is not owned by you or is not available"} }) ``` -------------------------------- ### Displaying Help for STF OpenID Authentication (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This command displays all available command-line options and their descriptions for configuring the STF OpenID authentication module. It is useful for understanding the required and optional parameters for setting up OpenID integration. ```Shell $ stf auth-openid --help ``` -------------------------------- ### Retrieving Specific STF Device Fields by Serial using Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example demonstrates fetching specific fields (serial, using, ready) for a single STF device using its serial number. This allows for targeted data retrieval, optimizing network usage. ```javascript clientWithPromise.then(function(api) { api.devices.getDeviceBySerial({serial: 'xxxx', fields: 'serial,using,ready'}) .then(function(res) { console.log(res.obj.device) // { serial: 'xxxx', using: false, ready: true } }) }) ``` -------------------------------- ### Authenticating with STF API using Node.js (Callback) Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example uses the 'swagger-client' library to authenticate with the STF API. It configures an API key authorization with a bearer token and fetches user details using a callback function upon successful client initialization. ```javascript var Swagger = require('swagger-client'); var SWAGGER_URL = 'https://stf.example.org/api/v1/swagger.json'; var AUTH_TOKEN = 'xx-xxxx-xx'; // Without Promise var client = new Swagger({ url: SWAGGER_URL , authorizations: { accessTokenAuth: new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + AUTH_TOKEN, 'header') } , success: function() { client.user.getUser(function(user) { console.log(user.obj) }) } }); ``` -------------------------------- ### Displaying Help for STF Auth OAuth2 (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This snippet demonstrates how to view the command-line help for the `stf auth-oauth2` module, which configures an OAuth 2.0 authentication server. It outlines essential parameters such as OAuth URLs, client credentials, callback URL, scope, state, domain, port, secret, session ID, and support/docs URLs. ```sh $ stf auth-oauth2 --help ``` ```text stf auth-oauth2 Options: -h, --help Show help. [boolean] --app-url, -a URL to the app unit. [string] [required] --oauth-authorization-url OAuth 2.0 authorization URL. [string] [required] --oauth-token-url OAuth 2.0 token URL. [string] [required] --oauth-userinfo-url OAuth 2.0 user info URL. [string] [required] --oauth-client-id OAuth 2.0 client ID. [string] [required] --oauth-client-secret OAuth 2.0 client secret. [string] [required] --oauth-callback-url OAuth 2.0 callback URL. [string] [required] --oauth-scope Space-separated OAuth 2.0 scope.[string] [required] --oauth-state Whether to enable OAuth 2.0 state token support. [boolean] [default: false] --oauth-domain Optional email domain to allow authentication for. [string] --port, -p The port to bind to. [number] [default: 7120] --secret, -s The secret to use for auth JSON Web Tokens. Anyone who knows this token can freely enter the system if they want, so keep it safe. [string] [required] --ssid, -i The name of the session ID cookie. [string] [default: "ssid"] --support, --sl url thats need be opened to access support [string] [default: "https://vk.com"] --docsUrl, --du url thats need be opened to acces docs [string] [default: "https://vk.com"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_AUTH_OAUTH2_` (e.g. `STF_AUTH_OAUTH2_SECRET`). Legacy environment variables like OAUTH_SCOPE are still accepted, too, but consider them deprecated. ``` -------------------------------- ### Building Python Wheel Package with Poetry Source: https://github.com/vkcom/devicehub/blob/master/test/api/devicehub_client/README.md This command builds a Python wheel distribution file for the current project using Poetry. The `-f wheel` flag specifically requests the wheel format, which is a standard for Python package distribution. ```Shell poetry build -f wheel ``` -------------------------------- ### Authenticating with STF API using Node.js (Promise) Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js example demonstrates authentication with the STF API using 'swagger-client' with Promises. It initializes the client with a bearer token and then uses the .then() method to fetch and log the user's email upon successful API interaction. ```javascript var clientWithPromise = new Swagger({ url: SWAGGER_URL , usePromise: true , authorizations: { accessTokenAuth: new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + AUTH_TOKEN, 'header') } }) clientWithPromise.then(function(api) { api.user.getUser() .then(function(res) { console.log(res.obj.user.email) // vishal@example.com }) }) ``` -------------------------------- ### Updating RethinkDB Admin Password (JavaScript) Source: https://github.com/vkcom/devicehub/blob/master/doc/DEPLOYMENT.md This JavaScript command is used to update the 'admin' user's password in RethinkDB. It should be executed via the RethinkDB web UI (typically at http://DB_SERVER_IP:8080) after the RethinkDB unit has started, providing a way to secure the database's administrative access. ```javascript r.db('rethinkdb').table('users').get('admin').update({password:'yourBrandNewKey'}) ``` -------------------------------- ### Displaying Help for STF Log-MongoDB Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to access the help documentation for the `stf log-mongodb` subcommand, which is used for logging to MongoDB. It lists available options such as connecting to ZeroMQ PUB endpoint and setting the minimum log level. ```sh $ stf log-mongodb --help ``` -------------------------------- ### Establishing Remote Connection for a Device Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This endpoint retrieves the remote debug URL (an `adb connect`able address) for a device controlled by the authenticated user. It's crucial to have your ADB key set up in STF beforehand to avoid unauthorized states. The Node.js example shows how to handle successful responses and errors. ```bash POST /api/v1/user/devices/{serial}/remoteConnect ``` ```bash curl -X POST -H "Authorization: Bearer YOUR-TOKEN-HERE" https://stf.example.org/api/v1/user/devices/{serial}/remoteConnect ``` ```javascript clientWithPromise.then(function(api) { return api.user.remoteConnectUserDeviceBySerial({serial: 'CB5125LBYM'}) .then(function(res) { console.log(res.obj.remoteConnectUrl) // $PROVIDER_IP:16829 }) }) .catch(function(err) { console.log(err) // {"success":false, // "description":"Device is not owned by you or is not available"}' } }) ``` -------------------------------- ### Displaying General STF Command-Line Help Source: https://github.com/vkcom/devicehub/blob/master/units.md This command displays the general help output for the STF tool, listing all available top-level commands and global options. It provides an overview of the tool's capabilities and how to use its various units. ```Shell $ stf --help ``` -------------------------------- ### Connecting to STF Device and Getting Remote URL in Node.js Source: https://github.com/vkcom/devicehub/blob/master/doc/API.md This Node.js script uses the `swagger-client` library to interact with the STF API. It connects to a device by serial, checks its availability, adds it to the user's devices, and then retrieves its remote debug URL. It requires `SWAGGER_URL` and `AUTH_TOKEN` for API access and takes the device serial as a command-line argument. ```javascript // stf-connect.js var Swagger = require('swagger-client'); var SWAGGER_URL = 'https://stf.example.org/api/v1/swagger.json'; var AUTH_TOKEN = 'xx-xxxx-xx'; // Using Promise var client = new Swagger({ url: SWAGGER_URL , usePromise: true , authorizations: { accessTokenAuth: new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + AUTH_TOKEN, 'header') } }) var serial = process.argv.slice(2)[0] client.then(function(api) { return api.devices.getDeviceBySerial({ serial: serial , fields: 'serial,present,ready,using,owner' }).then(function(res) { // check if device can be added or not var device = res.obj.device if (!device.present || !device.ready || device.using || device.owner) { console.log('Device is not available') return } // add device to user return api.user.addUserDevice({ device: { serial: device.serial , timeout: 900000 } }).then(function(res) { if (!res.obj.success) { console.log('Could not add device') return } // get remote connect url return api.user.remoteConnectUserDeviceBySerial({ serial: device.serial }).then(function(res) { console.log(res.obj.remoteConnectUrl) }) }) }) }) ``` -------------------------------- ### Displaying Help for STF iOS Device Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to access the help documentation for the `stf ios-device` command, which is used to manage and configure iOS devices within the STF (Smartphone Test Farm) system. It lists all available command-line options, their types, default values, and whether they are required, providing comprehensive details for setting up device connections, screen streaming, and other operational parameters. ```Shell $ stf ios-device --help ``` ```Shell stf ios-device Options: -h, --help Show help. [boolean] --boot-complete-timeout How long to wait for boot to complete during device setup. [number] [default: 60000] --cleanup Attempt to reset the device between uses by uninstallingapps, resetting accounts and clearing caches. Does not do a perfect job currently. Negate with --no-cleanup. [boolean] [default: true] --connect-push, -p ZeroMQ PULL endpoint to connect to.[array] [required] --connect-sub, -s ZeroMQ PUB endpoint to connect to. [array] [required] --connect-url-pattern The URL pattern to use for `adb connect`. [string] [default: "${publicIp}:${publicPort}"] --group-timeout, -t Timeout in seconds for automatic release of inactive devices. [number] [default: 900] --heartbeat-interval Send interval in milliseconds for heartbeat messages. [number] [default: 10000] --lock-rotation Whether to lock rotation when devices are being used. Otherwise changing device orientation may not always work due to sensitive sensors quickly or immediately reverting it back to the physical orientation. [boolean] --provider, -n Name of the provider. [string] [required] --public-ip The IP or hostname to use in URLs.[string] [required] --screen-jpeg-quality The JPG quality to use for the screen. [number] [default: 80] --screen-ping-interval The interval at which to send ping messages to keep the screen WebSocket alive. [number] [default: 30000] --screen-port Port allocated to the screen WebSocket. [number] [required] --screen-reset Go back to home screen and reset screen rotation when user releases device. Negate with --no-screen-reset. [boolean] [default: true] --screen-ws-url-pattern The URL pattern to use for the screen WebSocket. [string] [default: "ws://${publicIp}:${publicPort}"] --serial The USB serial number of the device. [string] [required] --storage-url, -r The URL to the storage unit. [string] [required] --connect-app-dealer App-side ZeroMQ DEALER endpoint to connect to. [array] [required] --connect-dev-dealer Device-side ZeroMQ DEALER endpoint to connect to. [array] [required] --wda-host iOS device host ip address where WDA is started. [string] [required] --wda-port The port the WDA should run et. [number] [default: 8100] --mjpeg-port The port the WDA mjpeg is started. [number] [required] [default: 9001] --udid-storage The path for ip information of devices [string] [default: false] --iproxy If the option with iproxy is passed, use proxy connection with devices [boolean] [default: false] --device-name Device name [string] [default: "Generic iOS Device"] --host Provider hostname. [string] [required] [default: "127.0.0.1"] -V, --version Show version number [boolean] ``` -------------------------------- ### Systemd Unit for Dockerized Nginx Load Balancer Source: https://github.com/vkcom/devicehub/blob/master/doc/DEPLOYMENT.md This systemd unit file defines how to run and manage an Nginx public load balancer as a Docker container. It specifies dependencies on the Docker service, checks for necessary SSL and configuration files, and includes commands for pulling the Nginx image, starting the container with host networking and volume mounts, and gracefully stopping it. ```ini [Unit] Description=STF nginx public load balancer After=docker.service Requires=docker.service ConditionPathExists=/srv/ssl/stf.example.org.crt ConditionPathExists=/srv/ssl/stf.example.org.key ConditionPathExists=/srv/ssl/dhparam.pem ConditionPathExists=/srv/nginx/nginx.conf [Service] EnvironmentFile=/etc/environment TimeoutStartSec=0 Restart=always ExecStartPre=/usr/bin/docker pull nginx:1.17.4 ExecStartPre=-/usr/bin/docker kill %p ExecStartPre=-/usr/bin/docker rm %p ExecStart=/usr/bin/docker run --rm \ --name %p \ --net host \ -v /srv/ssl/stf.example.org.crt:/etc/nginx/ssl/cert.pem:ro \ -v /srv/ssl/stf.example.org.key:/etc/nginx/ssl/cert.key:ro \ -v /srv/ssl/dhparam.pem:/etc/nginx/ssl/dhparam.pem:ro \ -v /srv/nginx/nginx.conf:/etc/nginx/nginx.conf:ro \ nginx:1.17.4 \ nginx ExecStop=/usr/bin/docker stop -t 2 %p ``` -------------------------------- ### Displaying Help for STF Migrate Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet demonstrates how to view the help documentation for the `stf migrate` subcommand. This command is typically used for database migrations within the STF system. ```sh $ stf migrate --help ``` -------------------------------- ### Running iOS Provider for DeviceHub (Bash) Source: https://github.com/vkcom/devicehub/blob/master/doc/ios-docs/ios-device.md This command initializes the `stf ios-provider` unit, connecting it to various DeviceHub services for managing iOS devices. It sets up communication channels for subscriptions, push notifications, app and device dealing, and configures screen streaming and storage URLs. This is a crucial step for integrating an iOS device into the DeviceHub ecosystem after WebDriverAgent has been started. ```bash stf ios-provider \ --connect-sub tcp://127.0.0.1:7114 \ --connect-push tcp://127.0.0.1:7116 \ --connect-app-dealer tcp://127.0.0.1:7112 \ --connect-dev-dealer tcp://127.0.0.1:7115 \ --screen-ws-url-pattern 'ws://localhost:<%= publicPort %>' \ --public-ip localhost \ --provider localworker \ --storage-url http://localhost:7100/ ``` -------------------------------- ### Displaying Help for STF Image Storage Plugin in Shell Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to access the help documentation for the `stf storage-plugin-image` component, responsible for image storage and transformation. The help output outlines options like `concurrency`, `port`, `storage-url`, `cache-dir`, `secret`, and `ssid`, along with their types and default values. ```sh $ stf storage-plugin-image --help ``` -------------------------------- ### Displaying Help for STF Log MongoDB Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the help output for the `stf log-mongodb` subcommand, detailing available options such as ZeroMQ PUB endpoint connection (`--connect-sub`) and minimum log level (`--priority`). Options can be overridden by environment variables prefixed with `STF_LOG_MONGODB_`. ```sh $ stf log-mongodb --help ``` -------------------------------- ### Displaying Help for the STF App Unit Source: https://github.com/vkcom/devicehub/blob/master/units.md This command displays the specific help output for the `stf app` command, detailing all available options for configuring the App unit. It's used to understand how to set up the main web application service, including authentication and websocket URLs. ```Shell $ stf app --help ``` -------------------------------- ### Displaying Help for STF Processor Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the help output for the `stf processor` subcommand, outlining options for connecting to app-side and device-side ZeroMQ DEALER endpoints and setting a recognizable name for log output. Options can be overridden by environment variables prefixed with `STF_PROCESSOR_`. ```sh $ stf processor --help ``` -------------------------------- ### Displaying Help for the STF API Unit Source: https://github.com/vkcom/devicehub/blob/master/units.md This command displays the specific help output for the `stf api` command, detailing all available options for configuring the API unit. It's used to understand how to set up the API service, including connection endpoints, port, and security secrets. ```Shell $ stf api --help ``` -------------------------------- ### Displaying Mock Authentication Module CLI Options (Shell) Source: https://github.com/vkcom/devicehub/blob/master/units.md This snippet shows how to retrieve the command-line options for the `stf auth-mock` module. It details parameters for configuring a mock authentication provider, including basic authentication settings and security tokens. Options can also be set via environment variables prefixed with `STF_AUTH_MOCK_`. ```Shell $ stf auth-mock --help ``` ```Shell stf auth-mock Options: -h, --help Show help. [boolean] --app-url, -a URL to the app unit. [string] [required] --basic-auth-password Basic auth password (if enabled). [string] --basic-auth-username Basic auth username (if enabled). [string] --port, -p The port to bind to. [number] [default: 7120] --secret, -s The secret to use for auth JSON Web Tokens. Anyone who knows this token can freely enter the system if they want, so keep it safe. [string] [required] --ssid, -i The name of the session ID cookie. [string] [default: "ssid"] --use-basic-auth Whether to "secure" the login page with basic authentication. [boolean] --support, --sl url which needed to access support [string] [default: "example.com"] --docsUrl, --du url which needed to access docs [string] [default: "example.com"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_AUTH_MOCK_` (e.g. `STF_AUTH_MOCK_SECRET`). Legacy environment variables like BASIC_AUTH_USERNAME are still accepted, too, but consider them deprecated. ``` -------------------------------- ### Displaying Help for OpenID Authentication Module (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This command displays the available command-line options and their descriptions for configuring the `stf auth-openid` authentication module. It provides details on required parameters like `app-url`, `openid-identifier-url`, `secret`, `openid-client-id`, and `openid-client-secret`, along with optional parameters and their default values. Options can be overridden by environment variables prefixed with `STF_AUTH_OPENID_`. ```Shell $ stf auth-openid --help ``` -------------------------------- ### STF Storage Plugin Image Command-Line Options (Text) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This section details the command-line options for the 'stf storage-plugin-image' component, covering settings like concurrency for transformations, the binding port, the storage unit URL, and the image cache directory. It also provides guidance on environment variable overrides. ```text stf storage-plugin-image Options: -h, --help Show help. [boolean] --concurrency, -c Maximum number of simultaneous transformations. [number] --port, -p The port to bind to. [number] [default: 7100] --storage-url, -r URL to the storage unit. [string] [required] --cache-dir The location where to cache images. [string] [default: "/var/folders/7z/vpsprbws1tdbdp5vwxbvdv400000gp/T"] -V, --version Show version number [boolean] Each option can be be overwritten with an environment variable by converting the option to uppercase, replacing dashes with underscores and prefixing it with `STF_STORAGE_PLUGIN_IMAGE_` (e.g. `STF_STORAGE_PLUGIN_IMAGE_CONCURRENCY`). ``` -------------------------------- ### Displaying Help for STF Auth-LDAP Command (Shell) Source: https://github.com/vkcom/devicehub/blob/master/doc/units.md This snippet illustrates how to retrieve the help documentation for the `stf auth-ldap` command, which handles LDAP-based authentication. It provides details on numerous LDAP-specific options such as bind credentials, search DN, search field, URL, timeout, and integration with the app unit, along with port, secret, and session ID cookie settings. ```Shell $ stf auth-ldap --help ```