npm install- Log in to your mongodb account on atlas
- Create a database named something like lsdbackend or whatever you prefer.
- Create a
.envfile in the root of the project and insert your connection string like this:
CONNECTION_STRING=your production connection string with credentials
TEST_CONNECTION_STRING=your development connection string with credentials
# Remember not to use space separation
# - and that the connection strings cannot be identical.- Populate the production database by running:
npm run populatenpm run testThe application uses Remote Procedure Call (RPC) to connect with the frontend application.
It listens on localhost:3000
When the application is running the monitor is reachable on localhost:3000/status
Logs is located at logs/error.log and logs/info.log in the root folder.
npm run startThe Service Level Agreement can be found here
A figure of our brancing strategy can be found here
....
- Download the repository.
- In the root of the project, make a
bash .envfile. - Insert into the .env file:
NODE_ENV=development
RPC_HOST=http://localhost:3000/
PORT=4000- In terminal
yarn install- In terminal
yarn add TEAM-B-SOFT2020/LSDContractyarn testRun application
If you have docker installed, you can run everything using the following command:
yarn monitor (Takes a few seconds)The prometheus.yml file is configured to install a docker image of the application and run grafana service.
You can now open the application on port :4000
http://localhost:4000 - for application http://localhost:4000/api - for APIAlternatively you can run the application without monitoring:
yarn devWhen the application is running. We log both errors and information about data retrival and input. In the logger.ts file we specify two text files to store logs. The text files are saved in './logs/errors.log' and './logs/info.logs' The loggers are defined by levels 'level: 'error'' for erros and 'level: 'info'' for general info.
If you ran the application using the docker image, you have access to the prometheus monitor Dashboard.
http://localhost:3000 - for grafana - You will be presented with a login screen - create a user, and login.
- Then navigate to Configuration (cogwheel) > Data Sources > Add Data Source (Big green button).
- In 'Settings':
- Set URL to 'http://localhost:9090'
- Set Access to 'Browser'
- Next to 'Settings' click 'Dashboards' and select 'Prometheus 2.0 Stats'
- Navigate to the 'Dashboard'(four squares) in the left navigation bar > Manage > Select 'Prometheus 2.0 Stats'
- Now bask in its glory.
....