Skip to content
Snippets Groups Projects
Commit 1f0a57bd authored by Yoan VALLET's avatar Yoan VALLET
Browse files

fill launch local application section

parent 57d78c6f
No related branches found
No related tags found
No related merge requests found
!!! info ""
:construction: Section under Construction :construction:
\ No newline at end of file
:construction: Section under Construction :construction:
This section will allow you to launch a proper local environment of the Ecolyo application
## Initialisation of the project
### Clone the project repository
Use following command in your favorite terminal to clone the projet:
```
git clone https://forge.grandlyon.com/web-et-numerique/llle_project/ecolyo.git
```
### User settings
Open the project with VSCode and add the following code into .vscode/settings.json:
```
{
"workbench.colorCustomizations": {
/* Put anything you like here */
},
"editor.snippetSuggestions": "top",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"diffEditor.ignoreTrimWhitespace": false,
"window.zoomLevel": 0,
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"breadcrumbs.enabled": true,
"workbench.settings.editor": "json",
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.formatOnPaste": true
}
```
## Installation of the projet
### Installation of node modules
To install required node module, open a terminal on the root folder of the projet and type the following command:
```
yarn
```
### Start Ecolyo application
To start ecolyo application just launch the command:
```
yarn start
```
If application start successfully you should obtain following message:
> App successfully updated!<br>
> Dev assets: http://localhost:8888
!!! info "Fix webpack error on cozy script"
During launching you may have the following error: ** TO BE COMPLETED **
To fix it launch the following command in node_modules/cozy-script folder:
```
yarn add webpack
```
### Run the dev stack
The dev stack will contain the cozy-stack with some default applications and konnectors and allow you to run this stack localy.
First login to the forge registry:
```
docker login registry.forge.grandlyon.com
```
You will need to enter for credentials.
Next pull the last image of the dev stack:
```
docker pull registry.forge.grandlyon.com/web-et-numerique/llle/cozy-env:latest
```
#### On windows
Launch the stack will following command:
```
yarn winstack
```
A Powershell window will open. Wait until the success message:
**TO BE COMPLETED**
Once successfull you can launch your local cozy with following url: [Cozy local url](http://cozy.tools:8080/)
Local database can also be consulted at the following url: [Cozy local DB](http://localhost:5984/_utils/)
#### On Linux
From the project build folder, launch following command:
```
docker run --rm -it -p 8080:8080 -p 5984:5984 -p 8025:8025 -v $(pwd):/data/cozy-app -v ~/cozy/data/db:/usr/local/couchdb/data -v ~/cozy/data/storage:/data/cozy-storage --name=cozydev cozy/cozy-app-dev
```
Wait until the success message:
**TO BE COMPLETED**
Once successfull you can launch your local cozy with following url: [Cozy local url](http://cozy.tools:8080/)
Local database can also be consulted at the following url: [Cozy local DB](http://localhost:5984/_utils/)
## Import moke data
!!! info "Requirement"
Your dev stack should be running to import the moke data
First install ACH using yarn :
```
yarn global add cozy-ach
```
Next launch the script **createDayDataFiles.js** available into **test** folder
```
cd test
node createDayDataFiles.js
```
!!! info ""
You can change the period of data generated by changing the following lines:
```
const startingdate = DateTime.local()
.plus({ days: -120 })
.startOf('day')
const endingDate = DateTime.local()
.plus({ days: -1 })
.startOf('day')
```
Just replace -120 by the value needed
Json files with data will be created into **test/data** folder.
ACH script "importData.bat" will load the content of the file into your couchDB (database of your dev stack). Launch it using following commands:
```
cd test
./importData.bat
```
A new browser windows will open and asking you approval to import data. Just click on **Approve**
Finally your data is loaded and ready to be displayed in the Ecolyo Application !
\ No newline at end of file
!!! info ""
:construction: Section under Construction :construction:
\ No newline at end of file
This section will allow you to install a proper local environment step by step for Ecolyo application using VSCode IDE.
## VSCode
### Install VSCode
Installation for VSCode can be found here: [Installaltion of VSCode](https://code.visualstudio.com/).
### Extensions
Installation of Extention is explained here: [Installation of Extensions](https://code.visualstudio.com/docs/editor/extension-gallery).
Here are the list of important extensions to install:
* Prettier - Code formatter
* ES7 React/Redux/GraphQL/React-Native snippets
* GitLens - Git supercharged
* Markdown Preview
Optional extensions:
* Bracket Pair Colorizer 2
* CSS Peek
* Auto Rename Tag
* indent-rainbow
* TabOut
### User settings
User settings for Ecolyo are describ in this section:
## Git
The project is using GitLab, you will need to install Git to checkout the projet.
Installation for Git can be found here: [Installation of Git](https://git-scm.com/).
## Yarn
Yarn is used as package manager for this projet. Feel free to use the one you prefere but we advice to install yarn as all the documentation is describe with this package manager.
Installation for yarn can be found here: [Installation of Yarn](https://classic.yarnpkg.com/fr/docs/install/).
## Docker
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.
### Install Docker
Installation of Docker can be found here: [Installation of Docker](https://www.docker.com/get-started).
### Install Docker-Compose
Installation of Docker-Compose (according to your OS) is explained here: [Installation of Docker-Compose](https://docs.docker.com/compose/install/).
# Timeseries doctypes
## Timeseries doctypes
### Description
Each fluid has its own doctype wildcard and one doctype per time step. Each available time step for a fluid depends of the available data from the energy provider. Here are the different time step:
* minute
* hour
......@@ -7,6 +8,8 @@ Each fluid has its own doctype wildcard and one doctype per time step. Each avai
* month
* year
### Doctype
Here are the available doctypes:
Fluid type | Doctype wildcard | Doctypes
......@@ -15,7 +18,7 @@ electricity fluid / enedis | **`com.grandlyon.enedis.*`** | **`com.grandlyon.ene
gaz fluid / grdf | **`com.grandlyon.grdf.*`** | **`com.grandlyon.grdf.hour`**<br>**`com.grandlyon.grdf.day`**<br>**`com.grandlyon.grdf.month`**<br>**`com.grandlyon.grdf.year`**
water fluid / eau du grand lyon | **`com.grandlyon.egl.*`** | **`com.grandlyon.egl.day`**<br>**`com.grandlyon.egl.month`**<br>**`com.grandlyon.egl.year`**
#### Structure
### Structure
Field | Type | Description
----- | -----|------------
load | number | load (in kWh or L)
......@@ -25,7 +28,7 @@ day | number | day of the date<br>*set to 1 for month and year series*
month | number | month of the date<br>*set to 1 for year series*
year | number | year of the date
#### Example
### Example
```
{
"load": 770.18,
......@@ -37,15 +40,15 @@ year | number | year of the date
}
```
# User profile
## User profile
#### Description
### Description
This doctype is used to store all information about the user.
#### Doctype
### Doctype
**`com.grandlyon.ecolyo.userprofile`**
#### Structure
### Structure
Field | Type | Description
----- | -----|------------
level | number | challenge level of the user
......@@ -53,7 +56,7 @@ challengeTypeHash | string | Hash used to verify the content of challenge type
ecogestureHash | string | Hash used to verify the content of ecogesture
haveSeenWelcomeModal | boolean | flag to inform is the user have seen the welcome modal
#### Example
### Example
```
{
"challengeTypeHash": "c10bbfec554e735d58a5d7009c9964e4a6bc4c65",
......@@ -63,15 +66,15 @@ haveSeenWelcomeModal | boolean | flag to inform is the user have seen the welcom
}
```
# Ecogesture
## Ecogesture
#### Description
### Description
This doctype is used to store ecogestures.
#### Doctype
### Doctype
**`com.grandlyon.ecolyo.ecogesture`**
#### Structure
### Structure
Field | Type | Description
----- | -----|------------
shortName | string | short name of the ecogesture
......@@ -85,7 +88,7 @@ pack | number | pack number of the ecogesture (1 pack contain 2 ecogestures)
iconName | string | icon name for ecogesture
unlocked | boolean| (Optional) state for unlocked ecogesture
#### Example
### Example
```
{
"shortName": "Contrôle du nuage",
......@@ -101,15 +104,15 @@ unlocked | boolean| (Optional) state for unlocked ecogesture
}
```
# Challenge type
## Challenge type
#### Description
### Description
This doctype is used to store all available challenges.
#### Doctype
### Doctype
**`com.grandlyon.ecolyo.challengetype`**
#### Structure
### Structure
Field | Type | Description
----- | -----|------------
type | TypeChallenge | type of challenge<br><br>*TypeChallenge enum:*<br>- *CHALLENGE = 0*<br>- *ACHIEVEMENT = 1*
......@@ -120,7 +123,7 @@ duration | Duration | duration. (Duration from luxon)
fluidTypes | FluidType[] | Array of fluid type associated to the challenge<br><br>*FluidType enum:*<br>- *ELECTRICITY = 0*<br>- *WATER = 1*<br>- *GAS = 2*<br>- *MULTIFLUID = 3*
relationships | any | relation to available ecogestures for the challenge<br><br>*"availableEcogestures": {*<br>*"data": Ecogesture[]*<br>*}*
#### Example
### Example
```
{
"type": 1,
......@@ -152,15 +155,15 @@ relationships | any | relation to available ecogestures for the challenge<br><br
}
```
# User challenge
## User challenge
#### Description
### Description
This doctype is used to store all additionnal information about a challenge started or ended by the user.
#### Doctype
### Doctype
**`com.grandlyon.ecolyo.userchallenge`**
#### Structure
### Structure
Field | Type | Description
----- | -----|------------
startingDate | string | starting date of the the challenge
......@@ -172,7 +175,7 @@ badge | BadgeState | state of the badge<br><br>BadgeState enum<br>- *FAILED = 0*
fluidTypes | FluidType[] | fluid types set when user launch the challenge<br><br>*FluidType enum:*<br>- *ELECTRICITY = 0*<br>- *WATER = 1*<br>- *GAS = 2*<br>- *MULTIFLUID = 3*
relationships | any | relation to the challenge type and selected ecogestures for the challenge<br><br>*"challengeType": {*<br>*"data": ChallengeType[]*<br>*}*<br><br>*"selectedEcogestures": {*<br>*"data": Ecogesture[]*<br>*}*
#### Example
### Example
```
{
"state": 1
......
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