Skip to main content

Getting started

This section will allow you to launch a proper local environment of the Ecolyo application

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
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

Requirement

Your dev stack should be running to import the mock data

First install ACH using yarn :

yarn global add cozy-ach

Next create the "config.js" file based on the "config.template.js"

You can change the period of data generated by changing the following lines:
config.js
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

Next launch the script createDayDataFiles.js available into the scripts folder

cd scripts
node createDayDataFiles.js

Json files with data will be created into scripts/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:

On Windows:

cd scripts
./importData.bat

On Linux:

cd scripts
./importData.sh
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`"

You'll be prompted for a cozysessid, you can get it in the web console : in the application tab, look for the cookies and just copy the cozysessid value.

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

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. To simulate the connection you can use the script createConnection.js available in scripts folder.

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:

Bearer&cozysessid

Next launch the script :

node scripts/createConnections.js

Your data is now loaded and you can refresh the application to see your konnector connected.