Skip to content
Snippets Groups Projects
Commit 6ebdf664 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Merge branch 'master' of...

parents 3b76ac76 3e893cdc
Loading
Pipeline #12372 passed
Here are common commands use on dev environment.
# App
## Install a specific version of an app
```bash
$ cd /easy-cozy
$ docker-compose exec cozy ./cozy apps update home --domain "[name].cozy.self-data.alpha.grandlyon.com" git://github.com/doubleface/cozy-collect.git#build-debug
```
# Konnector
## Install a specific version of a konnector
```bash
$ cd /easy-cozy
# cozy-stack konnectors uninstall ${konn} --domain ${url}
$ docker-compose exec cozy ./cozy konnectors uninstall grdfgrandlyon --domain "[name].cozy.self-data.alpha.grandlyon.com"
grdfgrandlyon has been uninstalled
# cozy-stack konnectors install ${konn} --domain ${url}
$ docker-compose exec cozy ./cozy konnectors install grdfgrandlyon --domain "[name].cozy.self-data.alpha.grandlyon.com" git://forge.grandlyon.com/web-et-numerique/llle_project/grdf-adict-konnector.git#build
grdfgrandlyon (0.1.5-a3f6f05d9fde7c705b811658b3ce3667a9d7d0b5) has been installed on [name].cozy.self-data.alpha.grandlyon.com
```
## Update the version of a konnector
```bash
$ cd /easy-cozy
# cozy-stack konnectors update ${konn} --domain ${url}
$ docker-compose exec cozy ./cozy konnectors update grdfgrandlyon --domain "[name].cozy.self-data.alpha.grandlyon.com"
grdfgrandlyon has been upgraded to 0.1.5-d4bbe7350ecf13d13734f559c538e3c0ee8dc7ae
```
## Run a konnector from the stack
```bash
$ cd /root/easy-cozy
# cozy-stack konnectors run ${konn} --domain ${url}
$ docker-compose exec cozy ./cozy konnectors run grdfgrandlyon --domain "[name].cozy.self-data.alpha.grandlyon.com"
```
# Instance
## Set log level to debug for an instance
```bash
$ cd /root/easy-cozy
# cozy-stack instances debug ${url} true
$ docker-compose exec cozy ./cozy instances debug --domain "[name].cozy.self-data.alpha.grandlyon.com" true
```
# Stack
## Check stack version
```bash
$ cd /easy-cozy
$ docker-compose exec cozy ./cozy version
```
## Update stack version
Update version in the Dockerfile on gitlab.
**On serveur :**
1. git pull or change localy the version in cozy-stack/Dockerfile
2. create the docker image using:
```bash
cd /easy-cozy/build
./build-docker-image.sh
```
3. Start the container based on the built image
```bash
cd ..
docker-compose up -d cozy
```
!!! info "Error encounter"
Docker container was not launched, when consulting logs we can see the folowing error
> ./cozy: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./cozy)
We have replaced debian:stable-slim with unbuntu:20.10 as installer for our docker build: [https://forge.grandlyon.com/pocs/cozy/easy-cozy/-/commit/48a30a03f209169e0f1ebb0d106bb4361e7cd167](https://forge.grandlyon.com/pocs/cozy/easy-cozy/-/commit/48a30a03f209169e0f1ebb0d106bb4361e7cd167)
# Easy Cozy scripts
Easy cozy project comes with 2 main scripts:
- create-instance.sh: used to create an instance for a user
- remove-instance.sh: used to remove an instance for a specific user
In addition of these scripts we have added custom scripts for some specific needs. All these scripts are available in the "admin_scripts" folder
# Scripts for instances
| Scripts | Args | Description |
|-------------------|-------------------|----------------------------------------------------------|
| reset_instance.sh | instance_url | Remove and recreate again the instance for a given user |
# Scripts for applications
| Scripts | Args | Description |
|--------------------------|-------------------|-------------------------------------------------------------------------------|
| update_all_ecolyo_dev.sh | none | update Ecolyo with last version from build-dev branch on all instances |
| update_ecolyo_master.sh | instance_url | update Ecolyo with last version from build branch on a specific instance |
| update_ecolyo_dev.sh | instance_url | update Ecolyo with last version from build-dev branch on a specific instance |
| update_ecolyo_test.sh | instance_url | update Ecolyo with last version from build-test branch on a specific instance |
| update_pilote_master.sh | instance_url | update Pilote with last version from build-dev branch on a specific instance |
| update_pilote_dev.sh | instance_url | update PIlote with last version from build-test branch on a specific instance |
# Scripts for konnectors
| Scripts | Args | Description |
|---------------------------------|-------------------|----------------------------------------------------------------------------------------|
| update_enedis_konnector_prod.sh | instance_url | update Enedis konnector with last version from build branch on a specific instance |
| update_enedis_konnector_dev.sh | instance_url | update Enedis konnector with last version from build-dev branch on a specific instance |
......@@ -29,55 +29,122 @@ If it is a right answer, the quiz result is incremented by one.
At the end of every quiz, we're creating a custom question.
Here are the fields used to create a custom question
| Field | Type | Description |
| -------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| type | CustomQuestionType | Type of custom qusetion: DATA or CALCULATION. |
| timeStep | TimeStep | Time step of the result value (DAY / WEEK / MONTH / YEAR). For CALCULATION type it's represent daily / weekly / monthly / yearly average. |
| interval | TimeStep | Interval in which the data will be searched (DAY / WEEK / MONTH / YEAR) |
| period | CustomPeriod | Use to define a specific period for the interval { day? / month? / year? }. If not assigned the period will be the last interval (example: last week) |
| result | UserQuizState | Indicate the state of the custom question (UNLOCKED, CORRECT, UNCORRECT) |
| Field | Type | Description |
| ----------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| type | CustomQuestionType | Type of custom qusetion: DATE or MAXLOAD or AVERAGE. |
| timeStep | TimeStep | Time step of the result value (DAY / WEEK / MONTH / YEAR). For MAXLOAD or AVERAGE type, it represents daily / weekly / monthly / yearly average. |
| interval | TimeStep | Interval in which the data will be searched (DAY / WEEK / MONTH / YEAR) |
| period | CustomPeriod | Case day / month / year:<br/>Use to define a specific period for the interval { day? / month? / year? }. <br/>Case weekday:<br/>Only usable with AVERAGE type and DAY timestep: Allow to specify a weekday on which average is made. If used with another type, period will not be taken into account.<br/>If not assigned the period will be the last interval (example: last week) |
| singleFluid | boolean | Indicate if all connected fluid should be taken into account.<br/>If set to true only the first connected fluid will be taken into account in this order: electricity, gas, water. #unit and #fluid in the question label will be replace by the unit and the name of the fluid |
| result | UserQuizState | Indicate the state of the custom question (UNLOCKED, CORRECT, UNCORRECT) |
Calculation of custom question is done by conbinaison of all parameters:
#### Type DATA
#### Type DATE
- If _period_ is empty.
Retrieve the **max load** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
=> example: What day did I consumme the most on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
Retrieve the **date** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
```
example: What day did I consumme the most on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
```
example: What day did I consumme the most #fluid in #unit on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = true
```
- If _period_ is not empty
Retrieve the **max load** of day/month/year (define by _timeStep_) from week, month, year (define by _interval_) of _period_
=> example: What month did I consumme the most on year 2020 ?
type = CustomQuestionType.DATA
timeStep = TimeStep.MONTH
interval = TimeStep.YEAR
period = {year: 2020}
Retrieve the **date** of day/month/year (define by _timeStep_) from a week, month, year (define by _interval_) of _period_
```
example: What month did I consumme the most on year 2020 ?
type = CustomQuestionType.DATA
timeStep = TimeStep.MONTH
interval = TimeStep.YEAR
period = { year: 2020 }
singleFluid = false
```
#### Type CALCULATION
#### Type MAXLOAD
- If _period_ is empty
Retrieve the **average** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
=> example: Which is your daily average consumption on last week ?
type = CustomQuestionType.CALCULATION
Retrieve the **maxload** value of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
```
example: Which is your daily max consumption on the last week ?
type = CustomQuestionType.MAXLOAD
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
- If _period_ is not empty
Retrieve the **average** of day/month/year (define by _timeStep_) from week, month, year (define by _interval_) of _period_
=> example: Which is your daily average consumption on january ?
type = CustomQuestionType.DATA
Retrieve the **maxload** value of day/month/year (define by _timeStep_) from a week, month, year (define by _interval_) of _period_
```
example: Which is your daily max consumption on january 2020 ?
type = CustomQuestionType.MAXLOAD
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = {month: 1}
period = { month: 1, year: 2020 }
singleFluid = false
```
#### Type AVERAGE
- If _period_ is empty
Retrieve the **average** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
```
example: Which is your daily average consumption on last week ?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
- If _period_ is not empty
Retrieve the **average** of day/month/year (define by _timeStep_) from a week, month, year (define by _interval_) of _period_
```
example: Which is your daily average consumption on january 2020 ?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = { month: 1, year: 2020 }
singleFluid = false
```
- If _period_ is weekday
Retrieve the **average** of the _weekday_ from a week, month, year (define by _interval_).
```
example: Which is your daily average consumption on wednesdays of last month?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = { weekday: 3 }
singleFluid = false
```
Then, two randoms answers are generated after defining the right answer.
......
# Ecogesture
## Description
An ecogesture is a gesture that encourages user to take action for reduce their own consumption.
It includes different information such as icon, name, long and short description, its efficiency on the consumption and which fluid is affected.
Also, an ecogesture can be used for an action challenge.
## All ecogestures screen
This screen display the full list of ecogestures. User can filter ecogesture by usage.
## Ecogestures filtered by profile
This screen display is based on a filtered ecogesture list that fit to the user profile type.
This screen display is based on a filtered ecogesture list that fit to the user profile type.
The user can also filter ecogesture by usage.
Following rules are used to filter the ecogesture:
......@@ -22,12 +30,15 @@ OR
- the ecogesture has gas fluid and profile type has an individual heating which use gas fluid.
### Case ecogesture usage is ECS
>`ECS = Eau chaude sanitaire`
> `ECS = Eau chaude sanitaire`
We will display the ecogesture if:
- the ecogesture has electricity fluid and profile type has an individual hot water which use electricity fluid.
OR
- the ecogesture has gas fluid and profile type has an individual hot water which use gas fluid.
### Case ecogesture usage is ECS
......@@ -50,4 +61,4 @@ We will display the ecogesture.
### Case ecogesture usage is air conditioning
We will NOT display the ecogesture.
\ No newline at end of file
We will NOT display the ecogesture.
This diff is collapsed.
!!! info ""
:construction: Section under Construction :construction:
\ No newline at end of file
# Environments
We have 2 environments available for this project:
- One environment of dev hosted on scaleway and manage by the dev team
- One environment of production hosted on Cozy and manage by Cozy
## Dev environment aka alpha
The dev environnment has been mounted on a dedicated instance on scaleway.
### Cozy stack
It is based on the easy-cozy project available on GitLab: https://forge.grandlyon.com/pocs/cozy/easy-cozy
On the server, the .env file has been initialize with the good secrets (see the .env.template) and also initialize to create instance with Ecolyo and the 3 needed konnectors by default.
This projet will build and run 3 images:
- the cozy stack
- the couch db
- keycloack
To run the project please refer to the documentation on the GitLab project.
Once the project is up and running, we are able to create, update and delete instance.
Let's see more details in the [dedicated section](../../easycozy/scripts.md).
### Proxy
Konnector for Ecolyo need proxy for the OAuth dance. The proxy is also mount on the same instance as the Cozy stack and based on the project available on GitLab: https://forge.grandlyon.com/pocs/cozy/cozy-oauth-proxy
The proxy is written in Go language. The "main.go" file containt all the source code and also the default variables.
Default variables are the one used for the dev environment but we will be overwrite for the production.
To Launch the proxy, just pull the project and use the docker-compose file with following commands:
```
git pull https://forge.grandlyon.com/pocs/cozy/cozy-oauth-proxy
cd cozy-oauth-proxy
docker-compose up -d
```
### Ecolyo and konnectors
By default the version present on the "build-dev" branch is used to install Ecolyo app and konnectors on a new instance.
Some scripts has been created in order to install, update, downgrade, remove app and konnectors. Please refer to the [dedicated section](../../easycozy/scripts.md) for more information.
## Prod environment
This environment is fully managed by Cozy team.
### Cozy stack
Fully managed by Cozy team.
### Proxy
A dedicated proxy is deployed on Cozy side to allow konnector to make the OAuth dance.
The proxy deployed is based on the project available on the GitLab but variables are overwrite using flags by the Cozy team in order to fit to the environment.
For each modification in production, it needs:
- to be done on the gitLab project
- to be testeded in dev environnment
After that we should ask Cozy to pull the modification from the GitLab in order to have them in production.
### Ecolyo and konnectors
The production environment is based on the build branch which should reflect the build of sources present on master branch.
Each deployment is done manually for each app/konnector by:
- building the application (yarn build)
- deploy the build on the build branch (yarn deploy)
- publishing content of build branch into Cozy repo (yarn cozyPublish)
Once it is published, Cozy team should validate it before deploying the new app version into all Cozy Grand Lyon instances.
\ No newline at end of file
......@@ -24,6 +24,9 @@ extra_css:
nav:
- Home: index.md
- Easy Cozy:
- Scripts: easycozy/scripts.md
- Commands: easycozy/commands.md
- Pilote:
- Pilote - TS - Back:
- Index: pilote/Pilote - TS - Back/index.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment