Skip to content

Commit

Permalink
Merge pull request #391 from PEM-Humboldt/hotfix/2.8.7
Browse files Browse the repository at this point in the history
Hotfix/2.8.7
  • Loading branch information
cazapatamar authored Apr 17, 2023
2 parents 22a07ee + edd45c0 commit 1216a36
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
38 changes: 23 additions & 15 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
# BioModelos v2.8.6
# BioModelos v2.8.7

[BioModelos](http://biomodelos.humboldt.org.co) is a web app that facilitates the generation, validation and consultation of hypothesis of species distribution for the continental biodiversity of Colombia. As such, it provides tools to (1) improve existing species distribution models (SDMs) by integrating expert's opinion, (2) generate expert maps and (3) publish SDMs. Our objective is to provide freely and openly access to the most up to date information on species distributions, validated by a large network of researchers, to support national environmental decision making processes and research.


# Requirements


## Services

Deploy these services before setting up the app:

- MongoDB Database Service
- BioModelos API Service [GitHub Repo](https://github.com/LBAB-Humboldt/biomodelos_db_api)
- SQL Database Service


## Software

- Ruby version 2.5. It is advisable to use [rbenv](https://github.com/rbenv/rbenv#installation) to install and manage ruby local version.
- [Docker](https://www.docker.com) version 17.05 or up.
- [Git](https://git-scm.com/)
- [Bower](https://bower.io/)



# Setup

## Download the source code
Expand All @@ -37,27 +33,31 @@ $ git clone git://github.com/LBAB-Humboldt/BioModelos.v2.git

To build the database according to the schema file using the SQL Service, you should follow the next steps:

1. Create a [database.yml](https://edgeguides.rubyonrails.org/configuring.html#configuring-a-database) file with the configuration of your SQL Service and add it to the */config/* path. Use *database_template.yml* as a template which is located at */config/* folder
2. Once you have the Docker container running, you may execute the **migrations** (*/db/migrate/*) following [this guide](https://edgeguides.rubyonrails.org/active_record_migrations.html#running-migrations).
1. Create a [database.yml](https://edgeguides.rubyonrails.org/configuring.html#configuring-a-database) file with the configuration of your SQL Service and add it to the _/config/_ path. Use _database_template.yml_ as a template which is located at _/config/_ folder
2. Once you have the Docker container running, you may execute the **migrations** (_/db/migrate/_) following [this guide](https://edgeguides.rubyonrails.org/active_record_migrations.html#running-migrations).

## Configuration

Some files and paths in BioModelos need to be configured in order for the app to work as intended.

### Files

- Models folder with raster files.
- Thumbnails folder with thumbnails image files.
- Zip folder with zip files of the models.

### Connection to other BioModelos services
You need to setup a path to the BioModelos API service URL and geoserver URL. Create a new file *url.rb* under the */config/initializers/* folder and setup the next env vars:

You need to setup a path to the BioModelos API service URL and geoserver URL. Create a new file _url.rb_ under the _/config/initializers/_ folder and setup the next env vars:

```sh
BASE_URI = "http://localhost:3000/v2";
GEOSERVER_URI = "http://localhost:8080/geoserver";
```

### Keys and credentials
The app needs the following keys which you can set up in a *local_env.yml* file under the *config* folder like this:

The app needs the following keys which you can set up in a _local_env.yml_ file under the _config_ folder like this:

```sh
SECRET_KEY_BASE: [secret key base]
Expand All @@ -73,14 +73,18 @@ RECAPTCHA_SECRET_KEY: [secret key]
GMAIL_USERNAME: [username]
GMAIL_PASSWORD: [password]
```

There, you should put information about:

- Rails Application key.
- Google maps key.
- Recaptcha key.
- SMTP credentials.

## Run

Install dependencies

```sh
gem install bundler

Expand All @@ -96,10 +100,13 @@ bundle exec rails s -b 0.0.0.0
```

### Dev env with docker

You can create a docker container for development purposes, just build the image with the dev file:

```sh
$ docker build -f Dockerfile.dev -t <image name> .
```

And remember to mount the volumes (or link them) in your source code path

## Deploy
Expand All @@ -109,6 +116,7 @@ And remember to mount the volumes (or link them) in your source code path
First, there are some static .PDF, .PNG and .ZIP files you need to copy to the /public/ folder. Those files are part of the guides and graphic pieces to advertise BioModelos and are not part of our repo.

### Building the image

On the root path of the rails app you enter this command to build the image:

```sh
Expand All @@ -117,7 +125,7 @@ $ docker build -t <image name>:<tag> .

### Starting the container

Once you have the image, it's recommended to use [docker-compose](https://docs.docker.com/compose/) to run the container.
Once you have the image, it's recommended to use [docker-compose](https://docs.docker.com/compose/) to run the container.

You need to create a docker-compose.yml file and set the volumes according to the models, thumbnails, zip and uploads folders like this:

Expand All @@ -136,12 +144,12 @@ services:
- /path/to/host/uploads:/var/www/BioModelos/public/uploads
```
Finally, you run the container with the next command:
```sh
$ docker-compose -d up
```
Finally, you run the container with the next command:
```sh
$ docker-compose -d up
```
## LICENSE
Expand Down
6 changes: 3 additions & 3 deletions app/views/species/_species_models.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% if @models && !@models.blank? %>
<p><%= t('biomodelos.visor.hypotheses.text_1') %></p>
<div class="button-group filter-button-group">
<button class="filterbtn is-checked" data-filter=".validados"><%= t('biomodelos.visor.hypotheses.validated') %></button>
<button class="filterbtn <%= !@valid_models.empty? ? 'is-checked' : '' %>" data-filter=".validados"><%= t('biomodelos.visor.hypotheses.validated') %></button>
<button class="filterbtn" data-filter=".publicados"><%= t('biomodelos.visor.hypotheses.published') %></button>
<button class="filterbtn" data-filter=".estadisticos"><%= t('biomodelos.visor.hypotheses.statistical') %></button>
<button class="filterbtn" data-filter=".para-calificar"><%= t('biomodelos.visor.hypotheses.to_rate') %></button>
<button class="filterbtn" data-filter="*"><%= t('biomodelos.visor.hypotheses.all') %></button>
<button class="filterbtn <%= @valid_models.empty? ? 'is-checked' : '' %>" data-filter="*"><%= t('biomodelos.visor.hypotheses.all') %></button>
</div>

<div class="grid">
Expand Down Expand Up @@ -172,7 +172,7 @@ $('.user_star').raty({

// init Isotope
var $grid = $('.grid').isotope({
filter: ".validados"
filter: $('.button-group .is-checked').attr('data-filter')
});

$('.filter-button-group').on( 'click', 'button', function() {
Expand Down

0 comments on commit 1216a36

Please sign in to comment.