From 66b548f9a1888ef732d50e0f3123f040f23b9302 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 2 Oct 2023 16:53:38 -0400 Subject: [PATCH 01/16] Remove unnecessary gems and update README for getting Hysync to run on Ubuntu 22 (ARM) --- Gemfile | 7 ++++--- Gemfile.lock | 14 ++++---------- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++++--- config/boot.rb | 2 +- 4 files changed, 54 insertions(+), 17 deletions(-) diff --git a/Gemfile b/Gemfile index 2b86002..c26a3b7 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem 'puma', '~> 5.2' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +#gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'mini_racer', platforms: :ruby @@ -32,10 +32,11 @@ gem 'jbuilder', '~> 2.5' # gem 'mini_magick', '~> 4.8' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false +#gem 'bootsnap', '>= 1.1.0', require: false # For z3950 -gem 'zoom', '0.5.0' +#gem 'zoom', '0.5.0' +gem 'alexandria-zoom', '0.6.0' # Using this gem instead of regular 'zoom' because this PR has not been merged: https://github.com/bricestacey/ruby-zoom/pull/4 # For MARC parsing (using fork until PR is merged into main project) gem 'marc', '1.0.4' # gem 'marc', path: '../ruby-marc' diff --git a/Gemfile.lock b/Gemfile.lock index a303a3a..f41d3f6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -70,11 +70,11 @@ GEM tzinfo (~> 2.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) + alexandria-zoom (0.6.0) + pkg-config (~> 1.5.1) ast (2.4.2) bcrypt_pbkdf (1.1.0) bindex (0.8.1) - bootsnap (1.11.1) - msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) capistrano (3.17.0) @@ -109,7 +109,6 @@ GEM unf (>= 0.0.5, < 1.0.0) ed25519 (1.3.0) erubi (1.10.0) - execjs (2.8.1) factory_bot (6.1.0) activesupport (>= 5.0.0) factory_bot_rails (6.1.0) @@ -146,7 +145,6 @@ GEM mini_mime (1.1.2) mini_portile2 (2.4.0) minitest (5.15.0) - msgpack (1.5.1) net-imap (0.2.3) digest net-protocol @@ -171,6 +169,7 @@ GEM parallel (1.22.1) parser (3.1.1.0) ast (~> 2.4.1) + pkg-config (1.5.5) puma (5.6.2) nio4r (~> 2.0) rack (2.2.3) @@ -297,8 +296,6 @@ GEM timeout (0.2.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.8) @@ -314,14 +311,13 @@ GEM whenever (1.0.0) chronic (>= 0.6.3) zeitwerk (2.5.4) - zoom (0.5.0) PLATFORMS ruby DEPENDENCIES activerecord-nulldb-adapter - bootsnap (>= 1.1.0) + alexandria-zoom (= 0.6.0) byebug capistrano (~> 3.17.0) capistrano-cul @@ -349,10 +345,8 @@ DEPENDENCIES sass-rails (~> 5.0) sqlite3 tzinfo-data - uglifier (>= 1.3.0) web-console (>= 3.3.0) whenever - zoom (= 0.5.0) BUNDLED WITH 2.3.9 diff --git a/README.md b/README.md index b9b6f8f..cc5563a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,11 @@ This app depends on oci8; this requires installing the Oracle client libraries a Check out the ruby-oci8 repository for setup instructions: https://github.com/kubo/ruby-oci8 -Or if you want quick macOS setup instructions (which are hopefully still up to date by the time you're reading this, and still support Oracle 12.1) and you use homebrew, just run the following: +### For INTEL-ONLY** macOS + +(Hopefully this is still up to date by the time you're reading this, and still supports Oracle 12.1.) + +Use homebrew, just run the following: ``` brew tap InstantClientTap/instantclient @@ -28,6 +32,38 @@ And then add this environment variable to your bash/zsh profile: export OCI_DIR=$(brew --prefix)/lib ``` +# For ARM-based Macs + +Unfortunately, Oracle doesn't currently offer a release of the above libraries that are compatible with ARM-based Macs. As an alternative, you can run an Ubuntu 22 VM and download the following files: + +https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linux-arm64.zip +https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linux-arm64.zip +https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linux-arm64.zip + +Save them in a new directory at `/opt/oracle/downloads` and then cd to `/opt/oracle` and unzip them: + +``` +cd /opt/oracle +find ./downloads -name '*.zip' -exec unzip {} \; +``` + +Then add this to your .bash_profile: +``` +# For oci8 gem (connecting to Oracle DB) +export OCI_DIR=/opt/oracle/instantclient_19_19 +export NLS_LANG='AMERICAN_AMERICA.US7ASCII' +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient_19_19 +``` + +When you run `bundle install`, you might encounter an issue with OpenSSL on Ubuntu 22. The problem is that Ubuntu 22 comes with OpenSSL 3, but Ruby 3.0 expects OpenSSL 1. You can fix this by uninstalling and reinstalling Ruby 3.0, but specifying OpenSSL 1: + +``` +rvm pkg install openssl # Use RVM to install OpenSSL 1 +rvm install ruby-3.0.3 --with-openssl-dir=$HOME/.rvm/usr # Point to RVM-installed OpenSSL 1 +``` + +### NLS_LANG setup + **Important note:** When connecting to the Voyager OPAC, you must set environment variable `NLS_LANG` to `'AMERICAN_AMERICA.US7ASCII'`. The best way to do this is by adding an export to your `.bashrc`/`.zshrc` file: `export NLS_LANG='AMERICAN_AMERICA.US7ASCII'` To verify that NLS_LANG is set properly and being picked up by the OCI8 gem for all connections, you can run the `hysync:check_oci8_encoding` rake task. If set correctly, you should see the following output: @@ -40,8 +76,14 @@ OCI8 encoding is: # This app also depends on yaz, a Z39.50 client library. You can install it via homebrew by running: ``` - brew install yaz - ``` +brew install yaz +``` + +Or using apt on Ubuntu 22: + +``` +apt install yaz libyazpp-dev +``` ## Deployment instructions The deployment is standard CUL deployment via capistrano. diff --git a/config/boot.rb b/config/boot.rb index 3cda23b..4550416 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. -require "bootsnap/setup" # Speed up boot time by caching expensive operations. +#require "bootsnap/setup" # Speed up boot time by caching expensive operations. From 75df4217043e9da04bdf0c5239e6e9c0c496e361 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 2 Oct 2023 16:55:55 -0400 Subject: [PATCH 02/16] Switch CI to Ubuntu 22 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cabc044..439b0d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: jobs: ci-rails-app: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: ruby-version: ['3.0.3'] @@ -16,12 +16,12 @@ jobs: NLS_LANG: AMERICAN_AMERICA.US7ASCII steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # Caching the solr download makes a huge difference. It can take up to 10 minutes to download. # Note that this action's caches will be evicted if not accessed for more than a week. - name: Cache Oracle Downloads id: cache-oracle-downloads - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: /opt/oracle/downloads key: ${{ runner.os }}-oracle-download From 77c175513a325af437a6c5b89159c118688fbe7b Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 2 Oct 2023 17:10:31 -0400 Subject: [PATCH 03/16] Re-add js-related gems and fix comment formatting --- Gemfile | 8 ++++---- Gemfile.lock | 12 ++++++++++++ config/boot.rb | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index c26a3b7..9701a85 100644 --- a/Gemfile +++ b/Gemfile @@ -14,9 +14,9 @@ gem 'puma', '~> 5.2' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets -#gem 'uglifier', '>= 1.3.0' +gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes -# gem 'mini_racer', platforms: :ruby +gem 'mini_racer', platforms: :ruby # Need to pin nokogiri to 1.10.x for now because we can't build 1.11 on our deploy VMs (because of incompatible GLIBC version) gem 'nokogiri', '~> 1.10.10' @@ -32,10 +32,10 @@ gem 'jbuilder', '~> 2.5' # gem 'mini_magick', '~> 4.8' # Reduces boot times through caching; required in config/boot.rb -#gem 'bootsnap', '>= 1.1.0', require: false +gem 'bootsnap', '>= 1.1.0', require: false # For z3950 -#gem 'zoom', '0.5.0' +# gem 'zoom', '0.5.0' gem 'alexandria-zoom', '0.6.0' # Using this gem instead of regular 'zoom' because this PR has not been merged: https://github.com/bricestacey/ruby-zoom/pull/4 # For MARC parsing (using fork until PR is merged into main project) gem 'marc', '1.0.4' diff --git a/Gemfile.lock b/Gemfile.lock index f41d3f6..66996f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,6 +75,8 @@ GEM ast (2.4.2) bcrypt_pbkdf (1.1.0) bindex (0.8.1) + bootsnap (1.16.0) + msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) capistrano (3.17.0) @@ -109,6 +111,7 @@ GEM unf (>= 0.0.5, < 1.0.0) ed25519 (1.3.0) erubi (1.10.0) + execjs (2.9.1) factory_bot (6.1.0) activesupport (>= 5.0.0) factory_bot_rails (6.1.0) @@ -126,6 +129,7 @@ GEM jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) + libv8-node (18.16.0.0) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -144,7 +148,10 @@ GEM mime-types-data (3.2022.0105) mini_mime (1.1.2) mini_portile2 (2.4.0) + mini_racer (0.8.0) + libv8-node (~> 18.16.0.0) minitest (5.15.0) + msgpack (1.7.2) net-imap (0.2.3) digest net-protocol @@ -296,6 +303,8 @@ GEM timeout (0.2.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.8) @@ -318,6 +327,7 @@ PLATFORMS DEPENDENCIES activerecord-nulldb-adapter alexandria-zoom (= 0.6.0) + bootsnap (>= 1.1.0) byebug capistrano (~> 3.17.0) capistrano-cul @@ -329,6 +339,7 @@ DEPENDENCIES jbuilder (~> 2.5) listen (~> 3.3) marc (= 1.0.4) + mini_racer net-ssh (>= 4.2) nokogiri (~> 1.10.10) puma (~> 5.2) @@ -345,6 +356,7 @@ DEPENDENCIES sass-rails (~> 5.0) sqlite3 tzinfo-data + uglifier (>= 1.3.0) web-console (>= 3.3.0) whenever diff --git a/config/boot.rb b/config/boot.rb index 4550416..3cda23b 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. -#require "bootsnap/setup" # Speed up boot time by caching expensive operations. +require "bootsnap/setup" # Speed up boot time by caching expensive operations. From ac53705efca9441a845e129ca990a2ce7e24e173 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 2 Oct 2023 17:17:33 -0400 Subject: [PATCH 04/16] Remove mini_racer --- Gemfile | 2 +- Gemfile.lock | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 9701a85..42b2a6b 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes -gem 'mini_racer', platforms: :ruby +# gem 'mini_racer', platforms: :ruby # Need to pin nokogiri to 1.10.x for now because we can't build 1.11 on our deploy VMs (because of incompatible GLIBC version) gem 'nokogiri', '~> 1.10.10' diff --git a/Gemfile.lock b/Gemfile.lock index 66996f2..3c7566a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -129,7 +129,6 @@ GEM jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - libv8-node (18.16.0.0) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -148,8 +147,6 @@ GEM mime-types-data (3.2022.0105) mini_mime (1.1.2) mini_portile2 (2.4.0) - mini_racer (0.8.0) - libv8-node (~> 18.16.0.0) minitest (5.15.0) msgpack (1.7.2) net-imap (0.2.3) @@ -339,7 +336,6 @@ DEPENDENCIES jbuilder (~> 2.5) listen (~> 3.3) marc (= 1.0.4) - mini_racer net-ssh (>= 4.2) nokogiri (~> 1.10.10) puma (~> 5.2) From 158296a3f178150b10f3efc6313e0248c6709c8e Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 2 Oct 2023 17:20:04 -0400 Subject: [PATCH 05/16] Update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cc5563a..58bbb47 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,8 @@ rvm pkg install openssl # Use RVM to install OpenSSL 1 rvm install ruby-3.0.3 --with-openssl-dir=$HOME/.rvm/usr # Point to RVM-installed OpenSSL 1 ``` +If you have bundle install issues related to bootsnap, you may need to install a JS runtime. One way to fix this is to install nvm and then install Node 12. + ### NLS_LANG setup **Important note:** When connecting to the Voyager OPAC, you must set environment variable `NLS_LANG` to `'AMERICAN_AMERICA.US7ASCII'`. The best way to do this is by adding an export to your `.bashrc`/`.zshrc` file: `export NLS_LANG='AMERICAN_AMERICA.US7ASCII'` From 6393994567672ebff5dfafc0c15c931a0a883702 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 30 Oct 2023 17:53:48 -0400 Subject: [PATCH 06/16] Deployment config updates --- config/deploy.rb | 13 ++++++------- config/deploy/dev.rb | 2 +- config/deploy/prod.rb | 2 +- config/deploy/test.rb | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 50fba2d..1ce40ac 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,23 +1,22 @@ # config valid for current version and patch releases of Capistrano lock "~> 3.17.0" -set :department, 'ldpd' -set :instance, fetch(:department) +set :remote_user, "renserv" set :application, 'hysync' -set :repo_name, "#{fetch(:department)}-#{fetch(:application)}" +set :repo_name, "ldpd-#{fetch(:application)}" +set :repo_url, "git@github.com:cul/#{fetch(:repo_name)}.git" set :deploy_name, "#{fetch(:application)}_#{fetch(:stage)}" + # used to run rake db:migrate, etc # Default value for :rails_env is fetch(:stage) set :rails_env, fetch(:deploy_name) + # use the rvm wrapper set :rvm_ruby_version, fetch(:deploy_name) -set :repo_url, "git@github.com:cul/#{fetch(:repo_name)}.git" - -set :remote_user, "#{fetch(:instance)}serv" # Default deploy_to directory is /var/www/:application # set :deploy_to, '/var/www/my_app_name' -set :deploy_to, "/opt/passenger/#{fetch(:instance)}/#{fetch(:deploy_name)}" +set :deploy_to, "/opt/passenger/#{fetch(:deploy_name)}" # Default value for :scm is :git # set :scm, :git diff --git a/config/deploy/dev.rb b/config/deploy/dev.rb index b4a2b72..a257b70 100644 --- a/config/deploy/dev.rb +++ b/config/deploy/dev.rb @@ -1,3 +1,3 @@ -server 'all-nginx-dev1.cul.columbia.edu', user: fetch(:remote_user), roles: %w(app db web) +server 'diglib-rails-dev1.cul.columbia.edu', user: fetch(:remote_user), roles: %w(app db web) # Current branch is suggested by default in development ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp diff --git a/config/deploy/prod.rb b/config/deploy/prod.rb index ec7c66c..b7534ad 100644 --- a/config/deploy/prod.rb +++ b/config/deploy/prod.rb @@ -1,3 +1,3 @@ -server "#{fetch(:instance)}-nginx-#{fetch(:stage)}1.cul.columbia.edu", user: fetch(:remote_user), roles: %w(app db web) +server 'diglib-rails-prod1.cul.columbia.edu', user: fetch(:remote_user), roles: %w(app db web) # In test/prod, deploy from release tags; most recent version is default ask :branch, proc { `git tag --sort=version:refname`.split("\n").last } diff --git a/config/deploy/test.rb b/config/deploy/test.rb index ec7c66c..5b5f734 100644 --- a/config/deploy/test.rb +++ b/config/deploy/test.rb @@ -1,3 +1,3 @@ -server "#{fetch(:instance)}-nginx-#{fetch(:stage)}1.cul.columbia.edu", user: fetch(:remote_user), roles: %w(app db web) +server 'diglib-rails-test1.cul.columbia.edu', user: fetch(:remote_user), roles: %w(app db web) # In test/prod, deploy from release tags; most recent version is default ask :branch, proc { `git tag --sort=version:refname`.split("\n").last } From b185ff42946adb4c569b5e0f730baea690fe6139 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 30 Oct 2023 21:47:22 -0400 Subject: [PATCH 07/16] Update ruby version to 3.2.2 --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index c939cb5..9e79f6c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.0.3 \ No newline at end of file +ruby-3.2.2 From 8ac6c444757d3da76378daf785ad983d479ff0a1 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 30 Oct 2023 21:53:27 -0400 Subject: [PATCH 08/16] Update nokogiri --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 2b86002..c6e240c 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'uglifier', '>= 1.3.0' # gem 'mini_racer', platforms: :ruby # Need to pin nokogiri to 1.10.x for now because we can't build 1.11 on our deploy VMs (because of incompatible GLIBC version) -gem 'nokogiri', '~> 1.10.10' +gem 'nokogiri', '~> 1.15.4' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' From 690ee55ffa11496716367e2490492a40064a32d3 Mon Sep 17 00:00:00 2001 From: Eric O Date: Mon, 30 Oct 2023 21:55:22 -0400 Subject: [PATCH 09/16] Temporarily comment out oci8 gem during during deployment testing --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 32f0e5e..e750ffa 100644 --- a/Gemfile +++ b/Gemfile @@ -44,7 +44,7 @@ gem 'rainbow', '~> 3.0' # As of Ruby 3.0, need to explicitly include rexml because it's a bundled gem instead of a default gem gem 'rexml', '~> 3.2', '>= 3.2.4' # For oracle connections -gem 'ruby-oci8', '~> 2.2.7' +#gem 'ruby-oci8', '~> 2.2.7' # For HTTP Requests gem 'rest-client', '~> 2.0' # For cron tasks diff --git a/Gemfile.lock b/Gemfile.lock index 3c7566a..6c23c04 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -146,7 +146,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2022.0105) mini_mime (1.1.2) - mini_portile2 (2.4.0) + mini_portile2 (2.8.5) minitest (5.15.0) msgpack (1.7.2) net-imap (0.2.3) @@ -168,14 +168,16 @@ GEM net-ssh (6.1.0) netrc (0.11.0) nio4r (2.5.8) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + nokogiri (1.15.4) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) parallel (1.22.1) parser (3.1.1.0) ast (~> 2.4.1) pkg-config (1.5.5) puma (5.6.2) nio4r (~> 2.0) + racc (1.7.1) rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) @@ -268,7 +270,6 @@ GEM rubocop-performance rubocop-rails rubocop-rspec - ruby-oci8 (2.2.11) ruby-progressbar (1.11.0) rubyzip (2.3.2) sass (3.7.4) @@ -337,7 +338,7 @@ DEPENDENCIES listen (~> 3.3) marc (= 1.0.4) net-ssh (>= 4.2) - nokogiri (~> 1.10.10) + nokogiri (~> 1.15.4) puma (~> 5.2) rails (~> 7.0.2) rainbow (~> 3.0) @@ -347,7 +348,6 @@ DEPENDENCIES rspec (>= 3.11) rspec-rails (~> 5.1) rubocul (~> 4.0.3) - ruby-oci8 (~> 2.2.7) rubyzip (>= 2.0) sass-rails (~> 5.0) sqlite3 From 7a5d48fab0b3ef6d591335ef24b7ab25bf4414e0 Mon Sep 17 00:00:00 2001 From: Eric O Date: Sun, 5 Nov 2023 11:17:51 -0500 Subject: [PATCH 10/16] Re-add oci8 gem and reference CUL-forked zoom gem --- Gemfile | 6 ++++-- Gemfile.lock | 14 +++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index e750ffa..3659bda 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,9 @@ gem 'bootsnap', '>= 1.1.0', require: false # For z3950 # gem 'zoom', '0.5.0' -gem 'alexandria-zoom', '0.6.0' # Using this gem instead of regular 'zoom' because this PR has not been merged: https://github.com/bricestacey/ruby-zoom/pull/4 +# gem 'alexandria-zoom', '0.6.0' # Using this gem instead of regular 'zoom' because this PR has not been merged: https://github.com/bricestacey/ruby-zoom/pull/4 +gem 'alexandria-zoom', git: 'https://github.com/cul/cul-zoom.git', branch: 'yaz-config-fallback' +# gem 'alexandria-zoom', path: '../cul-zoom' # For MARC parsing (using fork until PR is merged into main project) gem 'marc', '1.0.4' # gem 'marc', path: '../ruby-marc' @@ -44,7 +46,7 @@ gem 'rainbow', '~> 3.0' # As of Ruby 3.0, need to explicitly include rexml because it's a bundled gem instead of a default gem gem 'rexml', '~> 3.2', '>= 3.2.4' # For oracle connections -#gem 'ruby-oci8', '~> 2.2.7' +gem 'ruby-oci8', '~> 2.2.7' # For HTTP Requests gem 'rest-client', '~> 2.0' # For cron tasks diff --git a/Gemfile.lock b/Gemfile.lock index 6c23c04..8303311 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: https://github.com/cul/cul-zoom.git + revision: ef094e238aac2e6f5759240bd78fdf98b2f3f82b + branch: yaz-config-fallback + specs: + alexandria-zoom (0.6.0) + pkg-config (~> 1.5.1) + GEM remote: https://rubygems.org/ specs: @@ -70,8 +78,6 @@ GEM tzinfo (~> 2.0) airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - alexandria-zoom (0.6.0) - pkg-config (~> 1.5.1) ast (2.4.2) bcrypt_pbkdf (1.1.0) bindex (0.8.1) @@ -270,6 +276,7 @@ GEM rubocop-performance rubocop-rails rubocop-rspec + ruby-oci8 (2.2.12) ruby-progressbar (1.11.0) rubyzip (2.3.2) sass (3.7.4) @@ -324,7 +331,7 @@ PLATFORMS DEPENDENCIES activerecord-nulldb-adapter - alexandria-zoom (= 0.6.0) + alexandria-zoom! bootsnap (>= 1.1.0) byebug capistrano (~> 3.17.0) @@ -348,6 +355,7 @@ DEPENDENCIES rspec (>= 3.11) rspec-rails (~> 5.1) rubocul (~> 4.0.3) + ruby-oci8 (~> 2.2.7) rubyzip (>= 2.0) sass-rails (~> 5.0) sqlite3 From 0f350ea2459cb080746041dd3b9d614589fc587a Mon Sep 17 00:00:00 2001 From: Eric O Date: Sun, 5 Nov 2023 21:24:23 -0500 Subject: [PATCH 11/16] Remove capistrano-rvm in favor of simple capistrano/sshkit command map prefixes in deploy.rb; Update to newer version of net-ssh for OpenSSL 3 compatibility (for Ubuntu 22) --- Capfile | 1 - Gemfile | 3 +-- Gemfile.lock | 18 +++++++----------- config/deploy.rb | 6 +++++- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Capfile b/Capfile index 8079e0d..2a5fe4b 100644 --- a/Capfile +++ b/Capfile @@ -10,7 +10,6 @@ install_plugin Capistrano::SCM::Git # additional modules require 'capistrano/rails' -require 'capistrano/rvm' require 'capistrano/passenger' require 'capistrano/cul' require 'whenever/capistrano' diff --git a/Gemfile b/Gemfile index 3659bda..9d035cd 100644 --- a/Gemfile +++ b/Gemfile @@ -74,11 +74,10 @@ group :development do gem 'listen', '~> 3.3' # Capistrano gems for deployment - gem 'capistrano', '~> 3.17.0', require: false + gem 'capistrano', '~> 3.18.0', require: false gem 'capistrano-cul', require: false gem 'capistrano-passenger', '~> 0.1', require: false gem 'capistrano-rails', '~> 1.4', require: false - gem 'capistrano-rvm', '~> 0.1', require: false # Use net-ssh >= 4.2 to prevent warnings with Ruby 2.4 gem 'net-ssh', '>= 4.2' diff --git a/Gemfile.lock b/Gemfile.lock index 8303311..1f2adbe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -76,7 +76,7 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - airbrussh (1.4.0) + airbrussh (1.5.0) sshkit (>= 1.6.1, != 1.7.0) ast (2.4.2) bcrypt_pbkdf (1.1.0) @@ -85,7 +85,7 @@ GEM msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - capistrano (3.17.0) + capistrano (3.18.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -105,9 +105,6 @@ GEM capistrano-rails (1.6.2) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) - capistrano-rvm (0.1.2) - capistrano (~> 3.0) - sshkit (~> 1.2) chronic (0.10.2) concurrent-ruby (1.1.10) crass (1.0.6) @@ -165,13 +162,13 @@ GEM timeout net-protocol (0.1.3) timeout - net-scp (3.0.0) - net-ssh (>= 2.6.5, < 7.0.0) + net-scp (4.0.0) + net-ssh (>= 2.6.5, < 8.0.0) net-smtp (0.3.1) digest net-protocol timeout - net-ssh (6.1.0) + net-ssh (7.2.0) netrc (0.11.0) nio4r (2.5.8) nokogiri (1.15.4) @@ -299,7 +296,7 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) sqlite3 (1.4.2) - sshkit (1.21.2) + sshkit (1.21.5) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) strscan (3.0.1) @@ -334,11 +331,10 @@ DEPENDENCIES alexandria-zoom! bootsnap (>= 1.1.0) byebug - capistrano (~> 3.17.0) + capistrano (~> 3.18.0) capistrano-cul capistrano-passenger (~> 0.1) capistrano-rails (~> 1.4) - capistrano-rvm (~> 0.1) factory_bot_rails (~> 6.1.0) io-wait (= 0.2.0) jbuilder (~> 2.5) diff --git a/config/deploy.rb b/config/deploy.rb index 1ce40ac..2c4667c 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,5 +1,5 @@ # config valid for current version and patch releases of Capistrano -lock "~> 3.17.0" +lock "~> 3.18.0" set :remote_user, "renserv" set :application, 'hysync' @@ -47,6 +47,10 @@ # Whenever gem set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" } +[:rake, :gem, :bundle, :ruby].each do |command_to_prefix_with_rvm| + SSHKit.config.command_map.prefix[command_to_prefix_with_rvm].push("~/.rvm/bin/rvm #{fetch(:deploy_name)} do") +end + namespace :deploy do desc "Report the environment" task :report do From 11ab56a266f42a78ede7abbba71a4b059918ee15 Mon Sep 17 00:00:00 2001 From: Eric O Date: Tue, 14 Nov 2023 20:18:06 -0500 Subject: [PATCH 12/16] deploy.rb refactoring --- config/deploy.rb | 72 ++++++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 2c4667c..9073ef0 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,55 +1,73 @@ # config valid for current version and patch releases of Capistrano lock "~> 3.18.0" -set :remote_user, "renserv" +# Until we retire all old CentOS VMs, we need to set the rvm_custom_path because rvm is installed +# in a non-standard location for our AlmaLinux VMs. This is because our service accounts need to +# maintain two rvm installations for two different Linux OS versions. +set :rvm_custom_path, '~/.rvm-alma8' + +set :remote_user, 'renserv' set :application, 'hysync' set :repo_name, "ldpd-#{fetch(:application)}" set :repo_url, "git@github.com:cul/#{fetch(:repo_name)}.git" set :deploy_name, "#{fetch(:application)}_#{fetch(:stage)}" - # used to run rake db:migrate, etc -# Default value for :rails_env is fetch(:stage) set :rails_env, fetch(:deploy_name) -# use the rvm wrapper -set :rvm_ruby_version, fetch(:deploy_name) - # Default deploy_to directory is /var/www/:application -# set :deploy_to, '/var/www/my_app_name' set :deploy_to, "/opt/passenger/#{fetch(:deploy_name)}" -# Default value for :scm is :git -# set :scm, :git - -# Default value for :format is :pretty -# set :format, :pretty - -# Default value for :log_level is :debug -# set :log_level, :debug -set :log_level, :info +set :linked_files, fetch(:linked_files, []).push( + 'config/master.key', + 'config/database.yml', + 'config/hysync.yml', + 'config/hyacinth.yml', + 'config/voyager.yml' +) # Default value for linked_dirs is [] set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids') +set :passenger_restart_with_touch, true + # Default value for keep_releases is 5 set :keep_releases, 3 -set :passenger_restart_with_touch, true +# Set default log level (which can be overridden by other environments) +set :log_level, :info -set :linked_files, fetch(:linked_files, []).push( - 'config/master.key', - 'config/database.yml', - 'config/hysync.yml', - 'config/hyacinth.yml', - 'config/voyager.yml' -) +# RVM Setup, for selecting the correct ruby version (instead of capistrano-rvm gem) +set :rvm_ruby_version, fetch(:deploy_name) +[:rake, :gem, :bundle, :ruby].each do |command_to_prefix| + SSHKit.config.command_map.prefix[command_to_prefix].push( + "#{fetch(:rvm_custom_path, '~/.rvm')}/bin/rvm #{fetch(:rvm_ruby_version)} do" + ) +end # Whenever gem set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" } -[:rake, :gem, :bundle, :ruby].each do |command_to_prefix_with_rvm| - SSHKit.config.command_map.prefix[command_to_prefix_with_rvm].push("~/.rvm/bin/rvm #{fetch(:deploy_name)} do") -end +# Default branch is :master +# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp + +# Default value for :scm is :git +# set :scm, :git + +# Default value for :format is :airbrussh +# set :format, :airbrussh + +# You can configure the Airbrussh format using :format_options. +# These are the defaults. +# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto + +# Default value for :pty is false +# set :pty, true + +# Default value for local_user is ENV['USER'] +# set :local_user, -> { `git config user.name`.chomp } + +# Uncomment the following to require manually verifying the host key before first deploy. +# set :ssh_options, verify_host_key: :secure namespace :deploy do desc "Report the environment" From d14487ae19df21656ef4adc8bcc4cc9f590a854b Mon Sep 17 00:00:00 2001 From: Eric O Date: Wed, 15 Nov 2023 11:42:49 -0500 Subject: [PATCH 13/16] Rubocop fix --- lib/hysync/marc_synchronizer/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hysync/marc_synchronizer/runner.rb b/lib/hysync/marc_synchronizer/runner.rb index d916d20..5526930 100644 --- a/lib/hysync/marc_synchronizer/runner.rb +++ b/lib/hysync/marc_synchronizer/runner.rb @@ -162,7 +162,7 @@ def create_or_update_hyacinth_record(marc_record, base_digital_object_data, forc Rails.logger.error msg end - return @errors.blank?, @errors + [@errors.blank?, @errors] end # If given hyacinth_record marc_005_last_modified value is equal to given marc_record 005 From e9ae9ca619ae2bc3c0b48215e5b8440afeb9fd72 Mon Sep 17 00:00:00 2001 From: Eric O Date: Wed, 15 Nov 2023 11:43:51 -0500 Subject: [PATCH 14/16] Update rubocop and ci ruby versions to 3.2.2 --- .github/workflows/ci.yml | 2 +- .rubocop.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 439b0d7..103d762 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - ruby-version: ['3.0.3'] + ruby-version: ['3.2.2'] env: RAILS_ENV: test NOKOGIRI_USE_SYSTEM_LIBRARIES: true diff --git a/.rubocop.yml b/.rubocop.yml index af8c095..b447e03 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ inherit_gem: inherit_from: .rubocop_todo.yml AllCops: - TargetRubyVersion: 3.0.3 + TargetRubyVersion: 3.2.2 TargetRailsVersion: 7.0 Exclude: - 'app/javascript/**/*' From 660a445625a43b9f71a8ca3b41acab728949b3ed Mon Sep 17 00:00:00 2001 From: Eric O Date: Wed, 15 Nov 2023 12:02:39 -0500 Subject: [PATCH 15/16] Require 'zoom' in voyager client.rb --- lib/voyager/client.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/voyager/client.rb b/lib/voyager/client.rb index 0b0eca7..d1d30d6 100644 --- a/lib/voyager/client.rb +++ b/lib/voyager/client.rb @@ -1,3 +1,5 @@ +require 'zoom' + module Voyager class Client include Voyager::ClientBehavior::OracleQueryBehavior From c56bb9ec840afa6377554ee20c25490ef9e342d4 Mon Sep 17 00:00:00 2001 From: Eric O Date: Wed, 15 Nov 2023 13:35:52 -0500 Subject: [PATCH 16/16] Version 1.6.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 63ebd3f..dc1e644 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.4 \ No newline at end of file +1.6.0