Skip to content

Commit

Permalink
added userAdmin creation to READme
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack authored and ronaldsg20 committed May 25, 2023
1 parent 80f6591 commit d0d2ceb
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ 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**.

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
Expand All @@ -23,6 +23,7 @@ npm -version
node -v
v14.19.1
```

### Install dependencies

```sh
Expand All @@ -34,15 +35,19 @@ To only install resolved dependencies in `package-lock.json`:
```sh
npm ci
```

### Session DB

Move to the `SessionDB` folder and run:

```sh
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
```
Expand All @@ -53,20 +58,43 @@ 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
```

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
```
Expand All @@ -83,8 +111,11 @@ To automatically fix such issues:
npm run eslint:fix

```

## Deployment

In the root directory run:

```shell
docker-compose up
```
Expand All @@ -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)[email protected])](http://loopback.io/)
[![LoopBack](<https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)[email protected]>)](http://loopback.io/)

## Report Security Vulnerabilities

Expand Down

0 comments on commit d0d2ceb

Please sign in to comment.