Skip to content

Commit

Permalink
Merge to master - Release 2.3.6 - add Docker image (#35)
Browse files Browse the repository at this point in the history
* add request_lang middleware

* pin redis gem version to 4.8.1

* update Gemfile.lock

* [ontoportal-bot] Gemfile.lock update

* [ontoportal-bot] Gemfile.lock update

* [ontoportal-bot] Gemfile.lock update

* update Gemfile to use ontologies_linked_data new metadata branch

* update TestOntologySubmissionsController to be adapted to the new model

* [ontoportal-bot] Gemfile.lock update

* [ontoportal-bot] Gemfile.lock update

* [ontoportal-bot] Gemfile.lock update

* in submission_metadata rename display with category

* add to submission_metadata description and example fields

* add the option to do pagination for the submission endpoint

* extract retrieve_latest_submissions method to submission helper

* implement apply_filters to submissions endpoint using SPARQL FILTERs

* add test for submissions endpoint pagination

* [ontoportal-bot] Gemfile.lock update

* fix private only submission filter

* add hasFormalityLevel filter for submissions endpoint

* add  for ontology: reviews, notes, projects on the submissions endpoints

* bring submission metrics for submissions  endpoints

* bring all contact attributes if asked in the submissions endpoints

* refactor submissions endpoint filters by extracting some methods

* add ontology acronym or name filters for submissions endpoints

* add submissions endpoint order_by option

* [ontoportal-bot] Gemfile.lock update

* fix including ontology and contacts in the submissions endpoints

* fix list admin filter_access control (e.g for submissions  endpoints)

* [ontoportal-bot] Gemfile.lock update

* check access of ontologies in /ontologies/:acronym/submissions endpoint

* include ontology viewOf attribute in the submission endpoints

* make apply_filters helper generic for any of model attributes

* add Agents controller

* add pagination to agents index endpoint if asked

* make agents routes work for /Agent and /agent

* handle agent indentifiers and affiliations attributes  save and update

* make agent controller work for affiliations attribute

* add agent controller tests

* don't update affiliations if only 'id' sent in params

* bring identifier attributes when we update an agent

* update agent test to work with the new Agent validators

* bring the agent attributes on display all of the submissions endpoints

* handle exception for  class attribute but aren't in populate_from_params

* update Gemfile to use development branch of OLD

* refactor user controller to extract reset password helpers

* remove the send notification on user creation, now handled by user.save

* add access token authentication

* fix test after enforcing the uniqueness of user emails

* fix search test

* add oauth_authentication test

* bring the correct attributes when the oauth_authenticate is used

* Feature: Add support of multilingual search (#40)

* update get_term_search_query to support multilanguages search

* rename var

* fix search lang suffix to use underscore not @

* add multilangual search test

---------

Co-authored-by: Syphax Bouazzouni <[email protected]>

* add get submission all including all properties test

* extract and use submission_include_params where we use submission.bring

* use retrieve_submissions helper in the :acronym/submissions endpoint

* update Goo version and add submissions filters test

* Fix: display contact for get submissions  (#45)

* add get submission all including all properties test

* extract and use submission_include_params where we use submission.bring

* use retrieve_submissions helper in the :acronym/submissions endpoint

* Fix: Submissions filters with order_by  for the same attribute  (#46)

* add get submission all including all properties test

* extract and use submission_include_params where we use submission.bring

* use retrieve_submissions helper in the :acronym/submissions endpoint

* update Goo version and add submissions filters test

* make the ontology submissions endpoint include views

* include all metrics attribues in the submissions endpoints (#53)

* add ontology submissions filter by status (#56)

* add agent usage attribute tests (#55)

* Fix: optimize fetching all agents usages query by batch loading them (#57)

* add agent usage attribute tests

* optimize fetching all agents usages query by batch loading them

* Feature: Add ontologies_api docker image build CI  (#58)

* add docker build CI

* Feature: add ontoportal bash script (#59)

* add ontoportal bash script to run test and development servers

* update README.md

* update docker CI to work in production releases

* Feature: add ontoportal bash script (#59)

* add ontoportal bash script to run test and development servers

* update README.md

* update docker CI to work in production releases

* fix date list properties population helper

* Feature: update ontoportal bash script to handle local gems binding   (#61)

* add ontoportal bash script to run test and development servers

* update README.md

* update docker CI to work in production releases

* update ontoportal script to handle local gems bindq

* update ontoportal script to handle binding to local gem for development

* fixing the test runner after the new changes in the ontoportal script

* add description filter to the submissions endpoint (#62)

---------

Co-authored-by: OntoPortal Bot <[email protected]>
Co-authored-by: HADDAD Zineddine <[email protected]>
  • Loading branch information
3 people authored Dec 5, 2023
1 parent e04096a commit 8f485b2
Show file tree
Hide file tree
Showing 17 changed files with 656 additions and 151 deletions.
4 changes: 4 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
API_URL=http://localhost:9393
ONTOLOGIES_LINKED_DATA_PATH=
GOO_PATH=
SPARQL_CLIENT_PATH=
55 changes: 55 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker branch Images build

on:
push:
branches:
- development
- stage
- test
release:
types: [ published ]
jobs:
push_to_registry:
name: Push Docker branch image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
agroportal/ontologies_api
ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
build-args: |
RUBY_VERSION=2.7.8
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 3 additions & 0 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: copy-env-config
run: cp .env.sample .env
- name: Build docker-compose
run: docker-compose --profile 4store build #profile flag is set in order to build all containers in this step
- name: Run unit tests
# unit tests are run inside a container
# http://docs.codecov.io/docs/testing-with-docker
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
docker-compose run $ci_env -e CI --rm ${{ matrix.backend }} wait-for-it solr-ut:8983 -- bundle install
docker-compose run $ci_env -e CI --rm ${{ matrix.backend }} wait-for-it solr-ut:8983 -- bundle exec rake test TESTOPTS='-v'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ test/data/ontology_files/catalog-v001.xml
create_permissions.log

ontologies_api.iml

.env
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ENV BUNDLE_PATH=/srv/ontoportal/bundle
RUN bundle install

COPY . /srv/ontoportal/ontologies_api
RUN cp /srv/ontoportal/ontologies_api/config/environments/config.rb.sample /srv/ontoportal/ontologies_api/config/environments/development.rb

EXPOSE 9393
CMD ["bundle", "exec", "rackup", "-p", "9393", "--host", "0.0.0.0"]
CMD ["bundle", "exec", "rackup", "-p", "9393", "--host", "0.0.0.0"]
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'activesupport', '~> 3.1'
gem 'activesupport', '~> 3.2'
# see https://github.com/ncbo/ontologies_api/issues/69
gem 'bigdecimal', '1.4.2'
gem 'faraday', '~> 1.9'
Expand Down Expand Up @@ -44,12 +44,12 @@ gem 'haml', '~> 5.2.2' # pin see https://github.com/ncbo/ontologies_api/pull/107
gem 'redcarpet'

# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'goo', git: 'https://github.com/ontoportal-lirmm/goo.git', branch: 'master'
gem 'goo', git: 'https://github.com/ontoportal-lirmm/goo.git', branch: 'development'
gem 'ncbo_annotator', git: 'https://github.com/ontoportal-lirmm/ncbo_annotator.git', branch: 'master'
gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branch: 'master'
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'master'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'master'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand All @@ -63,6 +63,7 @@ group :development do
gem 'shotgun', github: 'palexander/shotgun', branch: 'ncbo'
end


group :profiling do
gem 'rack-mini-profiler'
end
Expand Down
19 changes: 9 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/goo.git
revision: 74ea47defc7f6260b045a6c6997bbe6a59c7bf62
branch: master
revision: 5979402d5138850fb9bdb34edfa350e9af1b5d22
branch: development
specs:
goo (0.0.2)
addressable (~> 2.8)
Expand Down Expand Up @@ -53,8 +53,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 80a331d053ea04397a903452288c2186822c340c
branch: master
revision: a199eff007f5d7f18205d61194f3823445aa6460
branch: development
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand Down Expand Up @@ -216,7 +216,7 @@ GEM
multi_json (1.15.0)
multipart-post (2.3.0)
net-http-persistent (2.9.4)
net-imap (0.4.7)
net-imap (0.4.6)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -247,7 +247,7 @@ GEM
rack (>= 0.4)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
rack-cache (1.14.0)
rack-cache (1.13.0)
rack (>= 0.4)
rack-cors (1.0.6)
rack (>= 1.6.0)
Expand All @@ -270,8 +270,8 @@ GEM
redis-rack-cache (2.2.1)
rack-cache (>= 1.10, < 2)
redis-store (>= 1.6, < 2)
redis-store (1.9.2)
redis (>= 4, < 6)
redis-store (1.9.1)
redis (>= 4, < 5)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
Expand Down Expand Up @@ -346,12 +346,11 @@ GEM
webrick (1.8.1)

PLATFORMS
x86_64-darwin-21
x86_64-darwin-23
x86_64-linux

DEPENDENCIES
activesupport (~> 3.1)
activesupport (~> 3.2)
bcrypt_pbkdf (>= 1.0, < 2.0)
bigdecimal (= 1.4.2)
capistrano (~> 3)
Expand Down
59 changes: 51 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,50 @@

ontologies_api provides a RESTful interface for accessing [BioPortal](https://bioportal.bioontology.org/) (an open repository of biomedical ontologies). Supported services include downloads, search, access to terms and concepts, text annotation, and much more.

## Prerequisites
# Run ontologies_api

## Using OntoPortal api utilities script
### See help

```bash
bin/ontoportal help
```

```
Usage: bin/ontoportal {dev|test|run|help} [--reset-cache] [--api-url API_URL] [--api-key API_KEY]
dev : Start the Ontoportal API development server.
Example: bin/ontoportal dev --api-url http://localhost:9393
Use --reset-cache to remove volumes: bin/ontoportal dev --reset-cache
test : Run tests.
run : Run a command in the Ontoportal API Docker container.
help : Show this help message.
Description:
This script provides convenient commands for managing an Ontoportal API
application using Docker Compose. It includes options for starting the development server,
running tests, and executing commands within the Ontoportal API Docker container.
Goals:
- Simplify common tasks related to Ontoportal API development using Docker.
- Provide a consistent and easy-to-use interface for common actions.
```


### Run dev
```bash
bin/ontoportal dev
```

### Run test with a local OntoPortal API
```bash
bin/ontoportal test
```


## Manually
### Prerequisites

- [Ruby 2.x](http://www.ruby-lang.org/en/downloads/) (most recent patch level)
- [rbenv](https://github.com/sstephenson/rbenv) and [ruby-build](https://github.com/sstephenson/ruby-build) (optional)
Expand All @@ -19,7 +62,7 @@ ontologies_api provides a RESTful interface for accessing [BioPortal](https://bi
- [Solr](http://lucene.apache.org/solr/)
- BioPortal indexes ontology class and property content using Solr (a Lucene-based server)

## Configuring Solr
### Configuring Solr

To configure Solr for ontologies_api usage, modify the example project included with Solr by doing the following:

Expand All @@ -46,22 +89,22 @@ To configure Solr for ontologies_api usage, modify the example project included
# Edit the ontologieS_api/config/environments/{env}.rb file to point to your running instance:
# http://localhost:8983/solr/NCBO1

## Installing
### Installing

### Clone the repository
#### Clone the repository

```
$ git clone [email protected]:ncbo/ontologies_api.git
$ cd ontologies_api
```

### Install the dependencies
#### Install the dependencies

```
$ bundle install
```

### Create an environment configuration file
#### Create an environment configuration file

```
$ cp config/environments/config.rb.sample config/environments/development.rb
Expand All @@ -73,7 +116,7 @@ production.rb<br />
development.rb<br />
test.rb

### Run the unit tests (optional)
#### Run the unit tests (optional)

Requires a configuration file for the test environment:

Expand All @@ -87,7 +130,7 @@ Execute the suite of tests from the command line:
$ bundle exec rake test
```

### Run the application
#### Run the application

```
$ bundle exec rackup --port 9393
Expand Down
Loading

0 comments on commit 8f485b2

Please sign in to comment.