Migration from AWS Elastic Beanstalk to AWS Fargate for Amazon ECS is currently in progress. Read Components: Servers, Solr index and Rails database for prod and staging components.


Container

AWS docs about AWS Fargate for Amazon ECS: AWS Fargate for Amazon ECS

Deploy

Integration: https://jenkins.library.cornell.edu/view/Exhibits/job/exhibits-container-int-deploy/

  • "Build with Parameters" to deploy any branch to the integration environment.

Staging: COMING SOON

Production: COMING SOON

aws s3 cp s3://exhibits-container/exhibits-int.env exhibits-int.env

ENV

Env files are stored in the exhibits-container Amazon S3 bucket: exhibits-int.env, exhibits-stg.env, exhibits-prod.env

To update env vars on int, stg, or prod:

  1. Download latest env file from the exhibits-container S3 bucket
  2. Update the downloaded env file locally either via AWS UI or CLI:
    aws s3 cp s3://exhibits-container/exhibits-int.env exhibits-int.env
  3. Upload and replace the updated env file in the exhibits-container S3 bucket
  4. Re-deploy app via Jenkins

Logs

  1. Log in to AWS
  2. Go to Cloudwatch > Log groups (in sidebar)
  3. Choose relevant "Log group" in form ecs/ECS_CLUSTER, e.g. ecs/exhibits-container, TBD, TBD
  4. Choose relevant "Log stream" in form ecs/spotlight/ECS_TASK_ID

Rails console/rake access via ECS Exec

AWS docs: Monitor Amazon ECS containers with ECS Exec

Requirements:

Steps:

  1. Get the ID or ARN for any task running the spotlight container for the relevant ECS cluster. Task IDs are not constant, so you will need to find the current ID to use ECS Exec:
    • Option 1: Grab from ECS console
      • Log in to AWS
      • Go to the ECS console
      • Choose or search for relevant "Cluster", e.g. exhibits-container, TBD, TBD
      • Select the "Tasks" tab
      • Copy the alphanumeric Task id OR use the copy icon at left to copy the full Task ARN for any one of the listed tasks
    • Option 2: Query the AWS CLI:
      aws ecs list-tasks --cluster exhibits-container --service exhibits-container
  2. Run ECS Exec to connect to a running spotlight container:
    aws ecs execute-command --cluster exhibits-container --container spotlight --command "/bin/bash" --interactive --task TASK_ID_OR_ARN


While you can run rails commands via root, it's probably safer to run as the non-privileged user crunner whenever possible: su - crunner

Cron

To review or verify the list of cron jobs on the server:

  1. Follow the steps above in "Rails console/rake access via ECS Exec" to access the running container.
  2. View the cron list for the root user: crontab -l 
  3. View the cron list for the crunner user: crontab -l -u crunner 

To add new cron jobs:

  • If the cron job can be managed by the rails app user crunner: add the new cron job to the rails app via the whenever gem in config/schedule.rb.
  • If the cron job must be managed by root: add the new cron job to the rails app in cron/exhibits_cron.

MySQL

Connecting to RDS

Hostname, user, and password are stored in the corresponding env files in the exhibits-container S3 bucket and in LastPass.

To connect via command line: mysql -h HOSTNAME -u USER -p 

More info in AWS RDS Docs: Connecting to a DB instance running the MySQL database engine

DB Schema

https://github.com/cul-it/exhibits-library-cornell-edu/blob/dev/db/schema.rb

Solr

Solr Schema

You can review the managed-schema and solrconfig in the Solr Admin UI and use these to set up your own local Solr instance. solrconfig.xml, managed-schema

Example Solr Document

These are fields that are stored since they are being returned.  There may be more fields required to populate a document.

{
  "id":"6-129",
  "exhibit_summers-yield_public_bsi":true,
  "full_title_tesim":["The Mapping Mandeville Project"],
  "spotlight_upload_description_tesim":["John Wyatt Greenlee is a PhD candidate in Cornell's Medieval Studies Program and was a Digital Humanities Summer Fellow in 2015. \r\n\r\nGreenlee says the following of his project and experience working in the Summer Fellowship Program:\r\n\r\nFor this project, I have taken sections of text from the 14th century book, John Mandeville's The Travels, and used them to annotate an interactive copy of the 13th century Hereford map.  On their own, the book and the map can be difficult for students to approach.  Students often attempt (and fail) to overlay the world that Mandeville describes onto a GIS-style map.  The text does not describe a geography that accords with modern cartographic principles.  Similarly, mappaemundi like the Hereford map can be intimidating.  Not only is the language and the script difficult, but they are oriented differently than modern maps, and are less interested in accuracy than in issues of history and symbolic scale.  My project proposes that the book and the map are better understood together.  Clicking on icons on the map brings up relevant selections from the text, and so allows viewers to both understand Mandeville's book within its proper framework, and to explore the foreign geographies of the map with a guide.\r\n\r\nThe Summer Digital Humanities Fellowship provided me with the impetus to begin this project, and the tools to complete it.  The program introduced me to a wide range of platforms and approaches for digital scholarship and pedagogy.  The later has been especially useful to me; introducing students to medieval worldviews can be a difficult proposition.  Using projects like this one allows me to engage my students in multiple modes of learning, and to use medieval artifacts to help explain medieval perspectives.\r\n"],
  "spotlight_upload_attribution_tesim":["John Wyatt Greenlee"],
  "spotlight_exhibit_slug_hannah-test_bsi":true,
  "spotlight_exhibit_slugs_ssim":["summers-yield"],
  "spotlight_resource_id_ssim":["gid://exhibits/Spotlight::Resources::Upload/129"],
  "spotlight_resource_type_ssim":["spotlight/resources/uploads"],
  "spotlight_full_image_width_ssm":["1902"],
  "spotlight_full_image_height_ssm":["962"],
  "thumbnail_url_ssm":["/images/134/full/!400,400/0/default.jpg"],
  "iiif_manifest_url_ssi":"/summers-yield/catalog/6-129/manifest",
  "_version_":1700401701753716736,
  "timestamp":"2021-05-21T20:37:10.535Z",
  "score":1.0
}
  • No labels