Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

energywebfoundation/drec-origin

Repository files navigation

⚠️ IMPORTANT NOTE

This repository is deprecated. Work on the D-REC platform is continued here.

Background:

With the creation of the D-REC Initiative, a dedicated Github organisation was created https://github.com/d-rec. The D-REC platform was forked and development continued under the new organisation.

Further information:



EnergyWeb
EnergyWeb Origin - DREC

Repository for Origin DREC project

How to use

Install rush, pnpm if you don't have it:

npm i -g @microsoft/rush
npm i -g pnpm
rush install
rush build

Copy .env.example to .env and adjust .env with your environment specific parameters.

Start Postgres instance

docker pull postgres
docker run --name origin-postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres

Create Postgres DB table

psql -h localhost -p 5432 -U postgres -c "CREATE DATABASE origin"

Create InfluxDB to store smart meter readings

docker run --rm --env-file ./.env -v $PWD/influxdb-local:/var/lib/influxdb influxdb:1.8 /init-influxdb.sh

Run the InfluxDB instance

docker run --name energy-influxdb --env-file ./.env -d -p 8086:8086 -v $PWD/influxdb-local:/var/lib/influxdb -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro influxdb:1.8

Create and start a Redis instance

docker pull redis
docker run --name origin-redis -d -p 6379:6379 redis

Run UI and API projects

rush start:dev

You may also want to drop local databases with

rush drop

Heroku deployment script

This repo has a script for easy Heroku deployments for UI And API project. Script assumes that Heroku applications are already created and Postgres DB is provisioned.

HEROKU_API_KEY=<APIKEY> HEROKU_STABLE_APP_API=<APP_NAME> HEROKU_STABLE_APP_UI=<APP_NAME> rush deploy:heroku

When starting containers and running the app rush start:dev (it immediately starts API and UI servers, which are accessible at ports that have to be mapped:

Application Port
UI $PORT
API 3040

D-REC Integrators:

How to use

Go inside integrators-scripts folder Create a .env, copy everything from .env.example and change the necessary variables depending on the environment

npm i
npm run start

Before running the script, make sure:

  1. You have updated the DREC_BACKEND_URL in .env with local or heroku - also update the username and password for each integrator
  2. Post generated devices to Server - Bulk Devices
  3. You updated DREC_USERNAME & DREC_PASSWORD with the Owner credentials based on the integrator (Okra, BBOX, Engie etc.)
  4. The methods in index.js should run independently. After each step, comment the completed step, uncomment the next step and restart the server

Releases

No releases published

Packages

No packages published