diff --git a/README.md b/README.md index 97c3490d..fd7fb98d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ This is the API component for 2-Way-Peg solution. The solution will be a web interface, which integrates with a **Rest API (this application)**, which in turn communicates with internal services such as the blockchain node and databases. In addition, a daemon/worker will be created that will be responsible for obtaining data from the blockchain and changing the status of the transaction. - ## Development Mode The **2wp-api** application will run on **3000 port**. @@ -14,6 +13,7 @@ The **2wp-api** application will run on **3000 port**. Include a .env file with the required environment variables listed in `.env.test` file (you can copy that file). ### Check npm and node versions + ```sh npm -version 6.14.16 @@ -23,6 +23,7 @@ npm -version node -v v14.19.1 ``` + ### Install dependencies ```sh @@ -34,7 +35,9 @@ To only install resolved dependencies in `package-lock.json`: ```sh npm ci ``` + ### Session DB + Move to the `SessionDB` folder and run: ```sh @@ -42,7 +45,9 @@ docker-compose up -d ``` ### RSK DB + Move to the `rsk-database` folder, copy your `.env` file in it and then run: + ```sh docker-compose up -d ``` @@ -53,13 +58,35 @@ For some reason passing `--env-file` argument to docker-compose doesn't seem to To verify all environment variables, please click [here](./ENV_VARIABLES.md) for environment variables details. +## Create user with admin permissions to connect without errors to mongoDB + +To connect without authentication errors to mongodb, in root directory run: + +``` +$ docker exec -it 2wp-rsk-mongo-database bash +$ mongosh +$ use rsk +$ db.createUser( + { + user: "api-user", + pwd: "pwd", + roles: [ + { role: "userAdmin" , db:"rsk" } + ] + } + ) +``` + ## Using npm to run the application + If you want to start the API alongside the daemon run: + ```sh npm start ``` If you prefer to execute just the API run: + ```sh npm run start-api ``` @@ -67,6 +94,7 @@ npm run start-api Open http://127.0.0.1:3000 in your browser to discover the API capabilities If you prefer to execute just the daemon run: + ```sh npm run start-daemon ``` @@ -83,8 +111,11 @@ To automatically fix such issues: npm run eslint:fix ``` + ## Deployment + In the root directory run: + ```shell docker-compose up ``` @@ -99,7 +130,7 @@ docker-compose up npm run test ``` -[![LoopBack](https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png)](http://loopback.io/) +[![LoopBack]()](http://loopback.io/) ## Report Security Vulnerabilities