Commit Graph

19 Commits

Author SHA1 Message Date
9635aecb81 test: add permanent failure test
Verifies the service enters failed state after exhausting all
StartLimitBurst retries when the API never becomes available.
Checks StartLimitIntervalSec/Burst configuration and confirms
repeated timeout messages appear in the journal.
2026-04-16 16:35:28 -04:00
a37b6f6112 test: add network namespace test
Tests networkNamespacePath and networkNamespaceService options.
Creates a network namespace, runs a mock Servarr inside it, verifies
namespace isolation (mock unreachable from default ns), and confirms
the init service provisions resources through the namespace.
2026-04-16 16:34:53 -04:00
f766e5f71e test: add naming configuration test
Exercises the naming option which was previously untested.
Verifies fields are applied to Sonarr via config/naming API
and validates idempotency (second run reports 'already correct').
2026-04-16 16:34:28 -04:00
f86a5f1b39 refactor: split module.nix into per-service modules
Replace the 1301-line monolithic module.nix with focused modules:
- modules/servarr.nix  (Sonarr/Radarr/Prowlarr)
- modules/bazarr.nix   (Bazarr provider connections)
- modules/jellyseerr.nix (Jellyseerr quality profiles)
- modules/default.nix  (import aggregator)

Python scripts (from prior commit) are referenced as standalone
files via PYTHONPATH, with config passed as a JSON file argument.

New options and behavioral changes:
- Add bindAddress option to all services (default 127.0.0.1)
- Change healthChecks default from false to true
- Replace hardcoded wg.service dependency with configurable
  networkNamespaceService option
- Add systemd hardening: PrivateTmp, NoNewPrivileges, ProtectHome,
  ProtectKernelTunables/Modules, ProtectControlGroups,
  RestrictSUIDSGID, SystemCallArchitectures=native

Test updates:
- Extract mock qBittorrent/SABnzbd servers into tests/lib/mocks.nix
- Add healthChecks=false to tests not exercising health checks
- Fix duplicate wait_for_unit calls in integration test
2026-04-16 16:34:04 -04:00
b464a8cea2 refactor: extract Python scripts into standalone files
Move embedded Python scripts out of Nix string interpolation into
standalone files under scripts/.  Each script reads its configuration
from a JSON file passed as the first CLI argument.

Shared utilities (API key reading, API polling, health check loop)
are consolidated into common.py, eliminating three copies of
read_api_key and wait_for_api.

Implementation improvements included in the extraction:
- Remove pyarr dependency; all HTTP calls use raw requests
- Add update semantics: download clients and synced apps are now
  compared against desired state and updated on drift via PUT
- Bazarr configure_provider compares API keys and updates stale ones
- Narrow health_check_loop exception clause from bare Exception to
  (RequestException, ValueError, KeyError)
- Fix double resp.json() call in resolve_profile_id (jellyseerr)
- Replace os.system with subprocess.run for Jellyseerr restart
- Handle missing 'value' key in Servarr field API responses
2026-04-16 16:33:18 -04:00
b97ed1e90c flake.nix: use flake-utils for system gen 2026-04-16 13:50:51 -04:00
60fcce47df test: add jellyseerr 2026-04-13 19:59:18 -04:00
e7dda1e08e add jellyseerrInit: declarative quality profile defaults 2026-04-13 03:38:00 -04:00
f8475f6cb4 use xml and yaml libraries 2026-03-28 00:05:23 -07:00
c946150c81 move to python scripts from shell scripts
Allows usage of Servarr python libraries, reduces
implementation-specific code.
2026-03-27 23:41:58 -07:00
b80f115cc3 nit: use lib.getExe 2026-03-27 23:21:18 -07:00
c5ff0808d2 be more leniant on startup time of *arr services 2026-03-27 23:05:39 -07:00
35c6d1b821 cleanup category handling 2026-03-27 22:46:45 -07:00
7f395bd9b3 add naming option + other stuff 2026-03-25 10:14:07 -07:00
ef0da7582c wait on qbt service before init 2026-03-15 13:45:07 -04:00
7c0a617640 add healthChecks option 2026-03-15 13:25:29 -04:00
4cc1ae4e00 add Restart=on-failure and RestartSec=30 2026-03-03 14:26:56 -05:00
6cdab23f7f set baseURL to 127.0.0.1 instead of localhost 2026-03-03 14:26:55 -05:00
ed22d77741 init 2026-03-03 14:26:55 -05:00