README.md 3.6 KB
Newer Older
Raphaël Flores's avatar
Raphaël Flores committed
1
2
# GnpIS Plant Data Search

Raphaël Flores's avatar
Raphaël Flores committed
3
4
5
6
GnpIS Plant Data Search *aka* legacy Unified Interface.

## How to contribute

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

## Install development environment

11
- Install `node` and `npm`
12

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

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

21
- Install Angular CLI
22

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

27
- Install JS dependencies
28

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

34
- Install latest Java JDK8
35

36
37
38
39
40
41
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
42
43
44
45


## Run backend development server

46
47
48
49
50
51
52
53
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
```

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

> **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:
60
61
62
63
64

```sh
./gradlew bootRun
```

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

```sh
./gradlew assemble && java -jar backend/build/libs/gpds.jar
```

71
The server should then be accessible at http://localhost:8380/gpds-dev
72

73
74
## Run frontend development server

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

You can run the development server with the following command:

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

## GitLab CI

87
88
89
90
91
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:

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

95
96
97
```sh
gitlab-runner exec docker test 
```
98
99
100
101
102
103
104
105
106
107


## 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.

108
It will try to fetch the configuration for the application name `gpds`, and the default profile.
109
110
111
112
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.

113
The configuration is currently only read on startup,
114
meaning the application has to be rebooted if the configuration is changed on the Spring Cloud server.
115
116
117
118
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.

119
120
If you want to use a Spring Cloud configuration server, please refer to
https://spring.io/guides/gs/centralized-configuration/
121