| common/filters.py | filter_classification()|select * from web_isis.vw_isis_profiles_with_classification_geo_img_rest where classification ilike %s"|
| common/filters.py | filter_classification()|select * from web_isis.vw_isis_profiles_with_classification_geo_img_rest where classification ilike %s"|
...
@@ -44,40 +47,35 @@ NOTE: Jorge did a bad job on leaving DB password on the repository. Password sho
...
@@ -44,40 +47,35 @@ NOTE: Jorge did a bad job on leaving DB password on the repository. Password sho
**NOTE:** Views need to be refreshed when new data is added to the upstream tables
**NOTE:** Views need to be refreshed when new data is added to the upstream tables
Monolith picture location
### Monolith picture location
-------------------------
Monoliths used by REST are stored on ISRIC data volume, the access to this volume is very restricted and based on IP. Rserver (scomp1457.wurnet.nl), on this server users haas005, turku001 and ruipe001 have a symbolic link to the monoliths.
Monoliths used by REST are stored on ISRIC data volume, the access to this volume is very restricted and based on IP. Rserver (scomp1457.wurnet.nl), on this server users haas005, turku001 and ruipe001 have a symbolic link to the monoliths.
There the monolith pictures can be updated or modified
There the monolith pictures can be updated or modified
Monolith file copy
### Monolith file copy
------------------
On the Rserver is it better to copy the monoliths from workspace scratch into `ISRIC_Monoliths`. On the home folder of user the command would look like:
On the Rserver is it better to copy the monoliths from workspace scratch into `ISRIC_Monoliths`. On the home folder of user the command would look like:
The FB-IT mounts are not reliable, check if "ISRIC_Monolith" is accessible, it not mount it:
The FB-IT mounts are not reliable, check if "ISRIC_Monolith" is accessible, it not mount it:
```
```bash
# mount all volumes from /etc/fstab
# mount all volumes from /etc/fstab
sudo mount -a
sudo mount -a
```
```
In case of batch file permission it is advisable (NOTE: Only sudo can do it):
In case of batch file permission it is advisable (NOTE: Only sudo can do it):
```
```bash
find /mnt/ISRIC_Monoliths -type d -execchmod 777 {}\;#for directories
find /mnt/ISRIC_Monoliths -type d -execchmod 777 {}\;#for directories
find /mnt/ISRIC_Monoliths -type f -execchmod 666 {}\;#for files
find /mnt/ISRIC_Monoliths -type f -execchmod 666 {}\;#for files
```
```
## Monolith image update and implementation
Monolith image update and implementation
----------------------------------------
To update monolith images, it is necessary:
To update monolith images, it is necessary:
...
@@ -89,8 +87,7 @@ It is advisable to use a rsync software when moving files around.
...
@@ -89,8 +87,7 @@ It is advisable to use a rsync software when moving files around.
REST API doesn't make any assumptions on files and will crawl the fold structure for the pictures. It maybe necessary some code changes if there are to many changes.
REST API doesn't make any assumptions on files and will crawl the fold structure for the pictures. It maybe necessary some code changes if there are to many changes.
Local Deployment
## Local Deployment
----------------
This API can be deployed using a docker container. The code resides in the
This API can be deployed using a docker container. The code resides in the
host system, together with the monoliths images to be served. These images
host system, together with the monoliths images to be served. These images
...
@@ -100,38 +97,45 @@ as this file). This code folder is then mapped into the container at startup.
...
@@ -100,38 +97,45 @@ as this file). This code folder is then mapped into the container at startup.
The Dockerfile present in this project sets up the API with Gunicorn and nginx.
The Dockerfile present in this project sets up the API with Gunicorn and nginx.
To build the container image change to the project folder and run:
To build the container image change to the project folder and run:
`docker build -t ldesousa/wsm.rest .`
`docker build -t wsm.rest .`
The resulting image is named `wsm/rest`.
The resulting image is named `ldesousa/wsm.rest`.
To run the image it is necessary to map the right environment variables to connect to the database as well as mount the source code folder and bind port 8000 (where gunicorn listens):
To run the image it is necessary to map the right environment variables to connect to the database as well as mount the source code folder and bind port 80 (where nginx listens):
Your container will now be available on [localhost:8081](http://localhost:8081)
Your container will now be available on [localhost:8000](http://localhost:8000)
OC deployment
=============
OC uses the gitlab webhook to deploy the application on project `isric-files`. Pod application is named `rest-wsm`, and external route is `rest-wsm.isric.org`.
Image build is based on the `python3.6` OC image `openshift/python:3.6` and WSGI system is configure with envs:
## K8s deployment
```
-`ENV` variables are set as k8s secrets on the [ISRIC deployment repository](https://git.wur.nl/isric/ict/k8s-deployments)
APP_MODULE=appWSM:app
```
Envs are stored on configuration file [here](.s2i/environment)
- Application follows the standard k8s deployment.
Pod mounts the `isric-files/monoliths` on `/opt/app-root/src/monoliths (ro)`
- TODO: Write about semanatic tagging
Image processing and metadata
## Image processing and metadata
=============================
Please consult the specific folder **[README](imageProcessing/README.md)**
Please consult the specific folder **[README](imageProcessing/README.md)**