Skip to content

Latest commit

 

History

History
118 lines (85 loc) · 2.94 KB

File metadata and controls

118 lines (85 loc) · 2.94 KB

Building from source

Linux:

Requirements:

Required host tools are:

  • make
  • cargo
  • rust 1.95
  • node
  • pnpm or npm
  • jq
  • coreutils/uutils, GNU gettext utilities

Optionally, host system should have gcc packages and Rust targets for cross-compilation.

Required packages:

  • riscv64-linux-gnu-gcc (RISC-V64)
  • aarch64-linux-gnu-gcc (AARCH64)
  • clang (ARMv6, ARMv7)

Package names may differ between different distros.

Required Rust targets:

  • aarch64-unknown-linux-gnu
  • aarch64-unknown-linux-musl
  • arm-unknown-linux-musleabi
  • armv7-unknown-linux-musleabi
  • riscv64gc-unknown-linux-gnu
  • x86_64-unknown-linux-gnu
  • x86_64-unknown-linux-musl

Multi-Arch Container Images:

  • Qemu emulators for each target architecture.
  • Any OCI compliant image building tool of your choice (Buildah, Docker, Podman).

Building binaries

To list all available recipes, use make help.

make build

# Output location ./bin/release/

or cross-compile everything (x86-64, AARCH64, ARMv7, ARMv6, RISC-V64)

make build-all

# Output location ./bin/<target-name>

Generating dockerfiles

make gen-dockerfiles
# Output location ./bin/dockerfiles

Development and testing

  1. Clone the git repository.

    git clone --recurse-submodules https://github.com/SuperioOne/nut_webgui.git

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

  2. Run server

    • Start with bacon:

      make watch can start development server. It simply calls bacon -j serve.

      # (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 simply 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 at tools/dummy_server directory. It starts a NUT server, and automatically configures dummy UPS 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

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