-
Notifications
You must be signed in to change notification settings - Fork 60
Origin Deployment
Machine should have at least following resources available:
- 30 GB disk space
- 4GB RAM
- 2 cores CPU
Currently this corresponds to AWS t2.medium instance.
Please make sure you have installed:
- Git
- Python 2
- NodeJS 10, NPM
- Yarn
- Docker
- Docker Compose
To use UI you also need MetaMask installed.
On Ubuntu you can install Docker using: sudo snap install docker and then sudo chmod 666 /var/run/docker.sock.
git clone https://github.com/energywebfoundation/ewf-monorepo.git
yarn
yarn build
Create a .env file in the root of the monorepo and set all the necessary variables.
You can find an example here: .env.example
- Set
WEB3to the Web3.js provider URL (RPC Server). - Set
BACKEND_URLto HOST:3030. - We will fill
ASSET_CONTRACT_LOOKUP_ADDRESSandMARKET_CONTRACT_ADDRESSlater to reflect contract addresses from Step 2. Demo - contracts deployment
where HOST is for example http://localhost or http://<yourdomain.com>, or some other address of your machine.
If you plan to use localhost:8545 or any local blockchain (instead of Volta RPC or production chain), please make sure to start it first:
yarn run:ganache
yarn run:backend
From now on API should be running on following address: HOST:3030
Deploy contracts:
yarn run:demo
Run frontend:
docker-compose down -v
docker-compose up -d --build
Now you should be able to access frontend on URL: HOST
Having frontend deployed and MarketContractLookup address from deploying demo we need to combine these two together.
First, make sure you have correct RPC set in MetaMask. For example, if you deployed contracts to Volta, in MetaMask add and use RPC: https://volta-rpc.energyweb.org.
Now, in your browser open your domain URL: http://<yourdomain.com>.
Here, we have 2 services to start: simulation and consumer. Consumer has to be able to access simulation port. It sends HTTP requests to simulation. By default simulation is ran on 3031 port.
Set ENERGY_API_BASE_URL="http://localhost:3031" in .env.
Start simulation:
run:simulator:server
Start consumer:
yarn run:simulator:consumer
Set the optional variables from .env.example to your .env file.
Start:
yarn run:event-listener
If you have already started docker container and then modify src files of any package then you might need to rebuild them and recreate Docker volumes to have updated docker container. In this case run:
yarn build
docker-compose down -v
docker-compose build
before running docker-compose up command.