Skip to content

Commit

Permalink
Merge pull request #31 from cul/almalinux-deployment
Browse files Browse the repository at this point in the history
Almalinux deployment, plus Ubuntu 22 (ARM) Compatibility
  • Loading branch information
elohanlon authored Nov 15, 2023
2 parents 7da4bd8 + c56bb9e commit 9946075
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 69 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ on:

jobs:
ci-rails-app:
runs-on: ubuntu-20.04
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
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
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**/*'
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.0.3
ruby-3.2.2
1 change: 0 additions & 1 deletion Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -35,7 +35,10 @@ gem 'jbuilder', '~> 2.5'
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
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'
Expand Down Expand Up @@ -71,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'
Expand Down
48 changes: 27 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -68,16 +76,16 @@ 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)
bindex (0.8.1)
bootsnap (1.11.1)
bootsnap (1.16.0)
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)
Expand All @@ -97,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)
Expand All @@ -109,7 +114,7 @@ GEM
unf (>= 0.0.5, < 1.0.0)
ed25519 (1.3.0)
erubi (1.10.0)
execjs (2.8.1)
execjs (2.9.1)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.1.0)
Expand Down Expand Up @@ -144,9 +149,9 @@ 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.5.1)
msgpack (1.7.2)
net-imap (0.2.3)
digest
net-protocol
Expand All @@ -157,22 +162,25 @@ 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.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)
Expand Down Expand Up @@ -265,7 +273,7 @@ GEM
rubocop-performance
rubocop-rails
rubocop-rspec
ruby-oci8 (2.2.11)
ruby-oci8 (2.2.12)
ruby-progressbar (1.11.0)
rubyzip (2.3.2)
sass (3.7.4)
Expand All @@ -288,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)
Expand All @@ -314,27 +322,26 @@ GEM
whenever (1.0.0)
chronic (>= 0.6.3)
zeitwerk (2.5.4)
zoom (0.5.0)

PLATFORMS
ruby

DEPENDENCIES
activerecord-nulldb-adapter
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)
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)
Expand All @@ -352,7 +359,6 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
whenever
zoom (= 0.5.0)

BUNDLED WITH
2.3.9
50 changes: 47 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +32,40 @@ 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
```

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'`

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:
Expand All @@ -40,8 +78,14 @@ OCI8 encoding is: #<Encoding:US-ASCII>
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.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.4
1.6.0
Loading

0 comments on commit 9946075

Please sign in to comment.