-
Notifications
You must be signed in to change notification settings - Fork 18
Initial web management interface #1457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9febc77
fe5431f
f93ee7c
6f091d8
d393c16
ad7e1e9
293ed3e
066c8a7
366517a
6fb0032
da18d72
cc7cebd
5779888
b9c034b
d458ae0
fe9c346
545299e
aad9e06
8a9004e
ef2618c
5f09c9f
7bafd82
4fc6906
5973a34
46cab28
983e28c
a91c085
b7e4505
6433bae
7350785
eaafa18
7047522
e147286
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| RESTCONF_URL=https://127.0.0.1/restconf | ||
| INSECURE_TLS=1 | ||
| # Spool firmware uploads (and any other temp files) to the eMMC-backed /var/tmp | ||
| # instead of the RAM-backed /tmp — a 160 MB .pkg upload otherwise OOM-kills us. | ||
| TMPDIR=/var/tmp | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../restconf.app |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this was
then we would not have to duplicate the contents of this file in |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| allow 127.0.0.1; | ||
| allow ::1; | ||
| deny all; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,6 +144,7 @@ BR2_PACKAGE_FIREWALL=y | |
| BR2_PACKAGE_IITO=y | ||
| BR2_PACKAGE_KEYACK=y | ||
| BR2_PACKAGE_KLISH_PLUGIN_INFIX=y | ||
| BR2_PACKAGE_LANDING=y | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does |
||
| BR2_PACKAGE_LOWDOWN=y | ||
| BR2_PACKAGE_MCD=y | ||
| BR2_PACKAGE_MDNS_ALIAS=y | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Loading…</title> | ||
| <meta charset="utf-8"> | ||
| <meta http-equiv="refresh" content="3"> | ||
| <style> | ||
| html { color-scheme: light dark; font-family: Tahoma, Verdana, Arial, sans-serif; } | ||
| body { max-width: 32em; margin: 4em auto; text-align: center; } | ||
| h1 { font-weight: 500; margin-bottom: 0.5em; } | ||
| p { color: #888; margin: 0.5em 0; } | ||
| .spinner { | ||
| display: inline-block; | ||
| width: 1.5em; | ||
| height: 1.5em; | ||
| margin-top: 1em; | ||
| border: 3px solid currentColor; | ||
| border-top-color: transparent; | ||
| border-radius: 50%; | ||
| animation: rot 1s linear infinite; | ||
| } | ||
| @keyframes rot { to { transform: rotate(360deg); } } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>Loading…</h1> | ||
| <p>The device is finishing its startup. This page refreshes automatically.</p> | ||
| <p><span class="spinner" aria-hidden="true"></span></p> | ||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| config BR2_PACKAGE_WEBUI | ||
| bool "webui" | ||
| depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS | ||
| depends on BR2_PACKAGE_ROUSETTE | ||
| depends on !BR2_PACKAGE_LANDING | ||
| help | ||
| Web management interface for Infix, a Go+HTMX application | ||
| that provides browser-based configuration and monitoring | ||
| via RESTCONF. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| server { | ||
| listen 80; | ||
| listen [::]:80; | ||
| server_name _; | ||
| return 301 https://$host$request_uri; | ||
| } | ||
|
|
||
| server { | ||
| listen 443 ssl; | ||
| listen [::]:443 ssl; | ||
| server_name _; | ||
| include ssl.conf; | ||
|
|
||
| # 404 also points at /50x.html: the page is a "Loading…" screen | ||
| # with a meta-refresh, so the early-boot window where the Go | ||
| # backend isn't up yet (and any other transient 404 / 5xx) self- | ||
| # recovers as soon as upstream comes back. | ||
| error_page 404 500 502 503 504 /50x.html; | ||
| location = /50x.html { | ||
| root html; | ||
| } | ||
|
|
||
| include /etc/nginx/app/*.conf; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Shared proxy-pass shape for the webui upstream. Included from every | ||
| # location in webui.conf that forwards to the Go app so we don't have to | ||
| # restate the header block when nested locations declare their own | ||
| # proxy_* directives (which suppresses inheritance from the outer block). | ||
|
|
||
| proxy_pass http://127.0.0.1:10000; | ||
| proxy_http_version 1.1; | ||
| proxy_set_header Host $host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| proxy_redirect off; |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lots of the information in these comments feels like Claude justifying its decisions. That is great information to have, but to me it feels like it belongs in the Git log 🤷♂️ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # 256 MiB covers current and near-future firmware images (the aarch64 | ||
| # .pkg is ~160 MiB today) without setting an alarming body-size cap on | ||
| # devices that may only have 512 MiB of RAM. nginx is the single source | ||
| # of truth for the upload ceiling. | ||
| # | ||
| # Set at server scope (top of file) rather than once on an outer | ||
| # `location /` with a nested inner location: nginx inheritance of | ||
| # client_max_body_size into a nested location that declares its own | ||
| # `proxy_pass` block has bitten us before, silently falling back to | ||
| # the http-level default of 1m and rejecting 160 MiB firmware uploads | ||
| # with 413. | ||
| client_max_body_size 256m; | ||
|
|
||
| location / { | ||
| include /etc/nginx/webui-proxy.conf; | ||
| } | ||
|
|
||
| location = /firmware/upload { | ||
| # Body is buffered by nginx (to /var/cache/nginx/client-body, ext4 | ||
| # on eMMC, with 16 KB RAM cap before spill) before forwarding to | ||
| # Go. The extra disk pass on a 160 MiB upload is ~30s on eMMC; in | ||
| # exchange Go gets a complete, well-formed request with a known | ||
| # Content-Length. The previous setup used `proxy_request_buffering | ||
| # off` to stream the body straight through and avoid the double | ||
| # write, but that raced the response write with the body forward: | ||
| # net/http EOFs the body reader at Content-Length, then closes the | ||
| # socket, but with streaming the multipart trailer can still be in | ||
| # the kernel receive buffer, so close() sends RST instead of FIN | ||
| # and nginx serves /50x.html to the client. | ||
| proxy_read_timeout 600s; | ||
| include /etc/nginx/webui-proxy.conf; | ||
| } | ||
|
|
||
| # Liveness probe served by nginx itself — no upstream call, no log line. | ||
| # Used by the watchdog div in base.html and the reboot-overlay poller. | ||
| location = /device-status { | ||
| access_log off; | ||
| return 204; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ################################################################################ | ||
| # | ||
| # webui | ||
| # | ||
| ################################################################################ | ||
|
|
||
| WEBUI_VERSION = 1.0 | ||
| WEBUI_SITE_METHOD = local | ||
| WEBUI_SITE = $(BR2_EXTERNAL_INFIX_PATH)/src/webui | ||
| WEBUI_GOMOD = github.com/kernelkit/webui | ||
| WEBUI_LICENSE = MIT | ||
| WEBUI_LICENSE_FILES = LICENSE | ||
| WEBUI_REDISTRIBUTE = NO | ||
|
|
||
| define WEBUI_INSTALL_EXTRA | ||
| $(INSTALL) -D -m 0644 $(WEBUI_PKGDIR)/webui.svc \ | ||
| $(FINIT_D)/available/webui.conf | ||
| $(INSTALL) -D -m 0644 $(WEBUI_PKGDIR)/webui.conf \ | ||
| $(TARGET_DIR)/etc/nginx/app/webui.conf | ||
| $(INSTALL) -D -m 0644 $(WEBUI_PKGDIR)/webui-proxy.conf \ | ||
| $(TARGET_DIR)/etc/nginx/webui-proxy.conf | ||
| $(INSTALL) -D -m 0644 $(WEBUI_PKGDIR)/default.conf \ | ||
| $(TARGET_DIR)/etc/nginx/available/default.conf | ||
| $(INSTALL) -D -m 0644 $(WEBUI_PKGDIR)/50x.html \ | ||
| $(TARGET_DIR)/usr/html/50x.html | ||
| endef | ||
| WEBUI_POST_INSTALL_TARGET_HOOKS += WEBUI_INSTALL_EXTRA | ||
|
|
||
| $(eval $(golang-package)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| service <!> name:webui log:prio:daemon.info,tag:webui \ | ||
| [2345] env:-/etc/default/webui webui -listen 127.0.0.1:10000 \ | ||
| -- Web management interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit, but in general: think we should avoid referencing technologies, sizes, etc., that might quickly become outdated and confuse the reader.