Skip to content

Commit

Permalink
update ruby v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Mar 5, 2024
1 parent fe0783c commit 2527ee6
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 65 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
raptor2-utils \
&& rm -rf /var/lib/apt/lists/*

# The Gemfile Caching Trick
RUN mkdir -p /srv/ontoportal/ncbo_annotator
COPY *.gemspec Gemfile* /srv/ontoportal/ncbo_annotator/
RUN mkdir -p /srv/ontoportal/bundle
COPY Gemfile* *.gemspec /srv/ontoportal/ncbo_annotator/

WORKDIR /srv/ontoportal/ncbo_annotator

# set bundler to v2.4.22 which is the last version supported by ruby 2.7
RUN gem install bundler -v 2.4.22
ENV BUNDLE_PATH /bundle
RUN gem update --system
RUN gem install bundler
ENV BUNDLE_PATH=/srv/ontoportal/bundle
RUN bundle install

COPY . /srv/ontoportal/ncbo_annotator
CMD ["/bin/bash"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem 'cube-ruby'
gem 'faraday', '~> 1.9'
gem 'faraday'
gem 'ffi'
gem 'oj', '~> 3.0'
gem 'rake', '~> 10.0'
Expand Down
42 changes: 12 additions & 30 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: 2575a6ecf62f6f1161f103429fc278939630ad87
revision: b78284bac1a2d9c7b04245e55f3708de5dfe591e
branch: develop
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -64,29 +64,10 @@ GEM
date (3.3.4)
docile (1.4.0)
domain_name (0.6.20240107)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
faraday-net_http (3.1.0)
net-http
ffi (1.16.3)
http-accept (1.7.0)
http-cookie (1.0.5)
Expand All @@ -111,9 +92,10 @@ GEM
mini_mime (1.1.5)
minitest (4.7.5)
multi_json (1.15.0)
multipart-post (2.4.0)
net-http (0.4.1)
uri
net-http-persistent (2.9.4)
net-imap (0.3.7)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -141,7 +123,7 @@ GEM
addressable (>= 2.2)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.20.0)
redis-client (0.21.0)
connection_pool
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
Expand All @@ -153,7 +135,6 @@ GEM
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
ruby-xxHash (0.4.0.2)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
simplecov (0.22.0)
docile (~> 1.1)
Expand All @@ -168,6 +149,7 @@ GEM
thread_safe (0.3.6)
timeout (0.4.1)
tzinfo (0.3.62)
uri (0.13.0)
uuid (2.3.9)
macaddr (~> 1.0)

Expand All @@ -177,7 +159,7 @@ PLATFORMS

DEPENDENCIES
cube-ruby
faraday (~> 1.9)
faraday
ffi
goo!
minitest (~> 4.0)
Expand All @@ -192,4 +174,4 @@ DEPENDENCIES
sparql-client!

BUNDLED WITH
2.3.15
2.4.22
56 changes: 56 additions & 0 deletions dip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: '7.1'

# Define default environment variables to pass
# to Docker Compose
#environment:
# RAILS_ENV: development

compose:
files:
- docker-compose.yml
# project_name: ncbo_annotator

interaction:
# This command spins up a ontologies_api container with the required dependencies (solr, 4store, etc),
# and opens a terminal within it.
runner:
description: Open a Bash shell within a ontologies_api container (with dependencies up)
service: ruby
command: /bin/bash

# Run a Rails container without any dependent services (useful for non-Rails scripts)
bash:
description: Run an arbitrary script within a container (or open a shell without deps)
service: ruby
command: /bin/bash
compose_run_options: [ no-deps ]

# A shortcut to run Bundler commands
bundle:
description: Run Bundler commands
service: ruby
command: bundle
compose_run_options: [ no-deps ]

# A shortcut to run unit tests
test:
description: Run minitest unit tests
service: ruby
command: bundle exec rake test

test-ag:
description: Run minitest unit tests
service: ruby-ag
command: bundle exec rake test


'redis-cli':
description: Run Redis console
service: redis-ut
command: redis-cli -h redis-ut

#provision:
#- dip compose down --volumes
#- dip compose up -d solr 4store
#- dip bundle install
#- dip bash -c bin/setup
57 changes: 31 additions & 26 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
version: '3.8'

x-app: &app
build:
context: .
args:
RUBY_VERSION: '2.7'
environment: &env
COVERAGE: 'true' # enable simplecov code coverage
REDIS_HOST: redis-ut
REDIS_PORT: 6379
MGREP_HOST: mgrep-ut
MGREP_PORT: 55556
SOLR_TERM_SEARCH_URL: http://solr-ut:8983/solr/term_search_core1
SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr/prop_search_core1
volumes:
- .:/srv/ontoportal/ncbo_annotator
stdin_open: true
tty: true
command: "bundle exec rake test TESTOPTS='-v'"
depends_on: &depends_on
solr-ut:
condition: service_healthy
redis-ut:
condition: service_healthy
mgrep-ut:
condition: service_healthy
image: ncbo_annotator:0.0.1
build:
context: .
args:
RUBY_VERSION: '3.0'
environment: &env
BUNDLE_PATH: /srv/ontoportal/bundle
# default bundle config resolves to /usr/local/bundle/config inside of the container
# we are setting it to local app directory if we need to use 'bundle config local'
BUNDLE_APP_CONFIG: /srv/ontoportal/ncbo_annotator/.bundle
COVERAGE: 'true' # enable simplecov code coverage
REDIS_HOST: redis-ut
REDIS_PORT: 6379
MGREP_HOST: mgrep-ut
MGREP_PORT: 55556
SOLR_TERM_SEARCH_URL: http://solr-ut:8983/solr/term_search_core1
SOLR_PROP_SEARCH_URL: http://solr-ut:8983/solr/prop_search_core1
volumes:
- .:/srv/ontoportal/ncbo_annotator
stdin_open: true
tty: true
command: "bundle exec rake test TESTOPTS='-v'"
depends_on: &depends_on
solr-ut:
condition: service_healthy
redis-ut:
condition: service_healthy
mgrep-ut:
condition: service_healthy

services:
ruby:
Expand Down Expand Up @@ -59,7 +64,7 @@ services:
- agraph

solr-ut:
image: ontoportal/solr-ut:0.0.2
image: ontoportal/solr-ut:0.1.0
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8983/solr/term_search_core1/admin/ping?wt=json | grep -iq '\"status\":\"OK\"}' || exit 1"]
start_period: 3s
Expand Down Expand Up @@ -96,7 +101,7 @@ services:
- 4store

agraph-ut:
image: franzinc/agraph:v8.0.0
image: franzinc/agraph:v8.1.0
platform: linux/amd64
environment:
- AGRAPH_SUPER_USER=test
Expand Down
6 changes: 3 additions & 3 deletions run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
[ -f config/config.rb ] || cp config/config.test.rb config/config.rb
docker-compose build

docker-compose run --rm ruby bundle exec rake test TESTOPTS='-v'
#docker-compose run --rm ruby-agraph bundle exec rake test TESTOPTS='-v'
docker-compose --profile agraph --profile 4store kill
docker compose run --rm ruby bundle exec rake test TESTOPTS='-v'
#docker compose run --rm ruby-agraph bundle exec rake test TESTOPTS='-v'
docker compose --profile agraph --profile 4store stop

0 comments on commit 2527ee6

Please sign in to comment.