Configuration Files
testgrinder service will be discontinued on January 31, 2025
testgrinder SMPC was discontinued as of February 1, 2024
Each tg-app server expects a set of configuration files in its /home/testgrinder/tg-app/config/provision directory. These files can either be created manually or by providing specially formatted User Data as part of the tg-app launch. If such files do not exist, testgrinder will create them with workable defaults that are sufficient for launching, but not enough for testgrinder to operate fully. You will have to edit/replace these files to complete the deployment.
If your testgrinder deployment will have multiple tg-app servers (e.g. for increased fault tolerance or higher capacity), make sure all tg-app servers use the same set of configuration files. The best way to achieve that is to encode the configuration files in User Data format and supply the result as User Data during the tg-app launch.
.env
A set of configuration settings and their values
ssl_cert.crt
SSL certificate for the testgrinder site
ssl_private_key.key
SSL certificate private key
.env
If testgrinder doesn't find the .env file, it will create one with suitable defaults. You may then edit the file, or choose to provide your own via the User Data mechanism described later.
The file consists of entries formatted as <SETTING>: <VALUE>
, for example:
Settings that tg-app will recognize in .env:
STAGE_NAME
eval
unique testgrinder instance identifier; useful if you have several deployments; will appear in tg-bot names, and bugsnag reports
AWS_REGION
region testgrinder was launched in
AWS region in which testgrinder operates
FORCE_SSL
true
If true, force http requests to redirect to https
HOSTNAME
tg-eval-app-%i
hostname for tg-app server to set; %i in it will be replaced with tg-app AWS instance id
DOMAIN_WEB
tg-app instance public hostname
domain that users will use to access testgrinder (and for which the SSL certificate is issued)
DEVISE_SECRET_KEY
random 128 character string
used to generate tokens embedded in account management emails; recommended lengths - 128 characters
DEVISE_PEPPER
random 128 character string
added to user passwords prior to hashing; recommended lengths - 128 characters
SECRET_KEY_BASE
random 128 character string
used to encrypt cookies; recommended lengths - 128 characters
DBDATA_SECRET_KEY
random 32 character string
used to encrypt sensitive values in the database; must be 32 characters long
MONGODB_URI
mongodb://127.0.0.1:27017/tg_app_production
URI of the testgrinder database; default value points to the locally installed MongoDB database
DISABLE_LOCAL_MONGODB
not provided
Set to true to disable the locally installed MongoDB.
SMTP_HOST
not provided
SMTP server hostname
SMTP_PORT
not provided
SMTP server port
SMTP_USERNAME
not provided
username to use when connecting to the SMTP server
SMTP_PASSWORD
not provided
password to use when connecting to the SMTP server
MONIT_NOTIFY_EMAIL
not provided
MONIT_NOTIFY_FROM_EMAIL
not provided
Email address that will appear in the "From" field of Monit notification emails
TIMEZONE
America/New_York
Timezone for tg-app to set; get the list of available timezones with
timedatectl list-timezones
PAPERTRAIL
not provided
BUGSNAG_API_KEY
not provided
Here's an example of a .env generated by tg-app if it doesn't find one on launch:
Do not use key values listed below, generate your own
ssl_cert.crt and ssl_private_key.key
testgrinder will configure its web server to use the ssl_cert.crt and ssl_private_key.key files as the source of its SSL certificate and the SSL certificate private key respectively. Make sure that the .env DOMAIN_WEB setting matches the domain for which the certificate is issued.
tg-app servers come with pre-generated ssl_cert.crt and ssl_private_key.key files containing a self-signed certificate. Using this certificate will result in a security warning when accessing testgrinder. Providing your own certificate is strongly recommended.
Providing Configuration Files via User Data on tg-app Launch
Instead of manually providing configuration files, you may provide a specially formatted User Data parameter as part of launching the tg-app AWS EC2 instances. If User Data is provided, tg-app, upon launch, will use it to extract the configuration files from it in the /home/testgrinder/tg-app/config/provision directory.
Generate User Data from Configuration Files
Once you have configuration files in the /home/testgrinder/tg-app/config/provision directory that you are happy with, it is an easy process to package them into User Data format. For that, run the export-user-data script and it will package the configuration files into the User Data format:
The resulting file - my-user-data.yml file - will have all configuration files in the /home/testgrinder/tg-app/config/provision directory packaged in User Data format.
Copy the generated User Data file off the tg-app server and keep it in a secure location. When you launch new tg-app instances you may supply this file as the User Data parameter during AWS EC2 instance launch and tg-app will extract the configuration files from it so you don't have to manually login to the newly launched server to finalize its configuration.
Editing the User Data file
The User Data is in a human readable format that can be edited if you need to adjust some settings or replace the SSL certificate before you launch a new tg-app instance. The User Data is in YAML format where keys are the filenames and values are the file contents:
Important notes:
filenames must be followed by : (colon), then a space, and then | (vertical pipe/bar)
each line of file contents must be preceded by two spaces
For example:
Note: the ellipses (...) above represent lines cut out for brevity. Do not include ... in your User Data.
Last updated