1.54.0 • Published 5 days ago

asset_monitoring_app_server v1.54.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 days ago

Asset Monitoring Application Service

This repository contains the source code for the server configuration and setup for the IMI Asset Monitoring Application Server. The server listens on a port 4000.

The Asset Monitoring platform aims to leverage IoT device sensors on IMI's flow control products for near real-time monitoring and predictive maintenance. By shifting from reactive to proactive methods, utilizing sensor data, it provides timely insights and alarms, anticipating system failures and optimizing maintenance schedules. This enhances system efficiency and longevity while ensuring accessible information for all users.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Before we get started, we're going to need to make sure we have a few things installed and available on our machine.

Node >= 18.18.0

Minimum

MacOS
curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/"

Other

See the installation guides available @ nodejs.org:

https://nodejs.org/en/download/package-manager/

Docker

Docker installed on your system. If you haven't installed Docker yet, you can download and install it from the official Docker website: https://www.docker.com/get-started

Docker Compose (MacOS)

brew install docker-compose

Starting the local database environment

cd prisma/local && docker-compose up -d

Ensure your container is up and running. List the containers to get the port

docker-compose ps

will log:

NAME          IMAGE                 COMMAND                 SERVICE
xx-database   postgres:13-alpine   "docker-entrypoint.s…"   database   xx minutes ago   Up xx minutes   0.0.0.0:65491->5432/tcp

Check the container's IP address, run:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <NAME>

this will be the HOST value on your DATABASE_URL.

Check the container 's Port number, run:

docker inspect -f '{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{$conf}} {{end}}' <NAME>

this will be the PORT value on your DATABASE_URL.

Add the postgres connection URL to the environment variable DATABASE_URL with the format specified in the .env.example

postgresql://USER:PASSWORD@HOST:PORT/DATABASE

Generate Prisma

npm run db:migrate
npm run db:generate
npm run db:seed
npm run db:studio

Installing

Below is a series of step by step instructions that tell you how to get a development env running.

Create a local clone of the repository

git clone https://imicci@dev.azure.com/imicci/Asset_Monitoring_Project/_git/AM-APP-SERVER

Enter the cloned repositories' directory

cd AM-APP-SERVER

Install the projects dependencies

npm i

Create a .env file based on the .env.example template (at the time of writing, no additional env vars are required)

Export the contents of the created .env file to the current terminal session.

set -o allexport; source .env; set +o allexport

Start the projects development server

npm run start

The project should now be available at http://localhost:4000

Tests

To run the projects unit test simply navigate into the projects root directory.

Then run:

npm run test

The test results should appear in your terminal.

Deployment

Deployments are handled by Azure pipelines, below is an overview of how the deployments work:

  1. Dependencies are installed with npm i
  2. Unit tests are run with npm run test
  3. Application is built npm run build
  4. Static assets are deployed to Amazon S3 and the cloudfront distribution cache is invalidated.

Environment Variables

These are the environment variables required to successfully deploy the application.

Repository Variables

keydescription
API_BASE_URLBase URL for the API
ENVIRONMENTEnvironment of the application
PORTPort number for the application
LORIAT_API_KEYAPI key for LORIAT integration
LORIAT_API_URLURL for LORIAT API
DATABASE_URLURL for the database connection
SSL_CERT_BASE64Base64 encoded SSL certificate
NO_REPLY_DOMAINDomain used for no-reply emails
COMMUNICATION_SERVICES_CONNECTION_STRINGConnection string for communication services

Deployment Variables

Each of the below keys need to be applied to each deployment (dev, uat, prod) and their values will be dependant on the environment.

keydescription
API_BASE_URLBase URL for the API
ENVIRONMENTEnvironment of the application
PORTPort number for the application
LORIAT_API_KEYAPI key for LORIAT integration
LORIAT_API_URLURL for LORIAT API
DATABASE_URLURL for the database connection
SSL_CERT_BASE64Base64 encoded SSL certificate
NO_REPLY_DOMAINDomain used for no-reply emails
COMMUNICATION_SERVICES_CONNECTION_STRINGConnection string for communication services

Built With

Details of the tech stack that has been used.

Structure

Contributing

Please read CONTRIBUTING.md for details on the SovTech standard for commit messages and the accepted pull request process.

Versioning

We use SemVer for versioning. Versioning occurs automatically in the pipelines using Semantic Release. For the versions available, see the tags on this repository.

TODO: Implement SemVer

Changelog

A running changelog can be found here: CHANGELOG.md

Licenses

Place the result of npx license-checker --summary here

├─ MIT: 457
├─ ISC: 13
├─ Apache-2.0: 7
├─ BSD-3-Clause: 6
├─ BSD-2-Clause: 4
├─ 0BSD: 2
├─ UNLICENSED: 1
├─ CC-BY-4.0: 1
└─ BSD: 1

Troubleshooting

Below are a few common issues users experience - including an overview of their possible cause and solutions.

Meta

VersionAuthorDate
0.0.1Yatin Badal yatin@sovtech.com17/03/2020
0.0.2Daniel Harten daniel@sovtech.com15/06/2022
0.0.3Daniel Harten daniel@sovtech.com31/05/2023
0.0.4Kuda Mhizha kudakwaishe.mhizha@sovtech.com24/05/2024
1.53.0

10 days ago

1.54.0

5 days ago

1.51.0

25 days ago

1.51.1

24 days ago

1.49.5

26 days ago

1.50.1

25 days ago

1.50.0

26 days ago

1.52.0

23 days ago

1.49.3

29 days ago

1.49.4

29 days ago

1.48.4

1 month ago

1.48.3

1 month ago

1.49.1

29 days ago

1.49.0

1 month ago

1.49.2

29 days ago

1.48.2

1 month ago

1.48.1

1 month ago

1.48.0

1 month ago

1.47.2

1 month ago

1.47.1

1 month ago

1.47.0

1 month ago

1.42.0

2 months ago

1.40.2

2 months ago

1.44.0

2 months ago

1.46.0

1 month ago

1.41.1

2 months ago

1.41.0

2 months ago

1.43.0

2 months ago

1.45.0

1 month ago

1.35.1

3 months ago

1.37.0

2 months ago

1.35.2

3 months ago

1.35.0

3 months ago

1.39.1

2 months ago

1.39.2

2 months ago

1.39.0

2 months ago

1.40.0

2 months ago

1.40.1

2 months ago

1.36.0

3 months ago

1.36.1

2 months ago

1.36.4

2 months ago

1.36.5

2 months ago

1.38.0

2 months ago

1.36.2

2 months ago

1.38.1

2 months ago

1.36.3

2 months ago

1.36.6

2 months ago

1.34.0

3 months ago

1.33.1

3 months ago

1.33.0

3 months ago

1.32.0

3 months ago

1.29.0

3 months ago

1.29.1

3 months ago

1.30.0

3 months ago

1.31.0

3 months ago

1.28.0

4 months ago

1.25.0

4 months ago

1.26.0

4 months ago

1.27.0

4 months ago

1.24.0

4 months ago

1.22.3

4 months ago

1.23.0

4 months ago

1.22.2

4 months ago

1.15.0

5 months ago

1.14.0

5 months ago

1.13.0

5 months ago

1.12.0

5 months ago

1.19.0

4 months ago

1.18.0

4 months ago

1.17.0

5 months ago

1.16.0

5 months ago

1.15.1

5 months ago

1.9.1

5 months ago

1.9.0

5 months ago

1.8.0

5 months ago

1.7.0

5 months ago

1.6.0

5 months ago

1.5.0

5 months ago

1.4.0

5 months ago

1.21.0

4 months ago

1.22.0

4 months ago

1.20.0

4 months ago

1.22.1

4 months ago

1.9.3

5 months ago

1.9.2

5 months ago

1.11.0

5 months ago

1.10.0

5 months ago

1.3.1

5 months ago

1.3.0

5 months ago

1.2.0

6 months ago

1.1.0

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago