Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Dupont committed Sep 18, 2019
2 parents 42671a2 + 890cba6 commit ffa9bd4
Show file tree
Hide file tree
Showing 30 changed files with 250 additions and 312 deletions.
14 changes: 8 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels: 'bug'
assignees: ''

---
Expand All @@ -17,11 +17,12 @@ Be ready for followup questions, and please respond in a timely manner. If we ca
**Describe the bug**
A clear and concise description of what the bug is.

**Version of Helm and Kubernetes**:


**Which chart**:
**Environment**:
Provide the environment in which the bug has happened (minikube on a workstation, full fledged Kubernetes cluster, ...)

* **OS** (e.g. from `/etc/os-release`)
* **VM driver** (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName)
* **Minikube version** (e.g. `minikube version`)

**What happened**:

Expand All @@ -31,7 +32,8 @@ A clear and concise description of what the bug is.

**How to reproduce it** (as minimally and precisely as possible):

**Output of `minikube logs` (if applicable)**:

**Anything else we need to know**:

**Anything else we need to know**:

13 changes: 12 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@ In case you encounter an issue with FADI, have a feature request or any other qu

## Why "FADI"?

FADI is the acronym for "Framework d'Analyse de Données Industrielles" ("A Framework for Industrial Data Analysis"))
FADI is the acronym for "Framework d'Analyse de Données Industrielles" ("A Framework for Industrial Data Analysis"))

## FADI is not working

In case you encounter an issue with FADI, have a feature request or any other question, feel free to [open an issue](https://github.com/cetic/fadi/issues/new/choose).

Please make sure the following steps have been taken beforehand:

* update Minikube to the latest version
* update Helm to the latest version
* check the logs (`minikube logs`) for any suspicious error message

2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ cd helm
# you can edit values.yaml file to customise the stack
./deploy.sh
# see deploy.log for connection information to the various services
# specify the fadi namespace to see the different pods
kubectl config set-context minikube --namespace fadi
```

You can check everything is deploying/-ed in the Kubernetes dashboard:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ The FADI project is dedicated to making the deployment of Big Data tools simple,
The goal is to provide a straightforward way to deploy open-source systems for Big Data to various infrastructures (private and public clouds).
Anywhere you can run [Kubernetes](https://kubernetes.io/), you should be able to run FADI.

![FADI carousel](doc/images/carousel.gif)
![FADI carousel](doc/images/carousel/carousel.gif)

## Quick start

1. [Install the framework on your workstation](INSTALL.md)
2. Try [a simple use case](USERGUIDE.md)

You can find a more detailed explanation of the various components in the [architecture presentation](https://fadi.presentations.cetic.be)
You can find a more detailed explanation of FADI in the [presentation slideshow](https://fadi.presentations.cetic.be)

## FADI Helm Chart

Expand Down
170 changes: 126 additions & 44 deletions USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ The components needed for this use case are the following:
* Apache Nifi as a integration tool to ingest the sensor data from the data source (a csv file in this case) and store it in the database
* PostgreSQL as both a datawarehouse and datalake
* Gafana as a dashboard tool to display graphs from the data ingested and stored in the datalake
* Superset as a exploration dashboard tool
* Jupyter as a web interface to explore the data using notebooks

Those components are configured in the following [sample config file](helm/deploy.sh), once the platform is ready, you can start working with it. The following instructions assume that you deployed FADI on your workstation inside minikube.
Those components are configured in the following [sample config file](helm/values.yaml), once the platform is ready, you can start working with it. The following instructions assume that you deployed FADI on your workstation inside minikube.

## 2. Prepare the database to store measurments

Expand All @@ -35,24 +37,23 @@ First, setup the datalake by creating a table in the postgresql database.

To achieve this you need to:

* Head to the pgadmin interface ([http://pgadmin.fadi.minikube](http://pgadmin.fadi.minikube))
* Head to the pgadmin interface, if you are using **minikube**, you can use the following command :
```
minikube service -n fadi fadi-pgadmin
```

* Access to the pgadmin service using the following credentials:
* login: `[email protected]`
* password: `admin`

* Get the database password:

```
export POSTGRES_PASSWORD=$(kubectl get secret --namespace fadi fadi-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
echo $POSTGRES_PASSWORD
```
* Save the shown password to use it later.

* In pgadmin Browser, create a server on pgadmin by right-click on `Servers` -> `Create a Server`

* Configure the server as shown in the following screenshot.
* The `password` field should be completed by the one shown previously (with the `echo` command).
* Configure the server as shown in the following screenshot:
* Host name: `fadi-postgresql`
* Port: `5432`
* Maintenance database: `postgres`
* Username: `admin`
* Password: `password1`
![Postgres Server](examples/basic/images/pgadmin_create_server.png)

* Launch the Query tool.
Expand Down Expand Up @@ -102,7 +103,10 @@ measure_ts,temperature
(...)
```

To start, head to the Nifi web interface ([http://nifi.fadi.minikube](http://nifi.fadi.minikube)), if you are using the local installation with Minikube).
To start, head to the Nifi web interface, if you are using **minikube**, you can use the following command :
```
minikube service -n fadi fadi-nifi
```

![Nifi web interface](examples/basic/images/nifi_interface.png)

Expand All @@ -112,23 +116,30 @@ So, create the following components :

* InvokeHTTP processor:
* right-click > `Configure` > `Settings` tab > `Automatically Terminate Relationships` : all except `Response`
* right-click > `Configure` > `Properties` tab > Remote url: `https://raw.githubusercontent.com/cetic/fadi/master/examples/basic/sample_data.csv`
* right-click > `Configure` > `Properties` tab > Remote url: `https://raw.githubusercontent.com/cetic/fadi/master/examples/basic/sample_data.csv`
* right-click > `Configure` > `Scheduling` tab > Run Schedule: 120s (this will download the sample file every 120 seconds)
* PutDatabaseRecord processor:
* right-click > `Configure` > `Settings` tab > `Automatically Terminate Relationships` : all
* right-click > `Configure` > `Properties` tab > Record Reader: `CSV Reader`
* `Go To` > `Configure` > `Properties` >
* Treat First Line as Header: `true`
* right-click > `Configure` > `Properties` tab > Record Reader > `Create a new service` > `CSV Reader`
* `Go To` > `Configure` > `Properties` >
* Treat First Line as Header: `true`
* right-click > `Configure` > `Properties` tab > Statement Type: `INSERT`
* right-click > `Configure` > `Properties` tab > Database Connection Pooling Service > DBCPConnectionPool
* `Go To` > `Configure` > `Properties` >
* Database Connection URL: `jdbc:postgresql://fadi-postgresql:5432/postgres?stringtype=unspecified`
* Database Driver Class Name: `org.postgresql.Driver`
* Database Driver Location(s): `/opt/nifi/psql/postgresql-42.2.6.jar`
* Database User: `postgres`
* Password: set to the postgresql password obtained above
* Database User: `admin`
* Password: `password1`
* Enable service by clicking on the lightning icon.
* right-click > `Configure` > `Properties` tab > Schema Name > `public`
* right-click > `Configure` > `Properties` tab > Table Name > `example_basic`
* right-click > `Configure` > `Properties` tab > Translate Field Names > `false`
* Now we need to enable the controller services:
* Click anywhere on the Nifi workbench.
* Click on the `configuration` button.
* Enable both controller services.

* Response Connection:
* Create an edge from `InvokeHTTP` processor to `PutDatabaseRecord`
* Details > For relationships > `Response`
Expand All @@ -150,14 +161,28 @@ So, create the following components :
* Recursive Connection on `DatabaseRecord`:
* Details > relationships > only `retry`


* Select both processors and both output ports
* right-click, and select `Start`.

![Nifi Ingest CSV and store in PostgreSQL](examples/basic/images/nifi_csv_to_sql_2.png)

See also [the nifi template](/examples/basic/basic_example_final_template.xml) that corresponds to this example.
* Do not forget to update the `password` field in the imported template.
* To reuse the provided template (instead of designing our own template), you can:
* Click `Upload template` in the **Operate** frame, select the template, and upload it.
* From the Nifi menu, drag and drop the **Template** menu.
* Choose your uploaded template.
* In the **Operate** frame of Nifi:
* Click on `Configuration`
* Click on `View configuration` of `DBCPConnectionPool` controller service.
* In the `Properties` tab, complete the `password` field with `password1`
* Enable both `CSVReader` and `DBCPConnectionPool` controller services.
* Select both processors and both output ports
* right-click, and select `Start`.

For more information on how to use Apache Nifi, see the [official Nifi user guide](https://nifi.apache.org/docs/nifi-docs/html/user-guide.html) and this [Awesome Nifi](https://github.com/jfrazee/awesome-nifi) resources.

Finally, **start** the nifi flow in the **operate** window.

## 4. Display dashboards and configure alerts

Once the measurements are stored in the database, we will want to display the results in a dashboard.
Expand All @@ -168,27 +193,48 @@ Once the measurements are stored in the database, we will want to display the re
[Grafana](http://grafana.com/) provides a dashboard and alerting interface.

Head to the Grafana interface at [http://grafana.fadi.minikube](http://grafana.fadi.minikube) (the default credentials are `admin`/`password1`):
Head to the Grafana interface, if you are using **minikube**, you can use the following command :
```
minikube service -n fadi fadi-grafana
```
(the default credentials are `admin`/`password1`)

![Grafana web interface](examples/basic/images/grafana_interface.png)

First we will define the postgresql datasource:
First we will define the PostgreSQL datasource. To do that, in the Grafana Home Dashboard

* Select `Add data source`,
* Choose data source type: `PostgreSQL`,
* Complete the seeting as:
* Host: `fadi-postgresql:5432`
* database: `postgres`
* user: `admin`
* password: `password1`
* SSL Mode: `disable`
* Version: `10`

![Grafana datasource](examples/basic/images/grafana_datasource.gif)

* host: fadi-postgresql:5432
* database: postgres
* user: postgres
* password: set to the postgresql password obtained above
* disable ssl
Then we will configure a simple dashboard that shows the temperatures captured in the PostgreSQL database:

* Select `New dashboard`,
* Select `Choose Visualization`

Then we will configure a simple dashboard that shows the temperatures over the last week:
A pre-filled SQL query is provided and shown in the **Queries** tab.

To shown the dashboard, it is necessary to specify a time frame between `23/06/2016` and `28/06/2019`.

![Grafana dashboard](examples/basic/images/grafana_time_frame.png)

Then, a diagram is shown in the Grafana dashboard.

![Grafana dashboard](examples/basic/images/grafana_dashboard.png)

And finally we will configure some alerts using very simple rules:

![Grafana alert](examples/basic/images/grafana_alerting.gif)
* Select `Alert` tab.
* Click on `Create Alert`
* Specify the alert threshold.
![Grafana alert](examples/basic/images/grafana_alerting.png)

For more information on how to use Grafana, see the [official Grafana user guide](https://grafana.com/docs/guides/getting_started/)

Expand All @@ -200,28 +246,60 @@ For more information on how to use Grafana, see the [official Grafana user guide
[Apache Superset](https://superset.incubator.apache.org) provides some interesting features to explore your data and build basic dashboards.

Head to the Superset interface at [http://superset.fadi.minikube](http://superset.fadi.minikube) (the default credentials are `admin`/`password1`):
Head to the Superset interface, if you are using **minikube**, you can use the following command :
```
minikube service -n fadi fadi-superset
```
(the default credentials are `admin`/`password1`):

First we will define the datasource:

![Superset datasource](examples/basic/images/superset_datasource.png)
* On the top menu of Superset, click on `Sources` -> `Databases`

* SQLAlchemy URI: `postgresql://postgres:<your_password>@fadi-postgresql:5432/postgres`
* Then, on the right, click on (+) (`add a new record` button).
* Database: `example_basic`
* SQLAlchemy URI: `postgresql://admin:password1@fadi-postgresql:5432/postgres`

![Superset table](examples/basic/images/superset_table.gif)
* Finally, you can click on `Test Connection` to check to connection to the database.

![Superset datasource](examples/basic/images/superset_datasource.png)

* Sources > Tables > "+"
* Database: example_basic
* Edit measure_ts
* Select Sources --> Tables from the top-level menu.
* Click on the "Edit" icon for the example_basic table.
* Click on the "List Columns" tab.
* Scroll down to the "measure_ts" column.
* Click on the "Edit" icon for the "date" column.
* Once the database is created, we can now create a table.
* On the top menu of Superset, click on `Sources` -> `Tables`
* Click on (+) (`add a new record` button).
* Database: select `example_basic`.
* Table name: `example_basic`.
* Click `Save`.
* On the table `example_basic`, click `Edit record` button.
* On the `List Columns` tab, in the `measure_ts`, click on the `Edit record` button.
* In the "Expression" box, enter `measure_ts ::timestamptz`.
* Click `Save`.

![Superset table](examples/basic/images/superset_table.gif)

Then we will explore our data and build a simple dashboard with the data that is inside the database:

* On the top menu of Superset, click on `Charts`
* Click on (+) (`add a new record` button).
* Choose a datasource: select `example_basic`.
* Choose a visualization type: `Time Series - Line Chart`.
* Click `Create new chart`.
* In the `Data` tab
* in `Time` section,
* Time Grain: `hour`.
* Time range: `Last quarter`
* in `Query` section
* Metrics: `AVG(temperature)`
* Click `Save`
* Then, in the main window of the dashboard, click on `Run Query`.

A diagram will be shown.

* We can now save the dashboard, by clicking on `Save`.
* Save as: `Basic example`
* Add to new dashboard: `Basic example dashboard`
* Click on `Save & go to bashboard`.

![Superset dashboard](examples/basic/images/superset_dashboard.gif)

For more information on how to use Superset, see the [official Superset user guide](https://superset.incubator.apache.org/tutorial.html)
Expand All @@ -236,7 +314,11 @@ For more information on how to use Superset, see the [official Superset user gui

In this simple use case, we will try to access the data that is stored in the data lake.

Head to the Jupyter notebook interface at [http://jupyterhub.fadi.minikube](http://jupyterhub.fadi.minikube) (the default credentials are `admin`/`password1`):
Head to the Jupyter notebook interface, if you are using **minikube**, you can use the following command :
```
minikube service -n fadi proxy-public
```
(the default credentials are `admin`/`password1`):

![Jupyter web interface](examples/basic/images/jupyter_interface.png)

Expand Down
Loading

0 comments on commit ffa9bd4

Please sign in to comment.