Skip to content

Instantly share code, notes, and snippets.

@u9O
Created June 4, 2020 09:46
Show Gist options
  • Save u9O/194945b160e39855ffe687133d6aee79 to your computer and use it in GitHub Desktop.
Save u9O/194945b160e39855ffe687133d6aee79 to your computer and use it in GitHub Desktop.
Configuration Manager

Configuration Manager

Alexander Andryashin, Ivan Krutov, Kirill Merkushev and the Aerokube communityVersion Latest,2020-03-01

Table of Contents

This reference covers version: latest.

Configuration manager is a small application used to automatically configure Aerokube products.

ui

1. Quick Start Guide

This guide will show how to start Selenoid in a fastest way with help of Configuration Manager. First, you need to download latest release binary from GitHub releases for your platform (linux/darwin/windows).

To simplify this process you launch small script:

On Linux and Mac OS

curl -s https://aerokube.com/cm/bash | bash \
&& ./cm selenoid start --vnc

On Windows

> Invoke-Expression (New-Object System.Net.WebClient).DownloadString("https://aerokube.com/cm/posh")
> ./cm.exe selenoid start --vnc

or just download the latest binary with your browser from releases page for windows (386 and amd64 binaries available). Then if you have Powershell type:

> ./cm.exe selenoid start --vnc

If you are working behind proxy you should set environment variables HTTP_PROXY, HTTPS_PROXY or NO_PROXY described in Docker documentation:

$ HTTP_PROXY=http://proxy.example.com:80/ ./cm selenoid start

2. Configuring Selenoid

This section describes supported ways of automatic Selenoid configuration.

To quickly configure and run Selenoid with defaults type:

./cm selenoid start

Selenoid can be configured in two ways:

  • Using Docker containers (default)

  • Using standalone binaries (when --use-drivers is added)

To view the list of available commands:

./cm selenoid --help

To launch command:

./cm selenoid <command> [args...]

Supported commands are:

Table 1. Commands to configure and run Selenoid

Command

Meaning

args

Print Selenoid command line arguments

cleanup

Removes Selenoid traces

configure

Creates Selenoid configuration file (implies download)

download

Downloads Selenoid binary or container image

start

Starts Selenoid process or container (implies download and configure)

status

Shows actual configuration status (whether Selenoid is downloaded, configured or running)

stop

Stops Selenoid process or container

update

Updates Selenoid and configuration to latest version

To see supported flags for each command append --help:

./cm selenoid start --help

2.1. Example Commands

  • download command downloads latest or specified Selenoid release as standalone binary or container image:

    ./cm selenoid download --version 1.2.1 --force
    

    This command does nothing when already downloaded. Use --force flag to download again.

  • configure command in addition to downloading Selenoid also downloads container images or webdriver binaries and generates configuration file:

    ./cm selenoid configure --browsers firefox:>45.0;opera:53.0;android --last-versions 2 --tmpfs 128
    

    Use --browsers to limit browsers to be configured, --tmpfs - to add Tmpfs support, --last-versions - to limit how many last browser versions to download. If you wish to download all available versions - specify --last-versions 0.

  • start command configures Selenoid and starts it:

    ./cm selenoid start
    

    By default Selenoid data is stored in ~/.aerokube/selenoid but you can specify another directory using --config-dir flag. To download images with VNC server (to see live browser screen) use --vnc flag:

    ./cm selenoid start --vnc
    

    To override Selenoid listen port add --port flag:

    ./cm selenoid start --port 4445
    

    To override Selenoid startup arguments sessions add --args flag:

    ./cm selenoid start --args "-limit 10"
    

    To download images from private registry - log in with docker login command and add --registry flag:

    docker login my-registry.example.com # Specify user name and password
    ./cm selenoid start --registry https://my-registry.example.com
    

2.2. Downloading Only Some Browser Versions

By default CM downloads browser images corresponding to 2 last versions of Firefox, Chrome and Opera. To download concrete browser versions - use --browsers flag as follows:

Download concrete versions of Firefox and Chrome

./cm selenoid start --browsers 'firefox:51.0;firefox:55.0;chrome:66.0'

Download a range of Firefox versions and 3 last Opera versions

./cm selenoid start --browsers 'firefox:>51.0,<=55.0;opera' --last-versions 3

Download Android image (not downloaded by default because of image size)

./cm selenoid start --browsers 'android:6.0'

2.3. Using Existing Configuration File

In some cases you may want to configure Selenoid to use an existing browsers.json configuration file. This is mainly needed to always use the same browser versions instead of downloading latest versions. To achieve this:

  1. Prepare a desired browsers.json configuration file

  2. Launch cm with --browsers-json flag:

    ./cm selenoid start --browsers-json /path/to/browsers.json
    

3. Starting Selenoid UI

This section describes supported ways of automatic Selenoid UI startup.

To quickly run Selenoid UI type:

$ ./cm selenoid-ui start

Selenoid UI configuration algorithm is similar to Selenoid one - it can be started either in Docker container if you have Docker installed or as a standalone binary otherwise. Supported commands are:

Table 2. Commands to run Selenoid UI

Command

Meaning

args

Print Selenoid UI command line arguments

cleanup

Removes Selenoid UI traces

download

Downloads Selenoid UI binary or container image

start

Starts Selenoid UI process or container (implies download)

status

Shows actual service status (whether Selenoid is downloaded or running)

stop

Stops Selenoid UI process or container

update

Updates Selenoid to latest version

To see supported flags for each command append --help:

$ ./cm selenoid start --help

3.1. Example Commands

These commands just repeat similar commands for Selenoid so we give no comments here:

$ ./cm selenoid-ui download --version 1.2.1 --force $ ./cm selenoid-ui start $ ./cm selenoid-ui start --port 8081 $ ./cm selenoid-ui start --args "--period 100ms"

4. Contributing & Development

To build cm:

  1. Install Golang

  2. Setup $GOPATH properly

  3. Get cm source:

    $ go get -d github.com/aerokube/cm

  4. Go to project directory:

    $ cd $GOPATH/src/github.com/aerokube/cm

  5. Checkout dependencies:

    $ go get -u github.com/golang/dep/cmd/dep && dep ensure

  6. Build source:

    $ go build

  7. Run cm:

    $ ./cm --help

To build Docker container type:

$ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build
$ docker build -t cm:latest .

Version latest
Last updated 2020-03-01 14:23:24 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment