Skip to content

docs(ns8-module): fix start, clone, secrets, events - #33

Merged
stephdl merged 8 commits into
mainfrom
ns8-module-fixes
Nov 26, 2026
Merged

stephdl merged 8 commits into
mainfrom
ns8-module-fixes

Conversation

@stephdl

@stephdl stephdl commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

I checked the ns8-module skill against ns8-core and the 32 NethServer modules. I kept only generic patterns.

Main fixes:

  • configure-module used try-restart, which never starts a stopped unit. Now enable then restart.
  • Clone copies state/ and volumes by rsync. The skill said it starts from a fresh DB.
  • Restore and clone always pass lets_encrypt False. DNS may not be ready on the new node, and set_route would fail the whole restore.
  • Restore reads booleans with .lower() == "true" and .get() with a default.
  • Secrets: a 0600 file under state/ written with agent.safe_open, never set_env.
  • New short section on routes, ports and firewall. http2https defaults to true.
  • Smaller fixes:
    • Publish events with rdb.publish on the leader. redis-cli has no module credentials, and the replica is read-only.
    • Event list: add smarthost-changed, certificate-changed comes from traefik, mail-settings-changed from mail.
    • Core already grants configure-module in selfadm.
    • List all 14 inherited actions, not 4.
    • Add the missing labels: min-core, max-per-node, ports-demand, flags.
    • Translations come from Weblate, not Renovate.

I kept the prose short: one line per rule, with the reason in a few words. Cleanup of older text can go in a separate PR.

Several patterns in the skill did not match core or current modules.
try-restart in configure-module never starts a stopped unit, clone
copies state and volumes by rsync, and modules keep secrets under
state/secrets/. Add a section on routes, ports and firewall.
Drop patterns taken from a single module (per-component secrets, UNITS
array, clone replace branch). Never restore lets_encrypt on restore or
clone, compare env booleans case-insensitively, and default http2https
to true.
@stephdl

stephdl commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

I checked every pattern against the 32 NethServer modules, not just a few, and kept only what is generic.

I removed what came from one or two modules: per-component files under state/secrets/, the UNITS array, and the clone replace branch. The secret rule is back to the generic one: a 0600 file under state/, never set_env. The file name is free.

I also added two rules. Restore, clone and move must pass lets_encrypt False, because DNS may not point to the new node yet and set_route checks the certificate by default, so the whole restore fails. And http2https defaults to true, with a UI toggle only when the app must serve plain HTTP.

The restore snippet now reads booleans with .lower() == "true" and uses .get() with a default for fields older backups may lack.

The replica is read-only and agents listen to events on their local
replica, which the leader feeds.
@stephdl
stephdl requested a review from gsanchietti November 9, 2026 12:02
@gsanchietti
gsanchietti requested review from DavidePrincipi and removed request for gsanchietti November 9, 2026 13:02

@DavidePrincipi DavidePrincipi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to keep skill as lean as possible. Advices and code snippets should go to the dev's manual.

@stephdl

stephdl commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I trimmed the prose everywhere in this PR. I kept the rules in the skill, though. The agent never reads the dev's manual unless the skill tells it to, and the user who drives it won't read it either. So a rule that lives only in the manual changes nothing in what the agent does. Snippets stay too, since the agent copies them instead of guessing the API. Let me know if some parts still read as advice.

Comment thread skills/nethserver-ns8-module/SKILL.md Resolved
Comment thread skills/nethserver-ns8-module/SKILL.md Resolved
stephdl and others added 2 commits November 16, 2026 09:44
Co-authored-by: Davide Principi <davide.principi@nethesis.it>
Co-authored-by: Davide Principi <davide.principi@nethesis.it>

@DavidePrincipi DavidePrincipi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the PR is accurate: I checked each claim against ns8-core and the module repos. The inline suggestions are small cuts and fixes, mostly to keep the skill lean.

@DavidePrincipi

Copy link
Copy Markdown
Member

Thanks for the fixes. Wrong statements like try-restart, the fresh-DB clone and Renovate translations are worth correcting.

My concern is the direction. The skill grows by 57 lines, and most of the new content repeats the dev's manual. I'd keep the skill concise and task-oriented, pointing to the manual rather than replacing it. Copies go stale: this PR had to fix older copied statements.

I agree the agent won't read the manual unless the skill tells it to. A pointer is enough for that, it does not need a copy. Proposal: replace each of these with a one-line rule plus a link.

Keep a rule in the skill only for a pitfall agents really hit, like try-restart in configure-module or Let's Encrypt on restore and clone.

Publishing an event from Python is missing from the manual. Let's add it there with a PR to ns8-core, then link it from the skill.

This can go in a follow-up PR, so this one can merge with the fixes.

@stephdl

stephdl commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, I agree on the direction.

Before switching to links I checked those pages against the code. Some statements are wrong: random ports, the TCP_PORTS condition, runagent expand-templates, domain=none, the clone env merge and the terminate signal. Some pitfalls are also missing, like restore skipping state/environment, the firewall not being cleaned on removal, and the route cleanup rule.

I opened NethServer/ns8-core#1428 to fix them and to document event publishing from Python. Once it is merged, I'll cut the skill down to one-line rules plus links in a follow-up PR.

Can we merge this one with the fixes?

@stephdl
stephdl merged commit 221516f into main Nov 26, 2026
@stephdl
stephdl deleted the ns8-module-fixes branch November 26, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants