Skip to content

woyow/selenoid-config-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

selenoid-config-tool

Linux only Only Linux support ;)

Tool for selenoid and ggr configs management. Automatically generating directories and browsers.json, docker-compose.yaml, users.htpasswd and quota files for selenoid and ggr.

Features:

  • ggr
    • config (browsers.json)
    • quota (user.xml)
    • docker-compose.yaml
    • users.htpasswd
  • selenoid
    • config (browsers.json)
    • docker-compose.yaml
  • teams-quota / users-quota
    • htpasswd
  • hosts config
    • standart parameters for selenoid (image, port, path)
    • optional parameters for selenoid (env, tmpfs, volumes, hosts, labels, sysctl, shmSize, cpu, mem)
    • shell-script for pull browsers images from browsers-config
  • Dockerfile (for usage tool into docker)
  • ??? Automatic deployment to tests servers via ssh
    • ??? Ansible playbooks

Results Example

.
├── ...
├── results                                 # Directory with results
│   ├── ggr                                 # Directory with ggr configs
│   │   ├── 111.111.111.111                 # Example IP
│   │   │   ├── config
│   │   │   │    └── browsers.json
│   │   │   │
│   │   │   ├── quota
│   │   │   │    ├── dev_team.xml
│   │   │   │    ├── qa_team.xml
│   │   │   │    └── test_user.xml
│   │   │   │
│   │   │   ├── docker-compose.yaml
│   │   │   └── users.htpasswd
│   │   │   
│   │   ├── ggr-balancer.dev.example.com    # Example Host
│   │   └── localhost
│   │
│   └── selenoid                            # Directory with selenoid configs
│   │   ├── 111.111.111.112                 # Example IP
│   │   │   ├── config
│   │   │   │    └── browsers.json
│   │   │   │
│   │   │   └── docker-compose.yaml
│   │   │
│   │   ├── selenoid-us.dev.example.com    # Example Host
│   │   └── localhost
│   │
└── ...

Usage

Download tool

  1. Clone repository
cd ~
git clone [email protected]:woyow/selenoid-config-tool.git
  1. Go to folder with tool
cd ~/selenoid-config-tool

Fill config file

1. Create config.yaml file

cd ~/selenoid-config-tool/config
touch ./config.yaml

2. Fill browsers array

browsers:
  - type: {{ image_name }}
    use: {{ bool }}
    vnc-image: # [optional]
      enable: {{ bool }}
      versions:
        # You can specify an array of the browsers you need using the `array` key
        array: {{ [array] }} # [float] array
        # OR
        # You can specify the range of versions you need in increments of 1 using the `range` key
        range:
          min: {{ min_value }} # float
          max: {{ max_value }} # float or latest
          ignore: {{ [array] }} # [optional] - [float] array
        # OR
        # You can specify the highest version from the docker registry using the `highest` key
        highest: true
    default-version:
      # You can specify the highest version from your version array using the `highest` key
      highest: true
      # OR
      # You can specify a custom version from your version array using the `custom` key.
      custom: {{ custom_value }} # float
      # OR
      # You can specify the minimal version from your version array using the `minimal` key
      minimal: true
    versions:
      # You can specify an array of the browsers you need using the `array` key
      array: {{ [array] }} # [float] array
      # OR
      # You can specify the range of versions you need in increments of 1 using the `range` key
      range:
        min: {{ min_value }} # float
        max: {{ max_value }} # float or latest
        ignore: {{ [array] }} # [optional] - [float] array
      # OR
      # You can specify the latest version from the docker registry using the `latest` key
      latest: true

3. Fill aerokube dictionary (selenoid + ggr declaration)

aerokube:
  selenoid:
    image-version: {{ image_version }} # float or latest
    host-port: {{ port_value }}

  selenoid-ui: # [optional]
    image-version: {{ image_version }} # float or latest
    host-port: {{ port_value }}

  ggr: # [optional]
    image-version: {{ image_version }} # float or latest
    host-port: {{ port_value }}
    
  ggr-ui: # [optional]
    image-version: {{ image_version }} # float or latest
    host-port: {{ port_value }}

4. Fill hosts dictionary

hosts:
  ggr:
    ip: {{ ip_value }}
    # OR/AND
    domain: {{ domain_value }}

  selenoid:
    # Array with regions
    - region:
        name: {{ region_name_value }}
        hosts: # array with hosts dictionaries
          - ip: {{ ip_value }}
            domain: {{ domain_value }} # [optional] - domain takes precedence over ip
            count: {{ count_value }} # [optional] - [default - 1]
            cpu-limit: {{ cpu_limit_value }} # [optional] - [default - 1]
            teams-quota: {{ [array] }} # [array] with team/user-name for quota

5. Fill teams quota array

teams-quota: # [optional] - if use ggr balancer
  - name: {{ team_name_value }}
    password: {{ password_value }}

Run script

1. Go to the folder and give execute permissions

cd ~/selenoid-config-tool
chmod u+x ./sctool

2. Install requirements

python3 -m pip install -r requirements.txt

3. Default usage

./sctool

4. Usage with parameters

4.1 Get help

./sctool --help

4.2 Run with custom parameters

./sctool --results-dir ./your-results-dir --config-dir ./your-config-dir
# or
./sctool -r ./your-results-dir -c ./your-config-dir

Run tool via Docker

1. Create and fill config.yaml file

cd ~/selenoid-config-tool/config
touch ./config.yaml

2. Create dir for results

cd ~/selenoid-config-tool
mkdir ./results

3. Build docker-image

cd ~/selenoid-config-tool
docker build -t 'sctool' .

4. Run docker image with parameters

docker run --rm -v ~/selenoid-config-tool/config/config.yaml:/app/config/config.yaml -v ~/selenoid-config-tool/results/:/app/results/ sctool:latest

Results

1. Change to the directory with the results

cd ~/selenoid-config-tool/results

2. Ready!

Possible problems

The tool uses caching for http-responses. Therefore, in rare cases, you may not receive up-to-date information on browser versions. The cache is stored in the default folder for your user - ~/.cache/

For remove cache, usage:

rm ~/.cache/selenoid_config_tool_requests_cache.sqlite