README.md 5.01 KB
Newer Older
1
2
# FAIDARE: FAIR Data-finder for Agronomic Research
This application provides web services (based on the BrAPI standard) and a web interface with easy to use filters to facilitates the access to plant datasets from a federation of sources.
Raphaël Flores's avatar
Raphaël Flores committed
3

Célia Michotey's avatar
Célia Michotey committed
4
5
[[_TOC_]]

Raphaël Flores's avatar
Raphaël Flores committed
6
7
## How to contribute

8
9
10
11
Look at the [contribution guide](CONTRIBUTING.md).

## Install development environment

12
- Install `node` and `npm`
13

14
Installation via `nvm` is recommended for easier control of installed version:
15
16
17
18
19
20
21
https://github.com/creationix/nvm

```sh
nvm install 10.13.0
nvm use v10.13.0
```

22
- Install Angular CLI
23

24
25
```sh
npm install -g @angular/cli@7.0.6
26
```
27

28
- Install JS dependencies
29

30
31
```sh
cd frontend
32
33
34
npm install
```

35
- Install latest Java JDK8
36

37
38
39
40
41
42
See latest instructions for your operating system.

- (Optional) Install `docker` and `docker-compose`

If you want to run an Elasticsearch and Kibana instance on your machine.
You can use your favorite package manager for that
43
44
45
46


## Run backend development server

47
48
49
50
51
52
53
54
First make sure you have access to an Elasticsearch HTTP API server on `http://127.0.0.1:9200` (either via ssh tunneling or by running a local server).

If you want to run an Elasticsearch server on your development machine you can use the `docker`/`docker-compose` configuration like so:

```sh
docker-compose up
```

55
> This will launch an Elasticsearch server (with port forwarding `9200`) and a Kibana server (with port forwarding `5601`)
56
57
58
59
60

> **Warning**: This repository does not automatically index data into Elasticsearch, you need to prepare your indices beforehand.


If you just need access to API (to run the `ng serve` on top of it), you can run:
61
62
63
64
65

```sh
./gradlew bootRun
```

66
Otherwise, for the complete server (backend APIs + frontend interface), you can run:
67
68

```sh
69
./gradlew assemble && java -jar backend/build/libs/faidare.jar
70
71
```

72
The server should then be accessible at http://localhost:8380/faidare-dev
73

74
75
## Run frontend development server

76
The frontend requests are redirected to the local backend API server (see instructions above to launch) via the
77
Angular proxy.
78
79
80
81
82
83

You can run the development server with the following command:

```sh
cd frontend
ng serve
84
85
```

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
## Harvest

Before all, take care to get data locally before running any indexing script.

### TL;DR

Data indexing to your local Elasticsearch is done using the following command (take care to change the path to local data). Note that your local Elasticsearch instance should be already runing using `docker-compose up`:

```sh
docker run -t --volume /path/to/local/data:/opt/data/ --network=container:elasticsearch-faidare registry.forgemia.inra.fr/urgi-is/docker-rare/faidare-loader:latest -jsonDir /opt/data/ --help
```
Remove the `--help` parameter to run the loading with default params.

### Portability

#### Docker

[TL;DR](#TLDR) section above expects to have an available docker image on the forgemia docker registry. The Gitlab CI rebuil it when needed, but you can update or push such an image using the following commands:

```sh
# build the image
docker build -t registry.forgemia.inra.fr/urgi-is/docker-rare/faidare-loader:latest .

# Login before pushing the image
docker login registry.forgemia.inra.fr/urgi-is/docker-rare -u <your ForgeMIA username>

# push the built image
docker push registry.forgemia.inra.fr/urgi-is/docker-rare/faidare-loader:latest
```

That should ease the indexing of data without having to craft a dedicated environment.

118
119
## GitLab CI

120
121
122
123
124
When creating merge requests on the ForgeMIA GitLab, the GitLab CI will 
automatically run the tests of the project (no need to do anything).

If you want to run the GitLab CI locally, you have to follow this steps:

125
126
1. [Install gitlab-runner](https://docs.gitlab.com/runner/install/)
2. Run the following command (with the correct GnpIS security token):
127

128
129
130
```sh
gitlab-runner exec docker test 
```
131
132
133
134
135
136
137
138
139
140


## Spring Cloud config

On bootstrap, the application will try to connect to a remote Spring Cloud config server
to fetch its configuration.
The details of this remote server are filled in the `bootstrap.yml` file.
By default, it tries to connect to the remote server on http://localhost:8888
but it can of course be changed, or even configured via the `SPRING_CONFIG_URI` environment variable.

141
It will try to fetch the configuration for the application name `faidare`, and the default profile.
142
143
144
145
If such a configuration is not found, it will then fallback to the local `application.yml` properties.
To avoid running the Spring Cloud config server every time when developing the application,
all the properties are still available in `application.yml` even if they are configured on the remote Spring Cloud server as well.

146
The configuration is currently only read on startup,
147
meaning the application has to be rebooted if the configuration is changed on the Spring Cloud server.
148
149
150
151
For a dynamic reload without restarting the application,
see http://cloud.spring.io/spring-cloud-static/Finchley.SR1/single/spring-cloud.html#refresh-scope
to check what has to be changed.

152
153
If you want to use a Spring Cloud configuration server, please refer to
https://spring.io/guides/gs/centralized-configuration/
154