-
Bastien DUMONT authoredBastien DUMONT authored
Getting started
This section will allow you to launch a proper local environment of the Ecolyo application
:::tip Clone the project
First, clone Ecolyo
:::
Installation of the project
Start the app
Install required node modules, open a terminal on the root folder of the project and type the following command:
yarn install
Start ecolyo application just launch the command:
yarn start
If the application starts successfully you should obtain the following message:
App successfully compiled!
Dev assets: 'http://localhost:8888'
Once the application is started, run the easy-cozy stack with docker.
Start cozy stack
Launch the stack with the following command:
docker compose up -d
:::note If you have an access denied issue
docker login registry.forge.grandlyon.com
:::
Wait until the success message:
Everything is setup. Go to http://ecolyo.cozy.tools:8080/ To exit, press ^C
Once successful you can launch your local cozy with following url: Cozy local url. The password of this instance is set to "cozy" by default.
Local database can also be consulted at the following url: Cozy local DB
Import mock data
:::info Requirement Your dev stack should be running to import the mock data :::
:::info ACH
First install ACH using yarn :
yarn global add cozy-ach
:::note
If you cannot execute ACH
after this command, it may be because you do not have the directory where yarn stores its symbolic links in your PATH
. Edit it to append the result of yarn global bin
by executing the following command:
export PATH="$PATH:`yarn global bin`"
:::
Next create the "config.js" file based on the "config.template.js"
:::info You can change the period of data generated by changing the following lines:
const startingDate = DateTime.local()
// highlight-next-line
.plus({ days: -120 })
.startOf('day')
const endingDate = DateTime.local()
.plus({ days: -1 })
.startOf('day')
Just replace -120 by the value needed
:::
Next run the command
yarn data:seed
This script will run two others scripts :
-
yarn data:create
runningcreateDayDataFiles.ts
. Json files with data will be created intoscripts/data
folder. -
yarn data:import
runningimportData.sh
. ACH will load the content of the file into your CouchDB (database of your dev stack). Launch it using following commands:
:::note On Windows:
cd scripts
./importData.bat
:::
A new browser windows will open and asking you approval to import data. Just click on Approve
Finally your data is loaded in the Ecolyo Application !
Simulate konnectors connection
:::info Requirement Your dev stack should be running to import data needed to simulate konnectors connection :::
When using local environment, konnectors are not able to connect as in production.
First update the authorization and cookie information from the config.js
file (if not created just create it from the config.template.js
file):
const authorization = 'Bearer xxxxxxxxxxx';
const cookie = 'cozysessid=xxxxxxxxxxx';
To obtain your own Bearer and cozysessid you need to have the application launched and display the web console (F12) in your navigator and select the Network tab. Just select one request and retrieve information for Request Header:
To simulate the connection you can use the following script which will run createConnection.ts
.
yarn data:connections
Your data is now loaded and you can refresh the application to see your konnector connected.