Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.68 KB

11_debugging.md

File metadata and controls

67 lines (48 loc) · 1.68 KB

Debugging

Clone the git repository.

git clone --recurse-submodules https://codeberg.org/SuperiorOne/nut_webgui.git

Important

--recurse-submodules flag is required for the UPS validation tests. It pulls NUT Device Dumps Library1 as a submodule, which contains known UPS device dumps.

Run server

  • Start with bacon: make watch can start the development server. It simply calls bacon -j serve2.

    # (Optional) Set your NUT test server configs.
    export NUTWG__CONFIG_FILE="test.config.toml"
    export NUTWG__LOG_LEVEL="trace"
    export NUTWG__UPSD__ADDRESS="10.0.0.1"
    export NUTWG__UPSD__USERNAME="cid"
    export NUTWG__UPSD__PASSWORD="i_am_atomic"
    
    make watch
  • or use cargo: cargo run -p nut_webgui

Tests

make test command runs all available tests.

Simulating UPS devices and NUT server with containers

A basic NUT server container image is available in the tools/dummy_server directory in the source code. It starts a NUT server, and automatically configures test devices.

Build container image:

cd ./tools/dummy_server
docker build -t dummy_server:latest -f dummy_server.Dockerfile

Start NUT server

docker run --rm -p 3493:3493 dummy_server:latest

(Optional) Start with custom device dump files

docker run --rm -p 3493:3493 -v \
"$(pwd)/example-devices":/nut_devices dummy_server:latest

Testing TLS

The dummy server is configured with a self-signed certificate. The root certificate is available at tools/dummy_server/root.crt.

Footnotes

  1. Github - networkupstools/nut-ddl ↩

  2. Github - Canop/bacon ↩