From e5ce634567404b3f33a99ad003b3c31bb4c63775 Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 10:47:09 +0000 Subject: [PATCH 1/7] volume for tmp/uploads --- ops/production-deploy.tmpl.yaml | 3 +++ ops/staging-deploy.tmpl.yaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ops/production-deploy.tmpl.yaml b/ops/production-deploy.tmpl.yaml index 73e212b9..3cedc972 100644 --- a/ops/production-deploy.tmpl.yaml +++ b/ops/production-deploy.tmpl.yaml @@ -43,6 +43,9 @@ extraVolumeMounts: &volMounts - name: uploads mountPath: /app/samvera/hyrax-webapp/public/branding subPath: public-branding + - name: uploads + mountPath: /app/samvera/hyrax-webapp/tmp/uploads + subPath: uploads ingress: enabled: true diff --git a/ops/staging-deploy.tmpl.yaml b/ops/staging-deploy.tmpl.yaml index 5f57bcf7..0037dba7 100644 --- a/ops/staging-deploy.tmpl.yaml +++ b/ops/staging-deploy.tmpl.yaml @@ -43,6 +43,9 @@ extraVolumeMounts: &volMounts - name: uploads mountPath: /app/samvera/hyrax-webapp/public/branding subPath: public-branding + - name: uploads + mountPath: /app/samvera/hyrax-webapp/tmp/uploads + subPath: uploads ingress: From dec700636c7fd83f1a66fdaf0c2117e007244cef Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 10:47:46 +0000 Subject: [PATCH 2/7] override im_identify and use -ping option --- app/iiif_print/image_tool_decorator.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/iiif_print/image_tool_decorator.rb diff --git a/app/iiif_print/image_tool_decorator.rb b/app/iiif_print/image_tool_decorator.rb new file mode 100644 index 00000000..d0f0ff80 --- /dev/null +++ b/app/iiif_print/image_tool_decorator.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# OVERRIDE IIIF Print v1.0.0 + +module IiifPrint + module ImageToolDecorator + # Add -ping option for efficiency + def im_identify + STDERR.puts "######################################################################" + STDERR.puts "#################### IN OVERRID IM_IDENTIFY ##########################" + STDERR.puts "######################################################################" + cmd = "identify -ping -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}" + `#{cmd}`.lines + end + end +end + +IiifPrint::ImageTool.prepend(IiifPrint::ImageToolDecorator) From 72ffdac96662d96d828eead98d2e6a47de24161a Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 10:56:10 +0000 Subject: [PATCH 3/7] take the debug out :/ --- app/iiif_print/image_tool_decorator.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/iiif_print/image_tool_decorator.rb b/app/iiif_print/image_tool_decorator.rb index d0f0ff80..9d871b43 100644 --- a/app/iiif_print/image_tool_decorator.rb +++ b/app/iiif_print/image_tool_decorator.rb @@ -6,9 +6,6 @@ module IiifPrint module ImageToolDecorator # Add -ping option for efficiency def im_identify - STDERR.puts "######################################################################" - STDERR.puts "#################### IN OVERRID IM_IDENTIFY ##########################" - STDERR.puts "######################################################################" cmd = "identify -ping -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}" `#{cmd}`.lines end From b09a63e7702d76a4edab3d49647db5fa588caa07 Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 12:39:32 +0000 Subject: [PATCH 4/7] add a whitespace for rubocop --- app/iiif_print/image_tool_decorator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/iiif_print/image_tool_decorator.rb b/app/iiif_print/image_tool_decorator.rb index 9d871b43..5fa311ed 100644 --- a/app/iiif_print/image_tool_decorator.rb +++ b/app/iiif_print/image_tool_decorator.rb @@ -9,7 +9,7 @@ def im_identify cmd = "identify -ping -format 'Geometry: %G\nDepth: %[bit-depth]\nColorspace: %[colorspace]\nAlpha: %A\nMIME type: %m\n' #{path}" `#{cmd}`.lines end - end + end end IiifPrint::ImageTool.prepend(IiifPrint::ImageToolDecorator) From 746a9bec9444b0d8c156e7e0abf3cd17293a0532 Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 18:33:50 +0000 Subject: [PATCH 5/7] keep volume for uploads off production (limits to one worker pod) --- ops/production-deploy.tmpl.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ops/production-deploy.tmpl.yaml b/ops/production-deploy.tmpl.yaml index 3cedc972..2a192c78 100644 --- a/ops/production-deploy.tmpl.yaml +++ b/ops/production-deploy.tmpl.yaml @@ -43,9 +43,9 @@ extraVolumeMounts: &volMounts - name: uploads mountPath: /app/samvera/hyrax-webapp/public/branding subPath: public-branding - - name: uploads - mountPath: /app/samvera/hyrax-webapp/tmp/uploads - subPath: uploads + # - name: uploads + #mountPath: /app/samvera/hyrax-webapp/tmp/uploads + #subPath: uploads ingress: enabled: true From 9b46b0d7df2ccb75f21bdbce96a87b66b11a158c Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 23:18:49 +0000 Subject: [PATCH 6/7] decorate mini_magick with a ping too --- app/mini_magick/image/info_decorator.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/mini_magick/image/info_decorator.rb diff --git a/app/mini_magick/image/info_decorator.rb b/app/mini_magick/image/info_decorator.rb new file mode 100644 index 00000000..9b5181b5 --- /dev/null +++ b/app/mini_magick/image/info_decorator.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# OVERRIDE MiniMagick v4.11.0 + +module MiniMagick + class Image + module InfoDecorator + + def identify + MiniMagick::Tool::Identify.new do |builder| + yield builder if block_given? + builder << '-ping' + builder << path + end + end + end + end +end + +MiniMagick::Image::Info.prepend(MiniMagick::Image::InfoDecorator) From 941fe8cd72386a871b6e8b7b3bf72f156c65022f Mon Sep 17 00:00:00 2001 From: Rory McNicholl Date: Tue, 27 Feb 2024 23:20:10 +0000 Subject: [PATCH 7/7] and rubocop --- app/mini_magick/image/info_decorator.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/mini_magick/image/info_decorator.rb b/app/mini_magick/image/info_decorator.rb index 9b5181b5..f58d828c 100644 --- a/app/mini_magick/image/info_decorator.rb +++ b/app/mini_magick/image/info_decorator.rb @@ -5,7 +5,6 @@ module MiniMagick class Image module InfoDecorator - def identify MiniMagick::Tool::Identify.new do |builder| yield builder if block_given?