Database Stored Settings

Managing database stored testgrinder settings

testgrinder service will be discontinued on January 31, 2025

testgrinder SMPC was discontinued as of February 1, 2024

Most testgrinder settings are stored in the database. Some of the settings have suitable default values upon initial deployment, but many have to be set before testgrinder can be used.

export-settings Script

tg-app comes with the script export-settings which, when executed, will export the current database settings as another script with the settings listed. Each setting will appear as a commented out line (# in front of the line). To modify the settings, you will need to uncomment lines, set proper values, and run the generated script.

Running export-settings Script

First, connect to the tg-app instance via ssh using the key that you chose when launching the instance, switch to the testgrinder user account, and navigate to the tg-app home directory:

$ ssh ubuntu@my-tg-app
$ sudo su - testgrinder
$ cd tg-app
  • substitute my-tg-app with the public domain of your tg-app instance

  • testgrinder is deployed under ubuntu user testgrinder

When running the export-settings script, supply the name of the output script as an argument:

$ script/export-settings my_settings

The generated my_settings script will look similar to this:

#!/usr/bin/env -S rails runner

# testgrinder settings exported from the database at 2022-11-08 13:44:39 -0500  
# 
# This script can be used to modify the settings in the database.
# For that, uncomment the relevant 'set' line(s) by removing the leading hash tag (#), modify the value, and run the script.
#
# Note: Some settings allow multiline values. These will have '<<EOS' in place of a value, followed by
# the value lines, and terminated by a line with only 'EOS' on it. Make sure to uncomment all lines for these.
#
# Note: all time or time interval values are in seconds unless stated otherwise
#
# To apply the changes, run this script from /home/testgrinder/tg-app as user testgrinder, for example:
#
# $ sudo su - testgrinder
# $ cd /home/testgrinder/tg-app
# $ ./my_settings

require 'scripts/settings'

## Version

# tg-app version - DO NOT CHANGE - automatically updated on successful database upgrade during provisioning
#set version: "1.0.8"


## AWS

# array of AWS VPC subnet IDs in which tg-app can spawn EC2 instances
#set aws_vpc_subnet_ids: nil

# A hard limit on the total number of AWS instances. testgrinder will not launch more if this limit is reached.
#set max_aws_instances: 20

# if specified, any launched EC2 instance (bot/gateway) will be configured to authorize ssh access for this key
#set ec2_instance_key_name: nil


## Storage

# S3 bucket for storing screenshots and videos
#set media_s3_bucket: nil

# S3 bucket for storing user files attached to projects
#set user_files_s3_bucket: nil


## Bots

# URL bots should use to communicate with tg-app API, e.g. my_testgrinder:3000/ra
#set tg_api_url: nil

# AMI image ID used to launch bots
#set aws_runner_image_id: nil

# Security groups to assign to a bot on launch
#set aws_runner_security_groups: nil

# A hard limit on the total number of bots
#set max_runners: 10

# EC2 instance type to be used for launching bots
#set ec2_runner_instance_type: "c6a.large"

# bot AWS IAM role
#set aws_runner_iam_role: nil

# A bot will be discarded if it does not complete provisioning before this time is up
#set aws_runner_provision_timeout: 10.minutes

# A bot will be discarded if it fails to connect to tg-app before this time is up
#set aws_runner_connection_timeout: 10.minutes

# The time after which an idling bot is discarded if it fails to communicate with tg-app
#set session_timeout: 300.seconds

# id of the job used for priming runners, optional
#set runner_priming_job_id: nil

# schedule that defines when to keep a number of bots available
#set min_runners_schedule: nil

# minimum number of runners to keep available during the times specified the min_runners_schedule
#set min_runners_count: 0


## Scenario execution

# Number of attempts to rerun a scenario on unexpected failures
#set run_scenario_iteration_max_attempts: 3

# An executing scenario will be considered abandoned by the bot if a step does not complete in this time
#set step_timeout: 5.minutes

# An executing scenario will be considered abandoned by the bot if it does not complete in this time
#set task_timeout: 30.minutes


## Snippet sources

# IDs of projects to be made available to all accounts as snippet sources
#set snippet_source_ids: []


## Example scripts

# Example scripts will be enabled if true
#set example_scripts_enable: true

# Should example scripts be added to new accounts?
#set example_scripts_add_to_new_accounts_enable: true

# URL to the repository with the example scripts
#set example_scripts_url: "https://github.com/testgrinder/example-scripts.git"

# Branch to use for retrieval of the example scripts from the repository
#set example_scripts_branch: "main"


## Gateways (not used for SMPC deployments)

# AMI image ID used to launch gateways
#set aws_gateway_image_id: nil

# Security groups to assign to a gateway when it is launched
#set aws_gateway_security_groups: nil

# EC2 instance type to be used for launching gateways
#set ec2_gateway_instance_type: "t3a.nano"

# Gateway AWS IAM role
#set aws_gateway_iam_role: nil

# A gateway is considered failed if provisioning does not complete in this time
#set aws_gateway_provision_timeout: 5.minutes

# Idle time after which a gateway to be terminated
#set aws_gateway_max_idling_time: 10.minutes


## Agent (not used for SMPC deployments)

# Host agents should use when communicating with testgrinder
#set agent_api_hostname: nil

# S3 bucket with agent installation sets
#set agent_download_s3_bucket: "tg-public"

# S3 object path to the agent installation set
#set agent_download_s3_object: nil

# The latest available agent version
#set agent_version: nil

# tunnel mediator hostname
#set tunnel_mediator_hostname: nil

# tunnel mediator username
#set tunnel_mediator_username: nil

# tunnel mediator private key
#set tunnel_mediator_private_key: nil

To change a setting, uncomment its line by removing the preceding # (hash) and provide the new value. In order to set the S3 bucket in which screenshots and videos should be stored to my-bucket, use the following:

# S3 bucket for storing screenshots and videos
set media_s3_bucket: "my-bucket"

Enclose string parameters in quotes or double quotes. Leave numerical parameters unquoted. For parameters that represent periods of time, use <number>.<unit>, e.g. 3.seconds, 5.minutes, 1.hour, etc. If you just specify a number, it will be treated as seconds.

Run the modified script to apply the changes to the database:

$ ./my_settings
Changed media_s3_bucket: from nil => "my-bucket"
$ 

The changes take effect immediately - there is no need to restart any of the tg-app services.

Last updated