From ac03646dabf90a52940b33240c6c40af63bb60a9 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Wed, 28 Jan 2026 15:42:10 -0500 Subject: [PATCH 1/4] using head requests for alma and wowza okcomputer --- config/initializers/okcomputer.rb | 20 ++++++++++++++++++-- spec/request/okcomputer_spec.rb | 4 ++-- spec/spec_helper.rb | 5 +++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index 24be75e..9a5320d 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -26,8 +26,24 @@ def check end end +class HeadCheck < OkComputer::HttpCheck + def perform_request + Timeout.timeout(request_timeout) do + options = { read_timeout: request_timeout } + + if basic_auth_options.any? + options[:http_basic_authentication] = basic_auth_options + end + + RestClient.head(url.to_s, options) + end + rescue => e + raise ConnectionFailed, e + end +end + # Ensure Alma API is working. -OkComputer::Registry.register 'alma-metadata', OkComputer::HttpCheck.new(ALMA_TEST_URL) +OkComputer::Registry.register 'alma-metadata', HeadCheck.new(ALMA_TEST_URL) # Ensure TIND API is working. This cannot use `OkComputer::HttpCheck` # out of the box as we can't yet inject headers into the request without @@ -35,4 +51,4 @@ def check OkComputer::Registry.register 'tind-metadata', TindCheck.new # Ensure Wowza is working -OkComputer::Registry.register 'wowza-streaming', OkComputer::HttpCheck.new(WOWZA_TEST_URL) +OkComputer::Registry.register 'wowza-streaming', HeadCheck.new(WOWZA_TEST_URL) diff --git a/spec/request/okcomputer_spec.rb b/spec/request/okcomputer_spec.rb index 4ed6251..41d6f7e 100644 --- a/spec/request/okcomputer_spec.rb +++ b/spec/request/okcomputer_spec.rb @@ -2,11 +2,11 @@ RSpec.describe 'OKComputer', type: :request do before do - stub_sru_request('b23305522') + stub_sru_head_request('b23305522') hls_manifest = File.read('spec/data/playlist.m3u8') manifest_url = 'https://wowza.lib.berkeley.edu/Pacifica/mp3:PRA_NHPRC1_AZ1084_00_000_00.mp3/playlist.m3u8' - stub_request(:get, manifest_url).to_return(status: 200, body: hls_manifest) + stub_request(:head, manifest_url).to_return(status: 200) record_id = '(pacradio)01469' tind_url = BerkeleyLibrary::AV::Metadata::Source::TIND.marc_uri_for(record_id) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c70536b..61eb825 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -72,6 +72,11 @@ def stub_sru_request(record_id, body: nil) stub_request(:get, sru_url).to_return(status: 200, body: body || File.new(alma_sru_data_path_for(record_id))) end +def stub_sru_head_request(record_id, body: nil) + sru_url = alma_sru_url_for(record_id) + stub_request(:head, sru_url).to_return(status: 200) +end + def alma_marc_record_for(record_id) marc_xml_path = alma_sru_data_path_for(record_id) MARC::XMLReader.new(marc_xml_path).first From 61f42211179f8c22ad4129ec12e32406a44659f1 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Wed, 4 Feb 2026 14:37:40 -0500 Subject: [PATCH 2/4] use berkeley_library-util gem to add head_check for okcomputer --- .gitignore | 1 + Gemfile | 1 + Gemfile.lock | 4 +++- config/initializers/okcomputer.rb | 24 +++++------------------- spec/request/okcomputer_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 6 files changed, 12 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 4da79a0..9a7f9d6 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ /test/tmp/ /test/version_tmp/ /tmp/ +/vendor/ # Used by dotenv library to load environment variables. # .env diff --git a/Gemfile b/Gemfile index 3a86092..9e5659d 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ ruby ruby_version_exact gem 'berkeley_library-av-core', '~> 0.5.0' gem 'berkeley_library-docker', '~> 0.2.0' gem 'berkeley_library-logging', '~> 0.2' +gem 'berkeley_library-util', '~> 0.3' gem 'browser', '~> 4.2' gem 'jbuilder', '~> 2.13' gem 'mutex_m' diff --git a/Gemfile.lock b/Gemfile.lock index 4615fec..aa8cf53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -95,7 +95,7 @@ GEM marc (~> 1.0) parslet (~> 2.0) ruby-marc-spec (~> 0.1) - berkeley_library-util (0.2.0) + berkeley_library-util (0.3.0) berkeley_library-logging (~> 0.3) rest-client (~> 2.1) typesafe_enum (~> 0.3) @@ -421,6 +421,7 @@ PLATFORMS arm64-darwin-21 arm64-darwin-22 arm64-darwin-23 + arm64-darwin-25 x86_64-darwin-19 x86_64-linux @@ -428,6 +429,7 @@ DEPENDENCIES berkeley_library-av-core (~> 0.5.0) berkeley_library-docker (~> 0.2.0) berkeley_library-logging (~> 0.2) + berkeley_library-util (~> 0.3) brakeman browser (~> 4.2) bundle-audit diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index 9a5320d..1e8bf0a 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -1,9 +1,11 @@ # frozen_string_literal: true +require 'berkeley_library/util/uris/head_check' + # Health check configuration OkComputer.logger = Rails.logger -OkComputer.check_in_parallel = true +OkComputer.check_in_parallel = !Rails.env.test? ALMA_TEST_ID = 'b23305522' TIND_TEST_ID = '(pacradio)01469' @@ -26,24 +28,8 @@ def check end end -class HeadCheck < OkComputer::HttpCheck - def perform_request - Timeout.timeout(request_timeout) do - options = { read_timeout: request_timeout } - - if basic_auth_options.any? - options[:http_basic_authentication] = basic_auth_options - end - - RestClient.head(url.to_s, options) - end - rescue => e - raise ConnectionFailed, e - end -end - # Ensure Alma API is working. -OkComputer::Registry.register 'alma-metadata', HeadCheck.new(ALMA_TEST_URL) +OkComputer::Registry.register 'alma-metadata', BerkeleyLibrary::Util::HeadCheck.new(ALMA_TEST_URL) # Ensure TIND API is working. This cannot use `OkComputer::HttpCheck` # out of the box as we can't yet inject headers into the request without @@ -51,4 +37,4 @@ def perform_request OkComputer::Registry.register 'tind-metadata', TindCheck.new # Ensure Wowza is working -OkComputer::Registry.register 'wowza-streaming', HeadCheck.new(WOWZA_TEST_URL) +OkComputer::Registry.register 'wowza-streaming', BerkeleyLibrary::Util::HeadCheck.new(WOWZA_TEST_URL) diff --git a/spec/request/okcomputer_spec.rb b/spec/request/okcomputer_spec.rb index 41d6f7e..d800153 100644 --- a/spec/request/okcomputer_spec.rb +++ b/spec/request/okcomputer_spec.rb @@ -4,7 +4,6 @@ before do stub_sru_head_request('b23305522') - hls_manifest = File.read('spec/data/playlist.m3u8') manifest_url = 'https://wowza.lib.berkeley.edu/Pacifica/mp3:PRA_NHPRC1_AZ1084_00_000_00.mp3/playlist.m3u8' stub_request(:head, manifest_url).to_return(status: 200) @@ -20,6 +19,7 @@ it 'returns all checks to /health' do get '/health' + expect(response).to have_http_status :ok expect(response.parsed_body.keys).to match_array %w[ alma-metadata diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 61eb825..043c4fc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -72,7 +72,7 @@ def stub_sru_request(record_id, body: nil) stub_request(:get, sru_url).to_return(status: 200, body: body || File.new(alma_sru_data_path_for(record_id))) end -def stub_sru_head_request(record_id, body: nil) +def stub_sru_head_request(record_id) sru_url = alma_sru_url_for(record_id) stub_request(:head, sru_url).to_return(status: 200) end From 418a986b8aa279439528b3b04ee9c9b952fe62ee Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Wed, 4 Feb 2026 14:51:08 -0500 Subject: [PATCH 3/4] add changelog note to CHANGES.md --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index adf0fd4..464ddc8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +# Current Changelog moved to GitHub releases page + +* https://github.com/BerkeleyLibrary/avplayer/releases + # 1.1.0 (2025-12-09) * AP-533: pass in image build arguments (#22) From 9e21d001beb3543726d462ed0544c24493482510 Mon Sep 17 00:00:00 2001 From: Jason Raitz Date: Thu, 5 Feb 2026 14:03:00 -0500 Subject: [PATCH 4/4] update changes.md - also reverts the okcomputer initializer to run checks in parallel --- CHANGES.md | 83 +++++++++++++++++++++++++++++-- config/initializers/okcomputer.rb | 2 +- 2 files changed, 81 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 464ddc8..b3ea862 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,83 @@ -# Current Changelog moved to GitHub releases page - -* https://github.com/BerkeleyLibrary/avplayer/releases +# 1.1.5 (2026-02-05) + +* AP-536 Change some OkComputer healthchecks to HEAD requests + Alma and Wowza healthchecks now use HEAD requests, mainly because + we are only concerned with service status for these checks, and + because Alma, specifically, responds much faster for HEAD requests + than for GET requests. +* Adds the Berkeley_Library_Util gem to enable a new, extended version + of OkComputer's HTTPCheck that is called HeadCheck. +* OkComputer uses open-uri under the hood, which does not support HEAD + requests, so we used our own Requester wrapper for RestClient to + extend support. + +# 1.1.4 (2026-01-15) + +* ADA-669 stylesheets: Refactor header imprint styles + Before this change, the containing `a` element was using a `display` + of `contents`, which caused the elements to be inaccessible via the + keyboard. Changing the `a` to be a simple flex item caused various + other layout issues that were corrected: + * `vertical-align` was set to `middle` for both the image and text, + allowing them to look mostly the same as before. + * Added `text-align: center` to ensure the elements are centred on + mobile-sized viewports in column layout mode. + * On mobile, the image remains a `block` element so that it causes a + hard break in the flex grid (otherwise, on larger mobile/tablet + screen sizes, it is undersized and the "Audio/Video" appears next to + the logo element). On desktop, they are no longer required to be + `block` elements. + * Additionally, the fixed width size of the logo is now set as the + `max-width`, and a `width` of `100%` is used. This allows the logo + to shrink on very small viewports, such as an iPhone 11 in 2x zoom + mode. The iPhone 11 @ 2x has an effective viewport of 305px, which + is smaller than the 315px width and caused the logo to be cut off + with the current rules. +* ADA-670 Rework HTML markup for records + * Use `
` for the overall record container; each track remains + its own `
` which makes more semantic sense. + * Use `