Network-Monitor is an application developed using Nest.js and Ookla SpeedTest CLI designed to perform routine Internet stability tests for monitoring purposes.
- Install Ookla SpeedTest CLI by following instructions on Ookla SpeedTest CLI page.
- Install required dependencies using NPM package manager.
npm install
Adjust application settings by editing .env
or .env.local
file (.env.local
overrides .env
).
Name | Default | Description |
---|---|---|
NODE_ENV |
production |
Application environment: development or production . |
APP_PORT |
3000 |
Application port. |
MYSQL_HOST |
MySQL database host. | |
MYSQL_PORT |
MySQL database port. | |
MYSQL_DATABASE |
network-monitor |
MySQL database name. |
MYSQL_USER |
network-monitor |
MySQL database user. |
MYSQL_PASSWORD |
network-monitor |
Password for MySQL database user. |
DATABASE_SYNC_ENABLED |
true |
Determines whether to perform database updates based on defined entities. |
SPEEDTEST_CLI_ARGS |
Additional arguments to Ookla SpeedTest CLI. |
Option DATABASE_SYNC_ENABLED is set to true by default, which allows the application to generate an initial database structure based on defined entities. Option should be set to false after the first launch to avoid any potential data loss. |
Option SPEEDTEST_CLI_ARGS can be used to include additional arguments in command that is executed during each speed test. Note that the -f, -format argument is overridden by default to maintain proper application operation. |
Ensure that all necessary dependencies are installed and the application is configured correctly before launching the application.
Start the application in appropriate mode:
# Production mode
npm run start:prod
# Development mode
npm run start:dev
Once started, the application will perform speed tests in 5-minute cycles.
Go to 127.0.0.1:3000
in your web browser to see summary generated from collected data.
Docker configuration, automatically installs all necessary dependencies, simplifying process of application deployment in any environment.
Start the container with the appropriate profile:
# Production mode
npm run start:docker:prod
# Development mode
npm run start:docker:dev
Commands above are abbreviations for the docker compose cli commands
# Production mode
docker compose --profile production up -d --build
# Development mode
docker compose --profile development up --build
Once started, the application will perform speed tests in 5-minute cycles.
Go to 127.0.0.1:3000
in your web browser to see summary generated from collected data.
Environment variables MYSQL_HOST and MYSQL_PORT are overridden by the docker-compose.yaml file inside app container to ensure a proper connection to the database. |