Skip to content
Christina Cortland edited this page Jan 8, 2026 · 8 revisions
  1. UI Development
  2. Yaml Alerts
  3. Debugging
  4. Colorful Log Methods

UI Development

It is possible to run container in development mode which would allow one to make updates to UI elements from IDE of your choice and have it reflected immeditately.
It is recommended to build the image in development mode with -r flag so that the development gems are also installed.
Optionally, -n flag can be used to rebuild the image without using the build cache (--no-cache docker option).

./build.sh -dr RAILS_ENV_FILE
./build.sh -dnr RAILS_ENV_FILE
./run.sh -dr RAILS_ENV_FILE

Above commmand will mount the blacklight-cornell directory to the container and start rails from that instead of the contents from the container.

Managing YAML alerts

The YAML alerts feature works by putting a yaml file in blacklight-cornell directory.
It does not work in containerized environment, however, as we don't allow direct shell access to running containers.
We updated the container to support cronjob to alleviate this.
The image runs a cron script to fetch YAML file from S3 - s3://container-discovery/alerts/alerts_[ENV].yml.
If it finds the file, it will download it to blacklight-cornell/alerts.yml.
If it doesn't find the file and a local alerts.yml file exists, it will delete it The [ENV] matches the value of the RAILS_ENV environment variable.

To manage the yaml file, simply upload or delete the alerts yaml file in the S3 bucket.

aws s3 cp YAML_ALERTS_FILE_TO_DISPLAY s3://container-discovery/alerts/alerts_production.yml
aws s3 rm s3://container-discovery/alerts/alerts_production.yml

Debugging

When debugging the rails application in development, both rails's default debugging options and the byebug gem are available for pausing the running application at configured breakpoints. To connect to a paused application for debugging, you will need to connect to the container with:

docker attach blacklight-cornell-webapp-1

Colorful Log Methods

  • To enable the ConsoleColors module and to use it's methods, set CONSOLE_COLORS_ENABLED=true in dev.env module located at: blacklight-cornell/lib/console_colors.rb
  • ConsoleColors documentation with examples

Methods:

  • #debug
    • Render colorful, easy to read variable data in log.
  • #print_colored_line
    • Prints line separator in log.
  • #print_header
    • Print a main header message.
  • #print_colored_message
    • Print colorful text.
  • #print_colored_announcement
    • Print colorful text with line separators.
  • #print_row
    • Used to print data in a table format.

Clone this wiki locally