Skip to content

Support offline operation (no internet access) #8088

Closed
1 of 2 issues completed
Closed

Description

@gsanchietti

Description

NS8 has been designed to work with an internet connection. This is a new requirement from a special scenario: support offline/no-internet operation. Currently, several components assume continuous connectivity and degrade poorly:

  1. Applications page / Cluster status UI ("Available updates", "Installed applications" cards) hang ~2 minutes before rendering when the repo host is unreachable.
  2. Backups fail when the restic container image needs to be re-pulled but there's no internet.
  3. Related: journal noise from modules checking subscription/repo connectivity.

The goal is to make NS8 operational in air-gapped or intermittently-offline clusters by:

  • Failing fast instead of blocking on network timeouts
  • Using locally cached data/images as fallback
  • Optionally introducing a "cluster offline" mode flag so code can degrade gracefully

Alternative solutions

  1. Do nothing: NS8 requires internet. Users who need offline mode must either provide connectivity or accept non-functional features.
  2. Quick timeout fix only: Add explicit timeout= to HTTP calls so unreachable hosts fail in seconds instead of ~2 min. Does not address backup image re-pulls or provide graceful degradation.
  3. Full offline mode with flag: Introduce a "cluster offline" or "air-gapped" configuration flag. Code checks this flag to skip network calls entirely and serve cached data. Requires more design (when/how to set the flag, what falls back to cache, what remains broken).
  4. Hybrid: Fix HTTP timeouts immediately (fast fail), redesign image cleanup + caching for restic, document what works offline vs what requires internet.

Root cause details

UI slowness (modules.py)

  • core/imageroot/usr/local/agent/pypkg/cluster/modules.py:128-140 _get_http_session() sets osession.timeout = 15, which is a no-op on requests.Session — the actual .get() call (line 154, inside _list_repository_modules) passes no timeout= kwarg, so each retry attempt (1 initial + 3 retries) blocks on the OS-level TCP timeout instead of failing fast.
  • Called from UI via list-modules/list-core-modules cluster actions (ClusterStatus.vue:762-878, ApplicationsCenter.vue:855+).
  • Frontend has no independent timeout guard — UI spinner waits indefinitely for the backend task.

Backup failures (restic image)

  • core/imageroot/var/lib/nethserver/node/update-core.d/96cleanup_restic_images unconditionally removes all cached restic image tags on every core update.
  • The next backup then has no local image and must pull from ghcr.io with no offline fallback.
  • prepare_restic_command() (agent/pypkg/agent/__init__.py:215-271) never specifies --pull=missing or similar protection.

Tested workaround (proves the hang location)

--- a/modules.py
+++ b/modules.py
@@ -147,6 +147,7 @@
     url = _urljoin(repository_url, "repodata.json")
     hsubscription = rdb.hgetall("cluster/subscription") or None
     try:
+        return []  # HACK: offline mode
     with _get_http_session() as osession:

Current logs (offline environment)

Jul 07 16:06:59 ns8 agent@node[3314501]: Trying to pull ghcr.io/nethserver/restic:3.20.0...
Jul 07 16:07:29 ns8 agent@node[3314501]: time="2026-07-07T16:07:29+02:00" level=warning msg="Failed, retrying in 1s ... (1/3). Error: initializing source docker://ghcr.io/nethserver/restic:3.20.0: pinging container registry ghcr.io: Get \"https://ghcr.io/v2/\": dial tcp 140.82.121.33:443: i/o timeout"
Jul 07 16:08:00 ns8 agent@node[3314501]: time="2026-07-07T16:08:00+02:00" level=warning msg="Failed, retrying in 1s ... (2/3). Error: ...same..."
Jul 07 16:08:31 ns8 agent@node[3314501]: time="2026-07-07T16:08:31+02:00" level=warning msg="Failed, retrying in 1s ... (3/3). Error: ...same..."
Jul 07 16:09:03 ns8 podman[924198]: ... image pull-error ghcr.io/nethserver/restic:3.20.0 unable to copy from source docker://ghcr.io/nethserver/restic:3.20.0: ...i/o timeout
Jul 07 16:09:03 ns8 agent@node[3314501]: [ERROR] restic stats failed for 86d1a8ac-ef89-557a-8e19-8582ab86b7c4/traefik/e410ec36-ab9d-4eb9-9dc0-4e3ae4710825: Command '['podman', 'run', ...]' returned non-zero exit status 125.

Jul 07 16:05:19 ns8 promtail[3314125]: ts=2026-07-07T14:05:19.253352728Z level=info msg="reporting Alloy stats" date=2026-07-07T14:05:19.253Z
Jul 07 16:05:19 ns8 promtail[3314125]: ts=2026-07-07T14:05:19.2533527308Z level=info msg="reporting Alloy stats" date=2026-07-07T14:05:19.253Z level=info msg="failed to send usage report" retries=2 err="Post \"https://stats.grafana.org/alloy-usage-report\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"

Jul 07 16:05:19 ns8 node_exporter[3313990]: time=2026-07-07T14:05:19.520Z level=ERROR source=textfile.go:225 msg="inconsistent metric help text" collector=textfile metric=node_backup_status original_help_text="Status of the backup (0 = failure, 1 = success, -1 = unknown)" new_help_text="Status of the backup (0 = failure, 1 = success, 2 = conflict, -1 = unknown)" file=/host/run/node_exporter/backup.prom

References

Sub-issues

Sub-issues

1 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added theissue type on Jul 7, 2026
  2. changed the issue type fromtoon Jul 7, 2026
  3. changed the title [-]NS8 does not work correctly when the cluster has no internet access[/-] [+]Support offline operation (no internet access)[/+] on Jul 7, 2026
  4. added this to the NethServer 8.10 milestone on Jul 8, 2026
  5. self-assigned this
    on Jul 9, 2026
  6. moved this from ToDo to In Progress in NethServeron Jul 9, 2026
  7. gsanchietti commented on Jul 9, 2026

    @gsanchietti
    MemberAuthor

    Testing versions: core:3.20.1-dev.2

    Test case 1: Clean install — fixed version, online baseline (no regression)

    • Install NethServer 8, testing release 3.20.1-dev.2:
      curl https://raw.githubusercontent.com/NethServer/ns8-core/main/core/install.sh > install.sh
      bash install.sh ghcr.io/nethserver/core:latest ghcr.io/nethserver/core:3.20.1-dev.2
      
    • Enable the default software repository (Cluster Admin → Settings → Software repositories) if not already enabled
    • Install one application module via the Software Center UI so "Installed applications" / "Available updates" cards are populated
    • Open the Applications page and Cluster status page while online
    • Expected: cards load normally, no regression, no unusual delay
    • Check journalctl -u promtail --since "-10 min" — expect zero lines mentioning usage-report / stats.grafana.org
    • Check systemctl cat promtail (or podman inspect on the promtail container) — command line must include --disable-reporting

    Test case 2: Update from pre-fix to fixed version — reproduce bug, then verify fix, online and offline

    • Install NethServer 8 stable 3.20.0 (pre-fix):
      curl https://raw.githubusercontent.com/NethServer/ns8-core/main/core/install.sh > install.sh
      bash install.sh ghcr.io/nethserver/core:latest ghcr.io/nethserver/core:3.20.0
      
    • Install one application module via Software Center to populate the Applications page
    • Offline (pre-fix baseline): block outbound to repo host + ghcr.io + stats.grafana.org; open Applications/Cluster status pages and time the "Available updates"/"Installed applications" cards
      • Expected (bug reproduced): ~2min hang per enabled repo before the page settles
      • Check journalctl -u promtail --since "-10 min": expect repeated "failed to send usage report" / timeout warnings
    • Restore network
    • Update core to the fixed version: api-cli run update-core --data '{"core_url":"ghcr.io/nethserver/core:3.20.1-dev.2","nodes":[1]}'
    • Confirm the update completed (version matches, services healthy)
    • Offline (post-fix): repeat the same network block; open Applications/Cluster status pages
      • Expected (fixed): each unreachable repo fails within ≤25s, UI shows does not block on indefinite spinner
      • Check journalctl -u promtail --since "-10 min": expect no usage-report noise; confirm --disable-reporting present via systemctl cat promtail
    • Restore network

    Test case 3: Air-gapped cluster, multiple repositories (worst case)

    • Install NethServer 8, testing release 3.20.1-dev.2:
      curl https://raw.githubusercontent.com/NethServer/ns8-core/main/core/install.sh > install.sh
      bash install.sh ghcr.io/nethserver/core:latest ghcr.io/nethserver/core:3.20.1-dev.2
      
    • Enable at least two software repositories (default + one extra, e.g. NethForge) via Cluster Admin → Settings → Software repositories
    • Fully air-gap the node (bring down the WAN-facing interface, or DROP all outbound at the firewall — no DNS resolution either)
    • Open Applications / Cluster status pages
    • Expected: total wait stays bounded (~25s × number of enabled repos, not ~2min × repos), no UI hang
    • Check journalctl across promtail and agent@node/agent@cluster units for any timeout/retry noise beyond the expected fast-fail messages
    • Restore network at the end
  8. removed their assignment
    on Jul 9, 2026
  9. added
    testing
    on Jul 9, 2026
  10. moved this from In Progress to Testing in NethServeron Jul 9, 2026
  11. self-assigned this
    on Jul 9, 2026
  12. nrauso commented on Jul 16, 2026

    @nrauso

    all test cases VERIFIED

  13. added
    verified
    on Jul 16, 2026
  14. removed
    testing
    on Jul 16, 2026
  15. moved this from Testing to Verified in NethServeron Jul 16, 2026
  16. DavidePrincipi commented on Jul 23, 2026

    @DavidePrincipi
    Member
  17. moved this from Verified to Done in NethServeron Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    verified

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions