Render the docs site per installation from /etc/default config instead of at package build time

未关闭
#538 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
debian, javascript, python

调研方向

Start by reading manager-control-program/Makefile, contrib/postinstall.sh, and the existing opensource-mcp systemd setup to understand the packaging pattern. Then trace the docs build and publish flow in mie-opensource-landing/main.py and scripts/publish_skill.py, along with the nginx configs named in the issue. Done means the package renders atomically with host config, preserves local settings on upgrades, and passes scripts/test_published_skill.py against rendered output.

由索引模型根据 Issue 内容生成。

描述

Problem

The opensource-docs package ships HTML that was already rendered at package build time. Installation-specific values are fixed into it by mie-opensource-landing/main.py:

  • manager_url (env MANAGER_URL, default https://manager.os.mieweb.org) is used in about ten pages, including users/getting-started.md, users/mcp-server.md, users/creating-containers/command-line.md and api-keys.md.
  • proxmox_url (env PROXMOX_URL, default https://os.mieweb.org:8006).

The release build never sets either variable, so every installation that installs the package from the APT repo shows MIE's Manager and Proxmox links.

#537 makes this more important. The homepage gets a Cluster Manager link, and the published deployment skill tells agents to use that link to choose where to sign in and send an API key. On another cluster, that link points agents at MIE's Manager.

#537 adds ARG MANAGER_URL to images/builder/Dockerfile, so an operator can build a separate docs package for their cluster. That works, but the docs package then differs per installation and can't be shared through the APT repo.

Proposal

Ship the docs source plus a oneshot systemd service that renders the site on the host, using values from a package config file. This follows the pattern opensource-mcp already uses: dependencies vendored into a build tree, a unit using EnvironmentFile=/etc/default/…, and contrib/postinstall.sh.

  • Config: /etc/default/opensource-docs, a package config file so local edits survive upgrades. Settings include MANAGER_URL and PROXMOX_URL; an empty value uses the current default.
  • Service: opensource-docs-build.service with Type=oneshot and EnvironmentFile=-/etc/default/opensource-docs. It runs zensical build and then scripts/publish_skill.py, using only the system python3.
  • Dependencies: vendor zensical, pyyaml and their dependencies as prebuilt wheels for Debian 13 / amd64 / CPython 3.13, the same way manager-control-program/Makefile does. Pin python3 in the package metadata to match.
  • When it runs:
    • postinstall.sh runs it on install and upgrade when systemd is running.
    • An admin runs systemctl restart opensource-docs-build after editing the config.
    • Optionally, an opensource-docs-build.path unit re-renders automatically when the config changes.
  • Atomic publish: render into a temporary directory, then swap it into place, so nginx never serves a half-built site.

Design questions

  1. Where the rendered site lives. Today nginx serves /opt/opensource-server/mie-opensource-landing/site, and those files belong to the package. If the service rewrites them, dpkg will overwrite or remove its changes on every upgrade. Options:
    • Render into a directory the package doesn't own, such as /var/lib/opensource-docs/site, and point both nginx configs there: agent/templates/nginx.conf.ejs (docs server block) and images/docs/docs-site.conf.
    • Or keep the old path as a symlink to the rendered directory.
  2. Fallback when systemd isn't running (image builds, chroots, containers without systemd). Either ship a default-rendered site as a fallback, or make the image builds render it explicitly.
  3. Where MANAGER_URL comes from on each host:
    • Manager image: could write it during first-boot setup, the way images/manager/container-creator-init.service writes /etc/default/container-creator.
    • Docs image: could take it from the LXC environment, like the agent does.
    • Don't copy the agent's MANAGER_URL. It's documented as possibly an internal address (http://192.168.1.10:3000); this setting must be the public Manager origin.
  4. Values that differ per installation: the skill zip, its sha256 digest in /.well-known/agent-skills/index.json, and llms.txt will differ per installation. That's expected; the tests in scripts/test_published_skill.py should run against the rendered output.

Acceptance criteria

  • One opensource-docs package installs unchanged on any cluster. After setting MANAGER_URL/PROXMOX_URL in /etc/default/opensource-docs and running the service, every {{ manager_url }}/{{ proxmox_url }} link and the homepage Cluster Manager link point at that installation.
  • With no config, the rendered site matches today's MIE defaults.
  • Upgrading the package keeps local config edits and re-renders without serving a partial site.
  • make dev / compose keep working; they already pass MANAGER_URL and PROXMOX_URL through the environment.
  • Afterwards, remove the ARG MANAGER_URL build-time override from images/builder/Dockerfile, and the per-cluster build instructions from mie-opensource-landing/README.md (both added in #537).
主要语言
JavaScript
星标
10
派生
6
平均合并
5 天 14 小时
30 天内合并 PR
5

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mieweb/opensource-server 的其他 Issue

查看 mieweb/opensource-server 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。