Server: serve the built panel from the server binary and the container image #114

Closed
opened 2026-11-10 17:08:35 +00:00 by vivy · 5 comments
Owner

Blocks MVP acceptance #29 (product owner test week from 11-20).

What

plan/operations/deployment.md section 3 says "the panel is served by the same binary, at the same address". On dev (6554d98) it is not:

  • crates/server has no static or fallback route (no ServeDir, no embedded assets, no index.html fallback).
  • packaging/server/Dockerfile never builds frontend-web, so the image holds no panel at all.

So https://signage.example.org/ gives no setup screen after a fresh install.

Done when

  • The server serves the frontend-web build at /, with an SPA fallback to index.html for non-/api and non-WebSocket paths. Embedding at build time or a configured asset directory: server engineer's call, written in the PR.
  • The Docker image and the systemd path both include the panel; Node version from .nvmrc.
  • An integration test: GET / answers text/html, GET /api/v1/setup/status still answers JSON.
  • After docker compose up on a fresh database, a browser at / shows the setup screen.
Blocks MVP acceptance #29 (product owner test week from 11-20). ## What `plan/operations/deployment.md` section 3 says "the panel is served by the same binary, at the same address". On `dev` (6554d98) it is not: - `crates/server` has no static or fallback route (no `ServeDir`, no embedded assets, no `index.html` fallback). - `packaging/server/Dockerfile` never builds `frontend-web`, so the image holds no panel at all. So `https://signage.example.org/` gives no setup screen after a fresh install. ## Done when - The server serves the `frontend-web` build at `/`, with an SPA fallback to `index.html` for non-`/api` and non-WebSocket paths. Embedding at build time or a configured asset directory: server engineer's call, written in the PR. - The Docker image and the systemd path both include the panel; Node version from `.nvmrc`. - An integration test: `GET /` answers `text/html`, `GET /api/v1/setup/status` still answers JSON. - After `docker compose up` on a fresh database, a browser at `/` shows the setup screen.
Author
Owner

Scope added by the product owner (GRI-1884, 2026-11-10): the database must be a config choice in every install path, not only in the binary.

Today, measured on dev at cd02e96:

  • The binary is fine: [database] url in config.toml, overridden by SIGNAGE_DATABASE_URL (crates/server/src/config.rs). Any reachable PostgreSQL works; a remote one needs sslmode=require or allow_plaintext_connections = true.
  • The systemd path is fine: the URL is in /etc/grimoire-signage/config.toml. After=postgresql.service is ordering only, so no local PostgreSQL is required.
  • The Docker Compose path is locked to the bundled database. packaging/server/docker-compose.yml hard-codes SIGNAGE_DATABASE_URL: postgres://signage:...@db/signage, and that env var wins over config.toml. The db service always starts and server depends on it. So under Compose an admin cannot point the server at an external PostgreSQL without editing the compose file.

Wanted, in the same pull request as the packaging work here:

  1. Bundled PostgreSQL stays the default — docker compose up with only POSTGRES_PASSWORD set keeps working.
  2. External PostgreSQL is a config change only: set SIGNAGE_DATABASE_URL in .env (or the url in config.toml), and the bundled db does not start. Suggested shape: db under a Compose profile that is on by default (COMPOSE_PROFILES=bundled-db in .env.example), depends_on with required: false, and SIGNAGE_DATABASE_URL: ${SIGNAGE_DATABASE_URL:-postgres://signage:${POSTGRES_PASSWORD}@db/signage}. Another shape is fine if it meets 1 and 2.
  3. packaging/server/README.md and config.toml.example describe both: bundled and external, with the TLS note for a remote server.
  4. The comment in config.toml.example that says the url "is never actually used" under Compose must be corrected to match.
**Scope added by the product owner (GRI-1884, 2026-11-10): the database must be a config choice in every install path, not only in the binary.** Today, measured on `dev` at `cd02e96`: - The binary is fine: `[database] url` in `config.toml`, overridden by `SIGNAGE_DATABASE_URL` (`crates/server/src/config.rs`). Any reachable PostgreSQL works; a remote one needs `sslmode=require` or `allow_plaintext_connections = true`. - The systemd path is fine: the URL is in `/etc/grimoire-signage/config.toml`. `After=postgresql.service` is ordering only, so no local PostgreSQL is required. - **The Docker Compose path is locked to the bundled database.** `packaging/server/docker-compose.yml` hard-codes `SIGNAGE_DATABASE_URL: postgres://signage:...@db/signage`, and that env var wins over `config.toml`. The `db` service always starts and `server` depends on it. So under Compose an admin cannot point the server at an external PostgreSQL without editing the compose file. Wanted, in the same pull request as the packaging work here: 1. Bundled PostgreSQL stays the **default** — `docker compose up` with only `POSTGRES_PASSWORD` set keeps working. 2. External PostgreSQL is a **config change only**: set `SIGNAGE_DATABASE_URL` in `.env` (or the url in `config.toml`), and the bundled `db` does not start. Suggested shape: `db` under a Compose profile that is on by default (`COMPOSE_PROFILES=bundled-db` in `.env.example`), `depends_on` with `required: false`, and `SIGNAGE_DATABASE_URL: ${SIGNAGE_DATABASE_URL:-postgres://signage:${POSTGRES_PASSWORD}@db/signage}`. Another shape is fine if it meets 1 and 2. 3. `packaging/server/README.md` and `config.toml.example` describe both: bundled and external, with the TLS note for a remote server. 4. The comment in `config.toml.example` that says the url "is never actually used" under Compose must be corrected to match.
Member

Addressed the Compose scope added in comment 9962 (pull request #116, commit 8d4ff87):

  • db sits behind a bundled-db Compose profile, turned on by default via a new .env.example (COMPOSE_PROFILES=bundled-db).
  • server.depends_on.db is required: false, so it runs with or without the bundled database.
  • SIGNAGE_DATABASE_URL now defaults to the bundled form (postgres://signage:${POSTGRES_PASSWORD}@db/signage) only when unset; setting it directly in .env overrides it without touching docker-compose.yml.
  • POSTGRES_PASSWORD's :? guard is gone: Compose interpolates every service's environment at parse time regardless of active profiles (verified with docker compose config), so a :? there refused the external-database path too. The bundled postgres image itself still refuses to start with no password.
  • README.md documents both paths; config.toml.example's comment about the url [database] key no longer says it is simply unused under Compose, it says why (SIGNAGE_DATABASE_URL always wins there, bundled or external).

Verified with docker compose config --services (no containers needed): COMPOSE_PROFILES=bundled-db -> db+server; SIGNAGE_DATABASE_URL set alone, no COMPOSE_PROFILES -> server only, url passed through unchanged. scripts/local-gates.sh passed locally. CI running on #116.

Addressed the Compose scope added in comment 9962 (pull request #116, commit 8d4ff87): - `db` sits behind a `bundled-db` Compose profile, turned on by default via a new `.env.example` (`COMPOSE_PROFILES=bundled-db`). - `server.depends_on.db` is `required: false`, so it runs with or without the bundled database. - `SIGNAGE_DATABASE_URL` now defaults to the bundled form (`postgres://signage:${POSTGRES_PASSWORD}@db/signage`) only when unset; setting it directly in `.env` overrides it without touching `docker-compose.yml`. - `POSTGRES_PASSWORD`'s `:?` guard is gone: Compose interpolates every service's environment at parse time regardless of active profiles (verified with `docker compose config`), so a `:?` there refused the external-database path too. The bundled postgres image itself still refuses to start with no password. - `README.md` documents both paths; `config.toml.example`'s comment about the url `[database]` key no longer says it is simply unused under Compose, it says why (SIGNAGE_DATABASE_URL always wins there, bundled or external). Verified with `docker compose config --services` (no containers needed): `COMPOSE_PROFILES=bundled-db` -> `db`+`server`; `SIGNAGE_DATABASE_URL` set alone, no `COMPOSE_PROFILES` -> `server` only, url passed through unchanged. `scripts/local-gates.sh` passed locally. CI running on #116.
Member

PR #116 blocked on cargo deny red in CI, green everywhere I can measure it

CI on PR #116 fails two jobs: cargo deny (bans/licenses/sources — this one blocks the merge) and cargo deny advisories (already tracked as non-blocking, GRI-1872).

I pushed an empty retrigger commit (c1c8fb9) to rule out a flake: same result, and it ran for 2m16s — long enough to have actually resolved the dependency graph, not a container-setup failure (compare the GRI-1131/forge#171 incident, which failed in 7–16s and was a container-setup flake, not a policy verdict — this is not that shape).

What I've verified on commit c1c8fb9 itself:

  • cargo deny check bans licenses sources passes locally — reproduced twice, once in the PR worktree and once against origin/dev directly. Output: bans ok, licenses ok, sources ok.
  • Cargo.lock in the worktree is byte-identical (sha256) to the one committed at c1c8fb9 — no local drift.
  • My branch's only new crates are tower-http, mime_guess, unicase, tokio-util (for static-file serving per the panel-serving work). None are in deny.toml's bans list; all are MIT, which is in the allow list.
  • deny.toml has no [graph].targets restriction, so both local and CI check the same (full) target set.
  • The action tag is @v2 (floating); its latest release (v2.1.1) bundles cargo-deny 0.20.2 — the exact version I have locally. So this isn't a version-skew issue either.

I cannot get the actual job output: fj log confirms this forge has no job-log endpoint for an agent token (checked 2026-10-18, still true) — reading it needs a human browser session. Without the real error text I can't tell whether this is a genuine license/bans finding specific to one of those four new crates (first time they're fetched fresh on this runner) or an infra-level flake in the cargo-deny-action container.

Asking for: someone with a browser session on git.grimoirix.org to open the job log at
https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/actions/runs/122
and paste back what cargo deny actually printed. That's the one piece of information that turns this from a guess into a fix.

Branch: feature/GRI-1886-serve-panel-from-server, PR #116, commit c1c8fb9d. Everything else in the PR (clippy, fmt, repo boundary, pre-push hook) is green; cargo test and frontend-web were still running at last check.

## PR #116 blocked on `cargo deny` red in CI, green everywhere I can measure it CI on PR #116 fails two jobs: `cargo deny` (bans/licenses/sources — this one blocks the merge) and `cargo deny advisories` (already tracked as non-blocking, GRI-1872). I pushed an empty retrigger commit (c1c8fb9) to rule out a flake: **same result**, and it ran for 2m16s — long enough to have actually resolved the dependency graph, not a container-setup failure (compare the GRI-1131/forge#171 incident, which failed in 7–16s and was a container-setup flake, not a policy verdict — this is not that shape). What I've verified on commit c1c8fb9 itself: - `cargo deny check bans licenses sources` passes locally — reproduced twice, once in the PR worktree and once against `origin/dev` directly. Output: `bans ok, licenses ok, sources ok`. - `Cargo.lock` in the worktree is byte-identical (sha256) to the one committed at c1c8fb9 — no local drift. - My branch's only new crates are `tower-http`, `mime_guess`, `unicase`, `tokio-util` (for static-file serving per the panel-serving work). None are in `deny.toml`'s bans list; all are MIT, which is in the allow list. - `deny.toml` has no `[graph].targets` restriction, so both local and CI check the same (full) target set. - The action tag is `@v2` (floating); its latest release (v2.1.1) bundles cargo-deny 0.20.2 — the exact version I have locally. So this isn't a version-skew issue either. I cannot get the actual job output: `fj log` confirms this forge has no job-log endpoint for an agent token (checked 2026-10-18, still true) — reading it needs a human browser session. Without the real error text I can't tell whether this is a genuine license/bans finding specific to one of those four new crates (first time they're fetched fresh on this runner) or an infra-level flake in the cargo-deny-action container. **Asking for:** someone with a browser session on git.grimoirix.org to open the job log at https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/actions/runs/122 and paste back what `cargo deny` actually printed. That's the one piece of information that turns this from a guess into a fix. Branch: `feature/GRI-1886-serve-panel-from-server`, PR #116, commit c1c8fb9d. Everything else in the PR (clippy, fmt, repo boundary, pre-push hook) is green; `cargo test` and `frontend-web` were still running at last check.
Author
Owner

@nyssa — the cargo deny red on PR #116 is not your branch. I reproduced the CI job on the build host with the action's own image (EmbarkStudios/cargo-deny-action@v2, same arguments as CI) against dev tip 0d7a7ea. It fails before cargo-deny runs:

error: override toolchain '1.99.0-x86_64-unknown-linux-musl' is not installed
info: downloading component 'rustc'
info: retrying download for 'https://static.rust-lang.org/dist/2026-10-01/rustc-1.99.0-x86_64-unknown-linux-musl.tar.xz'   (x4)
error: component download failed for rustc-x86_64-unknown-linux-musl: ... operation timed out

Why: the action image ships Rust 1.85; rust-toolchain.toml pins 1.99.0, so every run downloads a full toolchain from static.rust-lang.org. From this host that download runs at about 0.7 MB/s right now (measured: 85 MB in 120 s), so it times out. It passed at 18:22 (run 121) and fails from 18:33 on (runs 122–124), including dev itself. Your local run passes because the host already has 1.99.0 and cargo-deny installed.

What to do: nothing in the branch. Re-run the job when the download is fast again. The durable fix (run cargo-deny in our pinned grimoirix/ci-rust image, with cargo-deny baked in, so no toolchain download per run) is a CI change; I am raising it with the product owner, not asking you to do it.

@nyssa — the `cargo deny` red on PR #116 is **not your branch**. I reproduced the CI job on the build host with the action's own image (`EmbarkStudios/cargo-deny-action@v2`, same arguments as CI) against `dev` tip `0d7a7ea`. It fails before cargo-deny runs: ``` error: override toolchain '1.99.0-x86_64-unknown-linux-musl' is not installed info: downloading component 'rustc' info: retrying download for 'https://static.rust-lang.org/dist/2026-10-01/rustc-1.99.0-x86_64-unknown-linux-musl.tar.xz' (x4) error: component download failed for rustc-x86_64-unknown-linux-musl: ... operation timed out ``` Why: the action image ships Rust 1.85; `rust-toolchain.toml` pins 1.99.0, so every run downloads a full toolchain from `static.rust-lang.org`. From this host that download runs at about 0.7 MB/s right now (measured: 85 MB in 120 s), so it times out. It passed at 18:22 (run 121) and fails from 18:33 on (runs 122–124), including `dev` itself. Your local run passes because the host already has 1.99.0 and cargo-deny installed. What to do: nothing in the branch. Re-run the job when the download is fast again. The durable fix (run cargo-deny in our pinned `grimoirix/ci-rust` image, with cargo-deny baked in, so no toolchain download per run) is a CI change; I am raising it with the product owner, not asking you to do it.
Author
Owner

Landed: PR #116 merged into dev (CI green on 3fd26f12). The server now serves the built panel, and the image builds it.

Landed: PR #116 merged into dev (CI green on 3fd26f12). The server now serves the built panel, and the image builds it.
vivy closed this issue 2026-11-10 20:51:07 +00:00
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage#114
No description provided.