Skip to content

Commit

Permalink
Feature: add ontoportal bash script (#59)
Browse files Browse the repository at this point in the history
* add ontoportal bash script to run test and development servers

* update README.md

* update docker CI to work in production releases
  • Loading branch information
syphax-bouazzouni committed Nov 23, 2023
1 parent 1d13691 commit 0e559c5
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 30 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_URL=http://localhost:9393
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
- development
- stage
- test

release:
types: [ published ]
jobs:
push_to_registry:
name: Push Docker branch image to Docker Hub
Expand All @@ -22,24 +23,33 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
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
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
platforms: linux/amd64, linux/arm64
build-args: |
RUBY_VERSION=2.7
RUBY_VERSION=2.7.8
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ 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
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
16 changes: 6 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 7d16b7b1ecc4da8bfd93db2a106737b06d84d6ff
revision: 4c7dfa80a8bb4a7d8cfb7ad1fc8a1a88e420e59e
branch: development
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -109,7 +109,7 @@ GEM
sshkit (>= 1.6.1, != 1.7.0)
backports (3.24.1)
base64 (0.2.0)
bcrypt (3.1.19)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.0)
bigdecimal (1.4.2)
builder (3.2.4)
Expand All @@ -134,8 +134,7 @@ GEM
date (3.3.4)
declarative (0.0.20)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
domain_name (0.6.20231109)
ed25519 (1.3.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -217,7 +216,7 @@ GEM
multi_json (1.15.0)
multipart-post (2.3.0)
net-http-persistent (2.9.4)
net-imap (0.4.4)
net-imap (0.4.6)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -242,7 +241,7 @@ GEM
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.3)
public_suffix (5.0.4)
rack (1.6.13)
rack-accept (0.4.5)
rack (>= 0.4)
Expand Down Expand Up @@ -321,7 +320,7 @@ GEM
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
sshkit (1.21.5)
sshkit (1.21.6)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
systemu (2.6.5)
Expand All @@ -332,9 +331,6 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
Expand Down
62 changes: 54 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,53 @@

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.
```
### Configuration
```
cp .env.sample .env
```

### 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 +65,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 +92,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 +119,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 +133,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 0e559c5

Please sign in to comment.