Skip to content
Snippets Groups Projects
Commit f08e5c8a authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Add some diagrams for the services and reorganization the services doc

parent 36367167
No related branches found
No related tags found
2 merge requests!14Doc webapp,!13Doc webapp
Showing
with 51 additions and 90 deletions
docs/assets/changelog-service.png

54.9 KiB

docs/assets/credits-service.png

29.5 KiB

docs/assets/media-library-service.png

14.2 KiB | W: | H:

docs/assets/media-library-service.png

21.9 KiB | W: | H:

docs/assets/media-library-service.png
docs/assets/media-library-service.png
docs/assets/media-library-service.png
docs/assets/media-library-service.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -80,7 +80,7 @@ docker-compose --project-name admin-gui up ...@@ -80,7 +80,7 @@ docker-compose --project-name admin-gui up
## Authentication ## Authentication
It uses the same authentication methods as the portail data web app, so if you have an account you will be able to log in. However only a user belongging to the admin group will be able to create, modify and delete entities. The groups are managed by the api gateway, for more information refer to the [Authentication and Authorization](../../miscellaneous/authentication&authorization.md) section. It uses the same authentication methods as the portail data web app, so if you have an account you will be able to log in. However only a user belonging to the admin group will be able to create, modify and delete entities. The groups are managed by the api gateway, for more information refer to the [Authentication and Authorization](../../miscellaneous/authentication&authorization.md) section.
## TO DEVELOP ## TO DEVELOP
......
...@@ -13,7 +13,6 @@ The service relies on ...@@ -13,7 +13,6 @@ The service relies on
![authentication-service](../../assets/authentication-service.png) ![authentication-service](../../assets/authentication-service.png)
## Endpoints ## Endpoints
This service provides five **endpoints**: This service provides five **endpoints**:
...@@ -22,7 +21,6 @@ This service provides five **endpoints**: ...@@ -22,7 +21,6 @@ This service provides five **endpoints**:
1. an HTTP-only cookie including an **access token**, including in turn a JSON Web Token (JWT), signed by the API Gateway, namely Kong. 1. an HTTP-only cookie including an **access token**, including in turn a JSON Web Token (JWT), signed by the API Gateway, namely Kong.
2. a cookie including an **XSRF token** (generated as a version 4 UUID). 2. a cookie including an **XSRF token** (generated as a version 4 UUID).
Both the access token and the XSRF token are needed to issue authenticated requests. We refer the reader to a [dedicated page](../../miscellaneous/security.md) for further information about security. Both the access token and the XSRF token are needed to issue authenticated requests. We refer the reader to a [dedicated page](../../miscellaneous/security.md) for further information about security.
2. A **logout** endpoint, `/logout`, which signs out the user by deprecating the cookie set by the login endpoint. 2. A **logout** endpoint, `/logout`, which signs out the user by deprecating the cookie set by the login endpoint.
...@@ -35,7 +33,6 @@ This service provides five **endpoints**: ...@@ -35,7 +33,6 @@ This service provides five **endpoints**:
* the [API Gateway](../off-the-shelf-apps/api-gateway.md) must be up; * the [API Gateway](../off-the-shelf-apps/api-gateway.md) must be up;
* the [Legacy AUTH Middleware](../middlewares/legacy-auth.md) must be up. * the [Legacy AUTH Middleware](../middlewares/legacy-auth.md) must be up.
## Implementation ## Implementation
The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning the latter framework and the features it provides. The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning the latter framework and the features it provides.
......
...@@ -33,6 +33,9 @@ This service has no dependency on other components. ...@@ -33,6 +33,9 @@ This service has no dependency on other components.
This service exposes one single endpoint, `/changelog`, supporting all the CRUD methods in a RESTful fashion. An healthcheck endpoint is exposed as well, `/health`, returning a `200` HTTP code when all indicators are healthy, `503` in the opposite case. The service is considered to be healthy if the underlying database is up. This service exposes one single endpoint, `/changelog`, supporting all the CRUD methods in a RESTful fashion. An healthcheck endpoint is exposed as well, `/health`, returning a `200` HTTP code when all indicators are healthy, `503` in the opposite case. The service is considered to be healthy if the underlying database is up.
## Implementation ## Implementation
![changelog-service](../../assets/changelog-service.png)
The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning the latter framework and the features it provides. The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning the latter framework and the features it provides.
[MongoDB](https://www.mongodb.com/) is used for data persistence. Data modeling as well as connections to MongoDB are performed with [Mongoose](https://github.com/Automattic/mongoose). [MongoDB](https://www.mongodb.com/) is used for data persistence. Data modeling as well as connections to MongoDB are performed with [Mongoose](https://github.com/Automattic/mongoose).
...@@ -33,6 +33,8 @@ returning a `200` HTTP code if the API is healthy, `503` otherwise. For the serv ...@@ -33,6 +33,8 @@ returning a `200` HTTP code if the API is healthy, `503` otherwise. For the serv
## Implementation ## Implementation
![credits-service](../../assets/credits-service.png)
The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning NestJS and the features it provides. The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning NestJS and the features it provides.
Data persistence is achieved by using [PostgreSQL](https://www.postgresql.org/) and [TypeORM](https://github.com/typeorm/typeorm). Data persistence is achieved by using [PostgreSQL](https://www.postgresql.org/) and [TypeORM](https://github.com/typeorm/typeorm).
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
This service allow to deliver mails to any email address from the address specified in the configuration. It also provides two particular endpoints, one for the user to give a feedback and another one for general contact purpose. Those endpoints will both send an email to the admin address specified in the configuration. This service allow to deliver mails to any email address from the address specified in the configuration. It also provides two particular endpoints, one for the user to give a feedback and another one for general contact purpose. Those endpoints will both send an email to the admin address specified in the configuration.
## Dependencies ## Dependencies
## Endpoints ## Endpoints
...@@ -15,24 +14,18 @@ This service allow to deliver mails to any email address from the address specif ...@@ -15,24 +14,18 @@ This service allow to deliver mails to any email address from the address specif
`/send` `/send`
`/health` This service will return a `200` http status code when all indicators are healthy. Otherwise it will return a `503` http status code. `/health` This service will return a `200` http status code when all indicators are healthy. Otherwise it will return a `503` http status code.
For this service we declared an health indicator that verify that the connection to the SMTP Server is available. For this service we declared an health indicator that verify that the connection to the SMTP Server is available.
## Implementation ## Implementation
The service is implemented using the [NestJS](https://nestjs.com/) framework. We refer the reader to the [NestJS-based micro-services](../../miscellaneous/nestjs-micro-services.md) page for further details concerning the latter framework and the features it provides.
## How it works
![mail-service](../../assets/mail-service.png) ![mail-service](../../assets/mail-service.png)
The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. The service builds email bodies based on the information it receives and on the provided HTML templates. It then format a JSON with all the properties (to, from, body...) expected by an SMTP server to correctly send an email. <!-- The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. The service builds email bodies based on the information it receives and on the provided HTML templates. It then format a JSON with all the properties (to, from, body...) expected by an SMTP server to correctly send an email.
However the service does not send this JSON directly to the distant SMTP server. Indeed as a connection failure might occure, we chose to persist this object in a RabbitMQ queue. Then a small worker written in Node.js will consume the messages from the queue and send it to the SMTP server if correctly formatted. The messages will be removed (acknoledged) from the queue only if the SMTP received the message.
## API documentation
NestJS provides a [swagger module](https://docs.nestjs.com/recipes/swagger) that can be easily integrated. Using specific annotations alongside your endpoints declaration, this module will automatically generates a swagger documentation, reachable at `/api-doc`. However the service does not send this JSON directly to the distant SMTP server. Indeed as a connection failure might occure, we chose to persist this object in a RabbitMQ queue. Then a small worker written in Node.js will consume the messages from the queue and send it to the SMTP server if correctly formatted. The messages will be removed (acknoledged) from the queue only if the SMTP received the message. -->
## Templates ## Templates
......
# Media library service # Media library service
## What it does ## Features
This service allows you to upload a file on the [Minio](https://min.io/) instance (compatible with S3) of your choice. The file will be stored in the bucket defined in the configuration of the service. This service allows you to upload a file on the [Minio](https://min.io/) instance (compatible with S3) of your choice. The file will be stored in the bucket defined in the configuration of the service.
## How it works ## Dependencies
## Endpoints
For this service we implemented a custom health indicator that checks the connection to MinIO giving the total number of buckets when the connection is succesful.
## Implementation
![media-library-service](../../assets/media-library-service.png) ![media-library-service](../../assets/media-library-service.png)
...@@ -14,27 +20,4 @@ Before uploading the file, it makes sure that the specified bucket is created. I ...@@ -14,27 +20,4 @@ Before uploading the file, it makes sure that the specified bucket is created. I
The files are folded in sub-buckets as following `/<specified-bucket-name>/<year-YYYY>/<month-MM>/`. The files are folded in sub-buckets as following `/<specified-bucket-name>/<year-YYYY>/<month-MM>/`.
The uploaded file keep its original name but is prefixed by an md5 computed based on its content witch gives the following pattern for file names: `<md5>-<original-name>`. This means that if we upload twice the exact same file, with the same name there will be only one file stored in MinIO. The uploaded file keep its original name but is prefixed by an md5 computed based on its content witch gives the following pattern for file names: `<md5>-<original-name>`. This means that if we upload twice the exact same file, with the same name there will be only one file stored in MinIO.
\ No newline at end of file
## API documentation
NestJS provides a [swagger module](https://docs.nestjs.com/recipes/swagger) that can be easily integrated. Using specific annotations alongside your endpoints declaration, this module will automatically generates a swagger documentation, reachable at `/api-doc`.
## Service health
NestJS provides a [health module](https://github.com/nestjs/terminus) based on Terminus, that gives you the opportunity to declare predefined or custom health indicators. It exposes the health status of the service at `/health`.
This service will return a `200` http status code when all indicators are healthy. Otherwise it will return a `503` http status code.
For this service we implemented a custom health indicator that checks the connection to MinIO giving the total number of buckets when the connection is succesful.
## Stats
We are using a Node module called [swagger-stats](http://swaggerstats.io/).
It traces API calls, monitors API performance and usage statistics. It exposes the metrics in different formats, such as Prometheus format, so you may use Prometheus and Graphana for API monitoring and alerting.
Those metrics are available at `/swagger-stats/metrics`.
For more information about this module, visit the [official swagger-stat page](http://swaggerstats.io/docs.html).
## Docker
It is possible to run this service using Docker containers, using the `docker-compose.yml` and `Dockerfile` files.
For more information, refer to the project [service-media-library][add a link]
\ No newline at end of file
# Organizations service # Organizations service
## What it does ## Features
This service provides a list of organizations with different information about it (such as description, logo..etc). This service provides a list of organizations with different information about it (such as description, logo..etc).
In our application, one organization is usually a provider of data, used in the Portal Open Data. It can be a public actor or a private one. In our application, one organization is usually a provider of data, used in the Portal Open Data. It can be a public actor or a private one.
## How it works ## Dependencies
![organizations-service](../../assets/organizations-service.png)
The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. This backend application interacts with a PostgresSQL database through an ORM called [TypeORM](https://github.com/typeorm/typeorm).
## API documentation
NestJS provides a [swagger module](https://docs.nestjs.com/recipes/swagger) that can be easily integrated. Using specific annotations alongside your endpoints declaration, this module will automatically generates a swagger documentation, reachable at `/api-doc`. ## Endpoints
## Service health ## Implementation
NestJS provides a [health module](https://github.com/nestjs/terminus) based on Terminus, that gives you the opportunity to declare predefined or custom health indicators. It exposes the health status of the service at `/health`. ![organizations-service](../../assets/organizations-service.png)
This service will return a `200` http status code when all indicators are healthy. Otherwise it will return a `503` http status code.
For this service we declared an health indicator that verifies that it can connect to the database.
## Stats
We are using a Node module called [swagger-stats](http://swaggerstats.io/).
It traces API calls, monitors API performance and usage statistics. It exposes the metrics in different formats, such as Prometheus format, so you may use Prometheus and Graphana for API monitoring and alerting.
Those metrics are available at `/swagger-stats/metrics`.
For more information about this module, visit the [official swagger-stat page](http://swaggerstats.io/docs.html).
## Docker The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. This backend application interacts with a PostgresSQL database through an ORM called [TypeORM](https://github.com/typeorm/typeorm).
It is possible to run this service using Docker containers, using the `docker-compose.yml` and `Dockerfile` files. \ No newline at end of file
For more information, refer to the project [organizations-service][add a link]
\ No newline at end of file
# Resources service # Resources service
## What it does ## Features
This service can provide lists of resources and formats. This service can provide lists of resources and formats.
A resource is an entity representing some information, usually geographic, that can be accessed by a query (for example Web Map Service) or by downloading a file. One resource can be considered standard (e.g WMS protocol) or not standard (a custom service). A resource is an entity representing some information, usually geographic, that can be accessed by a query (for example Web Map Service) or by downloading a file. One resource can be considered standard (e.g WMS protocol) or not standard (a custom service).
...@@ -9,32 +9,14 @@ Each resource is associated with one or many formats. ...@@ -9,32 +9,14 @@ Each resource is associated with one or many formats.
*Example:* *Example:*
the output of a Web Feature Service (WFS), standard service providing an interface for geographical features, is a resource. And it is associated with many formats as such Shapefile or JSON. the output of a Web Feature Service (WFS), standard service providing an interface for geographical features, is a resource. And it is associated with many formats as such Shapefile or JSON.
## How it works ## Dependencies
![resources-service](../../assets/organizations-service.png) ## Endpoints
The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. This backend application interacts with a PostgresSQL database through an ORM called [TypeORM](https://github.com/typeorm/typeorm).
## API documentation
NestJS provides a [swagger module](https://docs.nestjs.com/recipes/swagger) that can be easily integrated. Using specific annotations alongside your endpoints declaration, this module will automatically generates a swagger documentation, reachable at `/api-doc`.
## Service health
NestJS provides a [health module](https://github.com/nestjs/terminus) based on Terminus, that gives you the opportunity to declare predefined or custom health indicators. It exposes the health status of the service at `/health`.
This service will return a `200` http status code when all indicators are healthy. Otherwise it will return a `503` http status code.
For this service we declared an health indicator that verifies that it can connect to the database. For this service we declared an health indicator that verifies that it can connect to the database.
## Stats ## Implementation
We are using a Node module called [swagger-stats](http://swaggerstats.io/).
It traces API calls, monitors API performance and usage statistics. It exposes the metrics in different formats, such as Prometheus format, so you may use Prometheus and Graphana for API monitoring and alerting.
Those metrics are available at `/swagger-stats/metrics`.
For more information about this module, visit the [official swagger-stat page](http://swaggerstats.io/docs.html). ![resources-service](../../assets/organizations-service.png)
## Docker The entrypoint of the service is a REST API provided by a [NestJS](https://github.com/nestjs/nest) application. This backend application interacts with a PostgresSQL database through an ORM called [TypeORM](https://github.com/typeorm/typeorm).
It is possible to run this service using Docker containers, using the `docker-compose.yml` and `Dockerfile` files.
For more information, refer to the project [organizations-service][add a link]
\ No newline at end of file
# Reuses
## Features
## Dependencies
## Endpoints
## Implementation
# Social media share helper
## Features
## Dependencies
## Endpoints
## Implementation
\ No newline at end of file
...@@ -12,6 +12,8 @@ NestJS provides a [swagger module](https://docs.nestjs.com/recipes/swagger) that ...@@ -12,6 +12,8 @@ NestJS provides a [swagger module](https://docs.nestjs.com/recipes/swagger) that
NestJS provides a health module based on [Terminus](https://github.com/nestjs/terminus), allowing developers to declare predefined and/or custom health indicators. By default, the health status of a given NestJS service is available through the `/health` endpoint. NestJS provides a health module based on [Terminus](https://github.com/nestjs/terminus), allowing developers to declare predefined and/or custom health indicators. By default, the health status of a given NestJS service is available through the `/health` endpoint.
A service will return a `200` http status code when all indicators are healthy. Otherwise it will return a `503` http status code.
## Logging ## Logging
## Guards or how to implement an AUTHZ layer ## Guards or how to implement an AUTHZ layer
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment