-
Notifications
You must be signed in to change notification settings - Fork 58
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 12, 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/origin.git
yarn
yarn build
- Install Postgres and create a clean new database named
origin
. Make sure that you have a user namedpostgres
with a passwordpostgres
. - Make sure you have created a
.env
file in the root of the monorepo and that all necessary variables are set. Use .env.example as an example of how the.env
file should look.
- Set
WEB3
to the Web3.js provider URL (RPC Server). - Set
BACKEND_URL
to HOST:3030.
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 migrate:demo
Note: This will overwrite any DB changes you have and deploy new smart contracts. If you're using it in a production environment, run this instead:
yarn migrate:prod
yarn run:backend
From now on API should be running on following address: HOST:3030
Run frontend:
docker-compose down -v
docker-compose up -d --build
Now you should be able to access frontend on URL: HOST
Having frontend service started and contracts deployed we can test the application.
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
. If you've used http://localhost:8545
, use http://localhost:8545
in MetaMask and so on.
Now, in your browser open your domain URL: http://<yourdomain.com>
.
Set ENERGY_API_BASE_URL="http://localhost:3031"
in .env
.
Start simulator:
yarn run:simulator
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.
git clone [email protected]:energywebfoundation/origin.git
mv docker-compose.yml docker-compose.old.yml
mv docker-compose.collective.yml docker-compose.yml
yarn
Copy .env.example
to .env
and set ORM_DATABASE_DOCKER=TRUE
.
If you want to use local Ganache network then start it, for example with command:
yarn run:ganache # Skip if using other chain, but change .env WEB3 property
When your WEB3 endpoint is up and running, run these commands:
yarn build
TAG=canary ./origin-docker-run.sh
yarn run:demo