Containerize services and add reverse proxy#12
Open
rensortino wants to merge 13 commits into
Open
Conversation
…tainer hostname
cpu_freq() returns None on some kernels (notably inside containers) and
crashed _asdict(); disk_info() reported nothing on bare-metal because
the function was hard-wired to /host_root; os.uname()[1] returned the
container hostname ("backend") instead of the host's; a bare except
swallowed everything in gpu_info(). Wrap the freq lookup, detect
/host_root vs bare-metal partitions, prefer HOST_HOSTNAME from the
environment, and narrow the except to Exception.
The frontend container is now both the static SPA server and the reverse proxy: nginx.conf moves into frontend/, the Dockerfile bakes it into the nginx:alpine stage, and the separate nginx service is dropped. Port 80 is published from the frontend service and routes /stat/ to the backend over the internal compose network — the backend container no longer exposes a host port. HOST_HOSTNAME is passed through so /stat reports the real host name. The frontend Dockerfile also moves from the EOL node:14.16.0 to node:20-alpine, which is required by Vite 6. config.json defaults to the same-origin proxied path, and the Makefile rebuild-frontend target is rewritten around docker compose (the previous version was an unfinished shell pipeline that did not work).
When config.json points at a same-origin path like "/stat/", the original regex required https?:// and threw, falling back to "[uknown address]". Use new URL(link, window.location.href) so relative links resolve to the proxy host and hostnames containing dashes also parse.
Adds a bar between Swap and the per-disk table that sums total/used across all reported partitions (skipping /boot, matching the existing table filter). On the docker deployment this reflects the host root plus any additional bind-mounted host paths the backend exposes.
Many of our hosts keep datasets and model checkpoints on a separate /data filesystem that doesn't show up under /host_root. Add a bind mount and probe /host_data alongside /host_root in disk_info(), so the aggregated disk bar reflects the real picture. When /data is absent on the host, docker creates an empty dir there and the bind resolves to the root filesystem — the backend compares st_dev against root and skips it to avoid double-counting.
Captures the two-tier architecture (each monitored host runs its own backend; the frontend polls the configured /stat URLs at runtime), the contract between /stat and App.vue, the compose layout, and the nginx pattern for adding LAN backends through a single port.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces Docker-based deployment for ServStat, for better portability and ease of configuration. It containerizes the backend and frontend, adds a
docker-compose.ymlfor orchestrating services, and updates the documentation to recommend Docker deployment. The backend container uses a CUDA-based image to allow for GPU monitoring and an Nginx reverse proxy is configured to route requests to the appropriate services.Dockerization and Deployment
docker-compose.ymlto define and orchestrate backend, frontend, and Nginx services, including GPU allocation for backend and custom networking.Makefilewith convenient targets for building, starting, stopping, and managing Docker services.backend/Dockerfileandfrontend/Dockerfilefor containerizing both backend and frontend applications.nginx.confto configure Nginx as a reverse proxy, routing/stat/API requests to backend and all other requests to frontend, with error handling and fallback messaging.Documentation Updates
README.mdto recommend Docker deployment, provide step-by-step Docker instructions, and clarify backend/frontend roles.Frontend Dependencies update