Skip to content

Commit 42b79de

Browse files
committed
Doc updates, riscv static libgcc_s, changelog
1 parent fa95e77 commit 42b79de

18 files changed

+181
-80
lines changed

Diff for: CHANGELOG

+26
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
# v0.3.0 - July 17, 2024
2+
-----------------------------------
3+
4+
## Added
5+
6+
- Brotli compression support.
7+
- UPS beeper, UPS status and server connectivity indicators.
8+
- --poll-interval and partial update support to get critical variable updates more often.
9+
- Support for ARM-v6, ARM-v7, RISC-v64 and x86-64 micro-architecture levels.
10+
- Self-contained binary releases for non-container environments.
11+
12+
## Changed
13+
14+
- Container base image changed to busybox, image sizes are now ~5MiB smaller than 0.2.1.
15+
- Security updates for dependencies.
16+
- Switched to apexcharts.
17+
18+
## Fixed
19+
20+
- Gauge colors change correctly when theme changes.
21+
- Better theme initialization to prevent flashbang effect when page loaded.
22+
23+
## Deleted
24+
25+
- Lofi theme.
26+
127
# v0.2.1 - April 08, 2024
228
-----------------------------------
329

Diff for: Makefile

+11-11
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ $(call fn_output_path,x86-64-v4-musl) &: $(PROJECT_SRCS)
9191
@install -D $(call fn_target_path,x86_64-unknown-linux-musl/release) \
9292
$(call fn_output_path,x86-64-v4-musl)
9393

94-
# ARMv8
94+
# ARM64v8
9595

9696
.PHONY: build-aarch64-musl
9797
build-aarch64-musl: $(call fn_output_path,aarch64-musl) build-client
@@ -149,7 +149,7 @@ build-riscv64gc-gnu: $(call fn_output_path,riscv64gc-gnu) build-client
149149
$(call fn_output_path,riscv64gc-gnu) &: $(PROJECT_SRCS)
150150
@echo "Building for riscv64gc-unknown-linux-gnu"
151151
@cd ./server && \
152-
export RUSTFLAGS="-Clinker=riscv64-linux-gnu-gcc" && \
152+
export RUSTFLAGS="-Clinker=riscv64-linux-gnu-gcc -Ctarget-feature=+crt-static" && \
153153
cargo build --target=riscv64gc-unknown-linux-gnu --release
154154
@install -D $(call fn_target_path,riscv64gc-unknown-linux-gnu/release) \
155155
$(call fn_output_path,riscv64gc-gnu)
@@ -214,19 +214,19 @@ generate-dockerfiles:
214214
@echo "riscv64.Dockerfile"
215215
@sed -e 's/{BIN_DIR}/riscv64gc-gnu/g' \
216216
-e 's/{PLATFORM}/linux\/riscv64/g' \
217-
-e 's/{BUSYBOX_LABEL}/stable-glibc/g' \
217+
-e 's/{BUSYBOX_LABEL}/stable-musl/g' \
218218
"$(DOCKER_TEMPLATE)" > ./containers/riscv64.Dockerfile
219219
@echo "Generating annotation.conf"
220220
@CARGO_MANIFEST=$$(cargo read-manifest --manifest-path ./server/Cargo.toml); \
221221
echo "VERSION=\"$$(jq -r ".version" <<< "$${CARGO_MANIFEST}")\"" > ./containers/annotation.conf; \
222-
echo "HOME_URL=\"$$(jq -r ".homepage" <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
223-
echo "NAME=\"$$(jq -r ".name" <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
224-
echo "LICENSES=\"$$(jq -r ".license" <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
225-
echo "AUTHORS=\"$$(jq -r '.authors | join(" ")' <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
226-
echo "DOCUMENTATION=\"$$(jq -r ".documentation" <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
227-
echo "SOURCE=\"$$(jq -r ".repository" <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
228-
echo "DESCRIPTION=\"$$(jq -r ".description" <<< "$${CARGO_MANIFEST}")\"">> ./containers/annotation.conf; \
229-
echo "REVISION=\"$$(git rev-parse --verify HEAD)\"">> ./containers/annotation.conf;
222+
echo "HOME_URL=\"$$(jq -r ".homepage" <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
223+
echo "NAME=\"$$(jq -r ".name" <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
224+
echo "LICENSES=\"$$(jq -r ".license" <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
225+
echo "AUTHORS=\"$$(jq -r '.authors | join(" ")' <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
226+
echo "DOCUMENTATION=\"$$(jq -r ".documentation" <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
227+
echo "SOURCE=\"$$(jq -r ".repository" <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
228+
echo "DESCRIPTION=\"$$(jq -r ".description" <<< "$${CARGO_MANIFEST}")\"" >> ./containers/annotation.conf; \
229+
echo "REVISION=\"$$(git rev-parse --verify HEAD)\"" >> ./containers/annotation.conf;
230230

231231
.PHONY: clean
232232
clean:

Diff for: README.md

+47-32
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,71 @@
11
# NUT Web GUI
22

3-
[![version:0.2.1](https://img.shields.io/badge/version-0.2.1-red)](https://github.com/SuperioOne/nut_webgui/releases/tag/v0.2.1)
4-
[![version:0.2.1](https://img.shields.io/badge/linux/amd64-0.2.1-green)](https://github.com/SuperioOne/nut_webgui/pkgs/container/nut_webgui)
5-
[![version:0.2.1](https://img.shields.io/badge/linux/arm64-0.2.1-green)](https://github.com/SuperioOne/nut_webgui/pkgs/container/nut_webgui)
6-
7-
Web-based simple interface for [Network UPS Tools](https://networkupstools.org/).
3+
Light weight web interface for [Network UPS Tools](https://networkupstools.org/).
84

95
**Quickstart:**
106

117
```shell
12-
docker run --rm -e UPSD_ADDR=10.0.0.1 -e UPSD_USER=test -e UPSD_PASS=strongpass -p 9000:9000 ghcr.io/superioone/nut_webgui:latest
8+
docker run -e UPSD_ADDR=10.0.0.1 -e UPSD_USER=test -e UPSD_PASS=strongpass -p 9000:9000 ghcr.io/superioone/nut_webgui:latest
139
```
1410

1511
## Features
1612

17-
- Monitoring UPS variables with auto refresh.
18-
- List supported commands by UPS and allows INSTCMD calls from GUI.
19-
- Lightweight and small.
13+
- Monitors UPS variables with auto refresh.
14+
- Supports INSTCMD calls from GUI.
15+
- 🥔 Potato PC friendly. Small footprint on both resource usage and disk size.
16+
- Basic JSON API.
17+
- Supports RISC-V and older ARM devices.
2018

2119
> In order to run `INSTCMD`, make sure the configured user has proper instcmds granted at `upsd.users`. See
2220
> man([upsd.users](https://networkupstools.org/docs/man/upsd.users.html)).
2321
22+
## CPU architecture support
23+
24+
| Arch | Test Hardware | Notes |
25+
|--------------|-------------------------|------------------------------------------------------------------------------------------|
26+
| amd64 | AM4 | Works across all amd64 platforms. |
27+
| amd64-v3 | AM4 | Snake oil level optimizations with AVX. It mostly reduces response compression overhead. |
28+
| amd64-v4 | Not Tested | Snake oil level optimizations with AVX-512. |
29+
| arm64 | Raspberry Pi 4 Model B | |
30+
| armv7 | Qemu emulation | |
31+
| armv6 | Qemu emulation | |
32+
| riscv64 | Qemu emulation | |
33+
2434
![DetailImage](docs/images/details.webp)
2535

2636
![ListImage](docs/images/list.webp)
2737

2838
![INSTCMDImage](docs/images/inst_cmd.webp)
2939

30-
## Command-Line Arguments
40+
## Command-Line arguments
3141

32-
The following command-line arguments can be used to configure the application:
42+
* `--poll-freq`: UPS[pollfreq](https://networkupstools.org/docs/man/ups.conf.html#_global_directives) in seconds. Default is `30`.
43+
* `--poll-interval`: UPS [pollinterval](https://networkupstools.org/docs/man/ups.conf.html#_global_directives) in seconds. Default is `2`.
44+
* `--upsd-addr`: UPS daemon address. Default is `localhost`.
45+
* `--upsd-port`: UPS daemon port. Default is `3493`.
46+
* `--upsd-user`: UPS daemon username.
47+
* `--upsd-pass`: UPS daemon password.
48+
* `--listen`: Listen address for the HTTP server. Default is `0.0.0.0`.
49+
* `--port`: Port used by the HTTP server. Default is `9000`.
50+
* `--log-level`: Log level for the HTTP server. Default is `info`.
51+
* `--static-dir`: Directory path for static files. Default is `./static`.
3352

34-
* `--poll-freq`: Specify the poll frequency in seconds. Default is `10`.
35-
* `--upsd-addr`: Specify the UPS daemon address. Default is `localhost`.
36-
* `--upsd-port`: Specify the UPS daemon port. Default is `3493`.
37-
* `--upsd-user`: Specify the UPS daemon username.
38-
* `--upsd-pass`: Specify the UPS daemon password.
39-
* `--listen`: Specify the listen address for the HTTP server. Default is `0.0.0.0`.
40-
* `--port`: Specify the port used by the HTTP server. Default is `9000`.
41-
* `--log-level`: Specify the log level for the HTTP server. Default is `info`.
42-
* `--static-dir`: Specify the location of static css and js files served by the HTTP server. Default is `./static`.
53+
## Container image environment variables
4354

44-
## Container Image Environment Variables
55+
* `POLL_FREQ`: UPS [pollfreq](https://networkupstools.org/docs/man/ups.conf.html#_global_directives) in seconds. Default is `30`.
56+
* `POLL_INTERVAL`: UPS [pollinterval](https://networkupstools.org/docs/man/ups.conf.html#_global_directives) in seconds. Default is `2`.
57+
* `UPSD_ADDR`: UPS daemon address. Default is `localhost`.
58+
* `UPSD_PORT`: UPS daemon port. Default is `3493`.
59+
* `UPSD_USER`: UPS daemon username.
60+
* `UPSD_PASS`: UPS daemon password.
61+
* `LISTEN`: Listen address for the HTTP server. Default is `0.0.0.0`.
62+
* `PORT`: Port used by the HTTP server. Default is `9000`.
63+
* `LOG_LEVEL`: Log level. Default is `info`.
4564

46-
The following environment variables can be used to configure the application:
65+
> amd64 v3 and v4 variants require certain CPU feature flags to run. If you are a crackhead min-max enjoyer (like me), you can use `nut_webgui:latest-amd64-v3` and `nut_webgui:latest-amd64-v4` images.
66+
> See [x86-64 Microarchitecture levels](https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels) for more details.
4767
48-
* `POLL_FREQ`: Specify the poll frequency in seconds. Default is `10`.
49-
* `UPSD_ADDR`: Specify the UPS daemon address. Default is `localhost`.
50-
* `UPSD_PORT`: Specify the UPS daemon port. Default is `3493`.
51-
* `UPSD_USER`: Specify the UPS daemon username.
52-
* `UPSD_PASS`: Specify the UPS daemon password.
53-
* `LISTEN`: Specify the listen address for the HTTP server. Default is `0.0.0.0`.
54-
* `PORT`: Specify the port used by the HTTP server. Default is `9000`.
55-
* `LOG_LEVEL`: Specify the log level for the HTTP server. Default is `info`.
56-
57-
## JSON Data API
68+
## JSON data API
5869

5970
A simple JSON-based API is available for integration and automation purposes. For usage details
6071
see [JSON data API page.](./docs/json_api.md)
@@ -68,3 +79,7 @@ checks in your systems.
6879

6980
- [Kubernetes with EndpointSlice](docs/kubernetes_example.md)
7081
- [Docker compose](docs/docker_compose.md)
82+
83+
## Building from source and debugging
84+
85+
See [Building and Debugging.](./docs/building_debugging.md)

Diff for: build_images.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ for TARGET_FILE in ${DOCKER_FILES}; do
115115
echo -e "${C_Cy}Dockerfile ${TARGET_FILE}${RST}";
116116
echo -e "${C_Cy}Building ${_IMAGE_TAG}${RST}";
117117

118-
test "${DRY_RUN}" = "false" && \
118+
test "${DRY_RUN}" != "true" && \
119119
buildah build \
120120
--layers \
121121
--variant "${_ARCH_VARIANT}" \
@@ -169,8 +169,7 @@ for IMAGE in ${CREATED_IMAGES}; do
169169
echo -e "${C_Y}${IMAGE} added to ${MANIFEST_NAME}${RST}.";
170170
done;
171171

172-
if [[ "$PUBLISH" == "true" ]];
173-
then
172+
if [[ "$PUBLISH" == "true" ]]; then
174173
test "${DRY_RUN}" != "true" && \
175174
buildah login --tls-verify="${TLS_VERIFY}" "${REGISTRY}"
176175

Diff for: client/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"private": true,
77
"name": "nut_webgui-client",
8-
"version": "0.2.1",
8+
"version": "0.3.0",
99
"description": "Bundles all client side web components and dependencies.",
1010
"scripts": {
1111
"dev-js": "esbuild ./src/index.js --bundle --outdir=./dist/debug --target=firefox98,chrome86,safari15 --format=iife --watch=forever",
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"daisyui": "^4.12.10",
1919
"esbuild": "^0.23.0",
20-
"tailwindcss": "^3.4.4",
20+
"tailwindcss": "^3.4.6",
2121
"typescript": "^5.5.3"
2222
},
2323
"dependencies": {

Diff for: client/pnpm-lock.yaml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: containers/riscv64.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/riscv64 docker.io/busybox:stable-glibc
1+
FROM --platform=linux/riscv64 docker.io/busybox:stable-musl
22
RUN adduser -H -D -g "<nut_web>" nut_webgui
33
COPY --chmod=750 --chown=root:nut_webgui ./containers/server_start.sh /opt/nut_webgui/server_start.sh
44
COPY --chmod=750 --chown=root:nut_webgui ./bin/riscv64gc-gnu/nut_webgui /opt/nut_webgui/nut_webgui

Diff for: containers/server_start.sh

+9-8
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ BIN_LOCATION=/opt/nut_webgui/nut_webgui
44
STATIC_LOCATION=/opt/nut_webgui/static
55

66
exec "$BIN_LOCATION" --static-dir "$STATIC_LOCATION" \
7-
${LISTEN:+"--listen=$LISTEN"} \
8-
${PORT:+"--port=$PORT"} \
9-
${POLL_FREQ:+"--poll-freq=$POLL_FREQ"} \
10-
${UPSD_PORT:+"--upsd-port=$UPSD_PORT"} \
11-
${UPSD_ADDR:+"--upsd-addr=$UPSD_ADDR"} \
12-
${UPSD_USER:+"--upsd-user=$UPSD_USER"} \
13-
${UPSD_PASS:+"--upsd-pass=$UPSD_PASS"} \
14-
${LOG_LEVEL:+"--log-level=$LOG_LEVEL"}
7+
${LISTEN:+"--listen=$LISTEN"} \
8+
${PORT:+"--port=$PORT"} \
9+
${POLL_FREQ:+"--poll-freq=$POLL_FREQ"} \
10+
${POLL_INTERVAL:+"--poll-interval=$POLL_INTERVAL"} \
11+
${UPSD_PORT:+"--upsd-port=$UPSD_PORT"} \
12+
${UPSD_ADDR:+"--upsd-addr=$UPSD_ADDR"} \
13+
${UPSD_USER:+"--upsd-user=$UPSD_USER"} \
14+
${UPSD_PASS:+"--upsd-pass=$UPSD_PASS"} \
15+
${LOG_LEVEL:+"--log-level=$LOG_LEVEL"}

Diff for: docs/building_debugging.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Building code from source
2+
3+
## Linux:
4+
5+
### Requirements:
6+
Required host tools are:
7+
- make
8+
- cargo
9+
- node
10+
- pnpm
11+
- jq
12+
13+
Optionally, You need the following packages and Rust targets for cross-compilation.
14+
15+
Required packages:
16+
- riscv64-linux-gnu-gcc
17+
- aarch64-linux-gnu-gcc
18+
19+
Required Rust targets:
20+
- aarch64-unknown-linux-gnu
21+
- aarch64-unknown-linux-musl
22+
- arm-unknown-linux-musleabi
23+
- armv7-unknown-linux-musleabi
24+
- riscv64gc-unknown-linux-gnu
25+
- x86_64-unknown-linux-gnu
26+
- x86_64-unknown-linux-musl
27+
28+
### Building
29+
30+
```shell
31+
make build
32+
33+
# Output dirs ./bin/release/ and ./bin/static
34+
```
35+
or cross-compile everything (x86-64, ARM64-v8, ARM7, ARM6, RISC-V64)
36+
37+
```shell
38+
make build-all
39+
40+
# Output dirs ./bin/<target-name> and ./bin/static
41+
```
42+
43+
### Developing & Debugging
44+
45+
You can start front-end and back-end server via `./start_dev.sh`. It simply calls [`cargo-watch`](https://github.com/watchexec/cargo-watch), esbuild and tailwind.
46+
47+
```shell
48+
# Set your NUT server address
49+
export UPSD_ADDR="10.0.0.0"
50+
51+
# (Optional) set username and password for testing INST_CMD.
52+
export UPSD_USER="user_name"
53+
export UPSD_PASS="yo"
54+
55+
./start_dev.sh
56+
```
57+
58+
> Check available recipes inside the [Makefile](../Makefile).

Diff for: docs/docker_compose.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# External Host
44
```
5-
┌──────┐
5+
┌──────┐
66
│ UPS1 ├──┐ ┌─┐
77
└──────┘ │ Server A Server B │C│
88
│ ┌─────────────┐ ┌───────────┐ │L│
@@ -26,14 +26,15 @@ services:
2626
- 80:1234
2727
environment:
2828
POLL_FREQ: "60"
29+
POLL_INTERVAL: "5"
2930
UPSD_ADDR: "myhost"
3031
UPSD_PORT: "1234"
3132
UPSD_USER: "admin"
3233
UPSD_PASS: "test"
3334
LISTEN: "0.0.0.0"
3435
PORT: "1234"
3536
LOG_LEVEL: "debug"
36-
37+
3738
# Add other services, reverse proxy of your choice etc.
3839
```
3940

@@ -63,6 +64,7 @@ services:
6364
network_mode: host # Share same host
6465
environment:
6566
POLL_FREQ: "60"
67+
POLL_INTERVAL: "5"
6668
UPSD_ADDR: "localhost"
6769
UPSD_PORT: "3493"
6870
UPSD_USER: "admin"

Diff for: docs/images/details.webp

-5.29 KB
Binary file not shown.

Diff for: docs/images/inst_cmd.webp

1.23 KB
Binary file not shown.

Diff for: docs/images/list.webp

-730 Bytes
Binary file not shown.

Diff for: docs/kubernetes_example.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Kubernetes with EndpointSlice
1+
# Kubernetes with EndpointSlice
22

33
Example topology
44

0 commit comments

Comments
 (0)