Skip to content

mbta/screen_checker

Repository files navigation

ScreenChecker

Small application that regularly checks screen statuses and logs them to Splunk.

Currently it logs, once per minute, the statuses of all:

The list of Solari screen IPs is provided by an environment variable. We fetch the list of active GDS and Mercury screens from an API endpoint.

Bootstrap with

asdf install
mix deps.get

Run locally with

# To skip logging Solari screen statuses, set `SOLARI_SCREEN_LIST='[]'`
# To skip logging GDS screen statuses, don't set `GDS_DMS_PASSWORD`
# To skip logging Mercury v1 screen statuses, don't set `MERCURY_API_KEY`
# To skip logging Mercury v2 screen statuses, don't set `MERCURY_V2_API_KEY`
SOLARI_SCREEN_LIST='[solari_screen_spec, ...]' GDS_DMS_PASSWORD='...' MERCURY_API_KEY='...' MERCURY_V2_API_KEY='...' mix run --no-halt

where solari_screen_spec is a JSON object of the form

{
  "ip": "<IP address>",
  "name": "<screen name for logging>",
  "protocol": "<one of 'http' | 'https' | 'https_insecure'>"
}

Test with

MIX_ENV=test mix coveralls.json

Deploying

Screen checker runs on one of our on-prem Windows servers.

To deploy new code, simply use the "Deploy to Prod (on-prem)" GitHub Action.

Its supporting infrastructure is managed in Terraform. Check with the devops team if you need to make changes. (Secrets are probably the only thing you'd need to change)