Skip to content

Commit

Permalink
Merge pull request #10 from UTT-GL03/prototype3
Browse files Browse the repository at this point in the history
Prototype3
  • Loading branch information
Asmeeeee authored Nov 26, 2024
2 parents 2717b7f + db41245 commit 449620a
Show file tree
Hide file tree
Showing 13 changed files with 235 additions and 189 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
npm run build
- name: Start frontend
run: |
export COUCHDB_USER="admin"
export COUCHDB_PASSWORD="admin"
docker compose up --detach
- name: Wait for frontend
uses: docker://benel/wait-for-response:1
Expand Down
3 changes: 2 additions & 1 deletion .greenframe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ scenarios:
- path: ./benchmark/scenario1.js
name: Consulter la page
containers:
- ecometeo-static_hosting-1
- ecometeo-static_hosting-1
- ecometeo-backend-1
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,20 @@ Par ailleurs, il nous est possible désormais d'évaluer l'impact écologique de
![image](./benchmark/screenshots/GF_analys_EcoMeteo_network.png)

Fig.6 : Consommation de ressources par le serveur Web lors de la consultation de la page météo dans notre prototype.

# Prototype n°3 : Fonctionnalités pour le scénario prioritaire avec données stockées dans une base de données

Pour la troisième version du prototype, les données sont désormais stockées dans un système de base de données interrogeable à travers une API Web (CouchDB). L'intérêt d'une source de données dynamique est d'une part, à terme, de pouvoir ajouter ou modifier des données plus facilement, et d'autre part de déporter sur le serveur le filtrage des données pertinentes.

Concernant ce deuxième enjeu, contrairement au projet du professeur, notre prototype se limite à une seule page. Ainsi, les mesures (cf. Fig.7) ne montrent pas de diminution de la charge réseau entre les deux prototypes pour la consultation de la page d'accueil.

![image](./benchmark/screenshots/GF_analys_EcoMeteo_Prototype2_overview.png)
![image](./benchmark/screenshots/GF_analys_EcoMeteo_Prototype3_overview.png)
Fig.7 : Comparaison de l'impact de la consultation de la page d'accueil entre les prototypes 2 (en haut) et 3 (en bas).

En revanche, nous avons maintenant une utilisation continue du CPU par la base de données (cf. Fig.8).
![image](./benchmark/screenshots/GF_analys_EcoMeteo_Prototype3_backend.png)

Fig.8 : Profil dans le temps de l'impact de la base de données lors de la consultation de la page d'accueil.

De ces différentes mesures, nous pouvons retenir que l'effet de l'introduction d'une base de données, quoique négligeable, est, pour l'instant, plutôt défavorable d'un point de vue écologique. Le bilan de ce changement devrait cependant rapidement s'inverser avec l'augmentation de la quantité de données gérées.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 39 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,42 @@ services:
- ./frontend/dist:/usr/share/nginx/html:ro
- ./settings/nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- 80:80
- 80:80

backend:
image: couchdb:3
ports:
- 5984:5984
environment:
- COUCHDB_USER
- COUCHDB_PASSWORD
healthcheck:
test: curl -f http://localhost:5984/_up || exit 1
interval: 2s
timeout: 3s

accessible_backend:
image: curlimages/curl
entrypoint: ["/bin/sh","-c"]
command:
- |
alias put="curl -X PUT -u '${COUCHDB_USER}:${COUCHDB_PASSWORD}'"
put backend:5984/_node/nonode@nohost/_config/chttpd/enable_cors --data '"true"'
put backend:5984/_node/nonode@nohost/_config/cors/origins --data '"*"'
put backend:5984/ecometeo
put backend:5984/ecometeo/_security --data '{"members":{"roles":[]},"admins":{"roles":["_admin"]}}'
depends_on:
backend:
condition: service_healthy

updated_samples:
image: curlimages/curl
entrypoint: ["/bin/sh","-c"]
volumes:
- ./frontend/public/sample_data.json:/sample_data.json
command:
- |
curl -X POST http://backend:5984/ecometeo/_bulk_docs -H "Content-Type: application/json" -d @/sample_data.json
depends_on:
accessible_backend:
condition: service_completed_successfully
296 changes: 142 additions & 154 deletions frontend/public/sample_data.json
Original file line number Diff line number Diff line change
@@ -1,167 +1,155 @@

{
"meteo": [
"docs": [
{
"city": "Paris",
"meteo": [
{
"date": "2024-10-07 00:00",
"temperature": "14°C",
"humidity": "68%",
"wind": "Est",
"precipitation": "Pluie"
},
{
"date": "2024-10-08 00:00",
"temperature": "16°C",
"humidity": "73%",
"wind": "Sud-Est",
"precipitation": "Aucun"
},
{
"date": "2024-10-09 00:00",
"temperature": "12°C",
"humidity": "80%",
"wind": "Nord-Est",
"precipitation": "Neige"
},
{
"date": "2024-10-10 00:00",
"temperature": "11°C",
"humidity": "54%",
"wind": "Nord-Est",
"precipitation": "Pluie"
},
{
"date": "2024-10-11 00:00",
"temperature": "17°C",
"humidity": "73%",
"wind": "Nord-Ouest",
"precipitation": "Aucun"
},
{
"date": "2024-10-12 00:00",
"temperature": "21°C",
"humidity": "76%",
"wind": "Nord-Ouest",
"precipitation": "Pluie"
},
{
"date": "2024-10-13 00:00",
"temperature": "17°C",
"humidity": "90%",
"wind": "Sud-Est",
"precipitation": "Neige"
}
]
"meteo": {
"date": "2024-10-07 00:00",
"temperature": "14°C",
"humidity": "68%",
"wind": "Est",
"precipitation": "Pluie"
}
},
{
"city": "Paris",
"meteo": {
"date": "2024-10-08 00:00",
"temperature": "16°C",
"humidity": "73%",
"wind": "Sud-Est",
"precipitation": "Aucun"
}
},
{
"city": "Paris",
"meteo": {
"date": "2024-10-09 00:00",
"temperature": "12°C",
"humidity": "80%",
"wind": "Nord-Est",
"precipitation": "Neige"
}
},
{
"city": "Paris",
"meteo": {
"date": "2024-10-10 00:00",
"temperature": "11°C",
"humidity": "54%",
"wind": "Nord-Est",
"precipitation": "Pluie"
}
},
{
"city": "Paris",
"meteo": {
"date": "2024-10-11 00:00",
"temperature": "17°C",
"humidity": "73%",
"wind": "Nord-Ouest",
"precipitation": "Aucun"
}
},
{
"city": "Troyes",
"meteo": {
"date": "2024-10-07 00:00",
"temperature": "24°C",
"humidity": "69%",
"wind": "Nord-Ouest",
"precipitation": "Neige"
}
},
{
"city": "Troyes",
"meteo": {
"date": "2024-10-08 00:00",
"temperature": "20°C",
"humidity": "90%",
"wind": "Est",
"precipitation": "Aucun"
}
},
{
"city": "Troyes",
"meteo": [
{
"date": "2024-10-07 00:00",
"temperature": "24°C",
"humidity": "69%",
"wind": "Nord-Ouest",
"precipitation": "Neige"
},
{
"date": "2024-10-08 00:00",
"temperature": "20°C",
"humidity": "90%",
"wind": "Est",
"precipitation": "Aucun"
},
{
"date": "2024-10-09 00:00",
"temperature": "25°C",
"humidity": "78%",
"wind": "Ouest",
"precipitation": "Grêle"
},
{
"date": "2024-10-10 00:00",
"temperature": "23°C",
"humidity": "67%",
"wind": "Est",
"precipitation": "Aucun"
},
{
"date": "2024-10-11 00:00",
"temperature": "13°C",
"humidity": "65%",
"wind": "Nord-Ouest",
"precipitation": "Aucun"
},
{
"date": "2024-10-12 00:00",
"temperature": "22°C",
"humidity": "52%",
"wind": "Sud-Est",
"precipitation": "Pluie"
},
{
"date": "2024-10-13 00:00",
"temperature": "17°C",
"humidity": "63%",
"wind": "Est",
"precipitation": "Neige"
}
]
"meteo": {
"date": "2024-10-09 00:00",
"temperature": "25°C",
"humidity": "78%",
"wind": "Ouest",
"precipitation": "Grêle"
}
},
{
"city": "Troyes",
"meteo": {
"date": "2024-10-10 00:00",
"temperature": "23°C",
"humidity": "67%",
"wind": "Est",
"precipitation": "Aucun"
}
},
{
"city": "Troyes",
"meteo": {
"date": "2024-10-11 00:00",
"temperature": "13°C",
"humidity": "65%",
"wind": "Nord-Ouest",
"precipitation": "Aucun"
}
},
{
"city": "Toulouse",
"meteo": {
"date": "2024-10-07 00:00",
"temperature": "21°C",
"humidity": "62%",
"wind": "Nord-Est",
"precipitation": "Pluie"
}
},
{
"city": "Toulouse",
"meteo": {
"date": "2024-10-08 00:00",
"temperature": "20°C",
"humidity": "74%",
"wind": "Est",
"precipitation": "Aucun"
}
},
{
"city": "Toulouse",
"meteo": {
"date": "2024-10-09 00:00",
"temperature": "24°C",
"humidity": "71%",
"wind": "Sud",
"precipitation": "Aucun"
}
},
{
"city": "Toulouse",
"meteo": {
"date": "2024-10-10 00:00",
"temperature": "12°C",
"humidity": "88%",
"wind": "Nord-Est",
"precipitation": "Pluie"
}
},
{
"city": "Toulouse",
"meteo": [
{
"date": "2024-10-07 00:00",
"temperature": "21°C",
"humidity": "62%",
"wind": "Nord-Est",
"precipitation": "Pluie"
},
{
"date": "2024-10-08 00:00",
"temperature": "20°C",
"humidity": "74%",
"wind": "Est",
"precipitation": "Aucun"
},
{
"date": "2024-10-09 00:00",
"temperature": "24°C",
"humidity": "71%",
"wind": "Sud",
"precipitation": "Aucun"
},
{
"date": "2024-10-10 00:00",
"temperature": "12°C",
"humidity": "88%",
"wind": "Nord-Est",
"precipitation": "Pluie"
},
{
"date": "2024-10-11 00:00",
"temperature": "19°C",
"humidity": "58%",
"wind": "Est",
"precipitation": "Neige"
},
{
"date": "2024-10-12 00:00",
"temperature": "20°C",
"humidity": "90%",
"wind": "Nord",
"precipitation": "Pluie"
},
{
"date": "2024-10-13 00:00",
"temperature": "22°C",
"humidity": "66%",
"wind": "Ouest",
"precipitation": "Aucun"
}
]
"meteo": {
"date": "2024-10-11 00:00",
"temperature": "19°C",
"humidity": "58%",
"wind": "Est",
"precipitation": "Neige"
}
}
]
}
Loading

0 comments on commit 449620a

Please sign in to comment.