diff --git a/apps/nextpath/README.md b/apps/nextpath/README.md index 8f4ade7..f82e411 100644 --- a/apps/nextpath/README.md +++ b/apps/nextpath/README.md @@ -16,3 +16,15 @@ dates, geography, and sources remain visible beside the recommendation. See [the architecture document](../../docs/nextpath-architecture.md) for the MVP boundaries and delivery slices. +## Deploy + +NextPath is a public work in progress. Deploy it from the Debian control plane: + +```bash +./jeannie deploy-nextpath +``` + +The service runs under systemd, stores private account data in +`/data/homelab-nextpath/data`, and exposes only its HTTP port to the tailnet/LAN. +The OCI edge supplies public TLS at `https://nextpath.lab2025.duckdns.org/`. + diff --git a/cmd/jeannie-server/main.go b/cmd/jeannie-server/main.go index e62ba6f..221433b 100644 --- a/cmd/jeannie-server/main.go +++ b/cmd/jeannie-server/main.go @@ -55,6 +55,7 @@ var allowedCommands = map[string]bool{ "deploy-searxng": true, "deploy-privatebin": true, "deploy-miniflux": true, "deploy-opsproof": true, + "deploy-nextpath": true, "deploy-dex": true, "deploy-matrix": true, "deploy-ai-stack": true, "deploy-office": true, "deploy-ai-tools": true, "deploy-omniroute": true, "deploy-hermes": true, diff --git a/homelab.yml b/homelab.yml index 3b69492..35c2252 100644 --- a/homelab.yml +++ b/homelab.yml @@ -34,6 +34,7 @@ domain: - paste.lab2025.duckdns.org - feeds.lab2025.duckdns.org - opsproof.lab2025.duckdns.org + - nextpath.lab2025.duckdns.org network: lan_cidr: 192.168.100.0/24 @@ -216,6 +217,12 @@ services: bind_ip: 0.0.0.0 public_url: https://opsproof.lab2025.duckdns.org/ demo_public_url: https://opsproof.lab2025.duckdns.org/ + nextpath: + host: debian + install_dir: /data/homelab-nextpath + http_port: 8892 + bind_ip: 0.0.0.0 + public_url: https://nextpath.lab2025.duckdns.org/ gitops_mirror: host: debian path: /home/jv/git-server/my-homelab-configs.git diff --git a/jeannie b/jeannie index 969407d..92615f6 100755 --- a/jeannie +++ b/jeannie @@ -83,6 +83,7 @@ Build And Bootstrap deploy-privatebin Deploy Debian-hosted encrypted paste service. deploy-miniflux Deploy Debian-hosted private RSS reader. deploy-opsproof Build and deploy the Debian-hosted OpsProof UI. + deploy-nextpath Build and deploy the Debian-hosted NextPath WIP. deploy-dex Deploy the Debian-hosted Dex SSO stack. monitoring {plan|migrate|apply|refresh|exporters|status|validate} Manage Debian monitoring; preserve cluster discovery and Dex. deploy-office Deploy Nextcloud + ONLYOFFICE online office. @@ -716,6 +717,10 @@ case "${1:-}" in record_change_journal "deploy-opsproof" "$@" deploy_opsproof ;; + deploy-nextpath) + record_change_journal "deploy-nextpath" "$@" + deploy_nextpath + ;; deploy-dex) record_change_journal "deploy-dex" "$@" deploy_dex diff --git a/lib/jeannie/commands.sh b/lib/jeannie/commands.sh index 80d952b..ce3e0f2 100644 --- a/lib/jeannie/commands.sh +++ b/lib/jeannie/commands.sh @@ -2461,6 +2461,7 @@ status_report() { status_compose_stack "searxng" "${LAB_SEARXNG_INSTALL_DIR:-/data/homelab-searxng}" status_compose_stack "privatebin" "${LAB_PRIVATEBIN_INSTALL_DIR:-/data/homelab-privatebin}" status_compose_stack "miniflux" "${LAB_MINIFLUX_INSTALL_DIR:-/data/homelab-miniflux}" + status_systemd_units nextpath status_compose_stack "dex" "${LAB_DEX_INSTALL_DIR:-/data/homelab-dex}" status_compose_stack "arr-stack" "${REPO_ROOT}/infra/arr-stack" @@ -2483,6 +2484,7 @@ status_report() { status_http "searxng public" "${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" status_http "privatebin public" "${LAB_PRIVATEBIN_PUBLIC_URL:-https://paste.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" status_http "miniflux public" "${LAB_MINIFLUX_PUBLIC_URL:-https://feeds.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" + status_http "nextpath public" "${LAB_NEXTPATH_PUBLIC_URL:-https://nextpath.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/healthz}" status_http "dex public" "${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" status_http "gitea local" "http://127.0.0.1:${LAB_GITEA_HTTP_PORT:-3000}/" status_http "heimdall local" "http://127.0.0.1:${LAB_HEIMDALL_HTTP_PORT:-8082}/" @@ -3174,6 +3176,7 @@ doctor_homelab() { status_http "searxng local" "http://127.0.0.1:${LAB_SEARXNG_HTTP_PORT:-8888}/healthz" status_http "privatebin local" "http://127.0.0.1:${LAB_PRIVATEBIN_HTTP_PORT:-8889}/" status_http "miniflux local" "http://127.0.0.1:${LAB_MINIFLUX_HTTP_PORT:-8890}/healthcheck" + status_http "nextpath local" "http://127.0.0.1:${LAB_NEXTPATH_HTTP_PORT:-8892}/healthz" status_http "ollama" "${LAB_OLLAMA_URL:-http://${LAB_DEBIAN_LAN_IP:-192.168.100.73}:11434}/api/tags" status_section "Edge And Public URLs" @@ -3187,6 +3190,7 @@ doctor_homelab() { status_http "searxng public" "${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" status_http "privatebin public" "${LAB_PRIVATEBIN_PUBLIC_URL:-https://paste.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" status_http "miniflux public" "${LAB_MINIFLUX_PUBLIC_URL:-https://feeds.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" + status_http "nextpath public" "${LAB_NEXTPATH_PUBLIC_URL:-https://nextpath.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/healthz}" status_section "Operations" backup_status || true diff --git a/lib/jeannie/env.sh b/lib/jeannie/env.sh index 31ea718..0007600 100644 --- a/lib/jeannie/env.sh +++ b/lib/jeannie/env.sh @@ -81,6 +81,10 @@ mapping = { "services.opsproof.bind_ip": "LAB_OPSPROOF_BIND_IP", "services.opsproof.public_url": "LAB_OPSPROOF_PUBLIC_URL", "services.opsproof.demo_public_url": "LAB_OPSPROOF_DEMO_PUBLIC_URL", + "services.nextpath.install_dir": "LAB_NEXTPATH_INSTALL_DIR", + "services.nextpath.http_port": "LAB_NEXTPATH_HTTP_PORT", + "services.nextpath.bind_ip": "LAB_NEXTPATH_BIND_IP", + "services.nextpath.public_url": "LAB_NEXTPATH_PUBLIC_URL", "services.local_registry.endpoint": "LAB_REGISTRY_ENDPOINT", "services.ollama.url": "LAB_OLLAMA_URL", "services.ollama.bind_address": "LAB_OLLAMA_BIND_ADDRESS", @@ -249,6 +253,7 @@ for service_name, env_name in [ ("privatebin", "LAB_PRIVATEBIN_BACKEND_HOST"), ("miniflux", "LAB_MINIFLUX_BACKEND_HOST"), ("opsproof", "LAB_OPSPROOF_BACKEND_HOST"), + ("nextpath", "LAB_NEXTPATH_BACKEND_HOST"), ]: service_lan = service_host_value(service_name, "lan_ip") or services_host_lan service_tailscale = service_host_value(service_name, "tailscale_ip") or services_host_tailscale diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index b79fdbc..b59ce16 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -6011,6 +6011,96 @@ UNIT_EOF echo "OpsProof Laravel Go shell and PostgreSQL service are healthy at http://${bind_ip}:${http_port}/." } +deploy_nextpath() { + local install_dir="${LAB_NEXTPATH_INSTALL_DIR:-/data/homelab-nextpath}" + local http_port="${LAB_NEXTPATH_HTTP_PORT:-8892}" + local bind_ip="${LAB_NEXTPATH_BIND_IP:-0.0.0.0}" + local service_user="${LAB_NEXTPATH_SERVICE_USER:-$(id -un)}" + local secure_cookies="${LAB_NEXTPATH_SECURE_COOKIES:-true}" + local release_id="" + local release_dir="" + local elapsed=0 + + require_debian_server "deploy-nextpath" + if ! [[ "${http_port}" =~ ^[0-9]+$ ]] || ((http_port < 1 || http_port > 65535)); then + echo "LAB_NEXTPATH_HTTP_PORT must be a valid TCP port." >&2 + return 1 + fi + if ! [[ "${bind_ip}" =~ ^[0-9a-fA-F:.]+$ ]]; then + echo "LAB_NEXTPATH_BIND_IP must be an IP address." >&2 + return 1 + fi + if ! [[ "${service_user}" =~ ^[a-z_][a-z0-9_-]*[$]?$ ]]; then + echo "LAB_NEXTPATH_SERVICE_USER is invalid." >&2 + return 1 + fi + case "${secure_cookies}" in + true|false) ;; + *) echo "LAB_NEXTPATH_SECURE_COOKIES must be true or false." >&2; return 1 ;; + esac + for required in go curl systemctl; do + if ! command -v "${required}" >/dev/null 2>&1; then + echo "NextPath deployment requires ${required} on Debian." >&2 + return 1 + fi + done + + release_id="$(git -C "${REPO_ROOT}" rev-parse --verify HEAD)" + release_dir="${install_dir}/releases/${release_id}" + sudo install -d -o "${service_user}" -g "${service_user}" -m 0750 \ + "${install_dir}" "${install_dir}/releases" "${install_dir}/data" + sudo chmod 0700 "${install_dir}/data" + sudo -u "${service_user}" install -d -m 0750 "${release_dir}" + ( + cd "${REPO_ROOT}" + GOTOOLCHAIN=local go test ./cmd/nextpath/... + GOTOOLCHAIN=local go build -trimpath -o "${release_dir}/nextpath" ./cmd/nextpath + ) + sudo -u "${service_user}" ln -sfn "${release_dir}" "${install_dir}/current" + + sudo tee /etc/systemd/system/nextpath.service >/dev/null </dev/null; do + if ((elapsed >= 60)); then + echo "Timed out waiting for NextPath on port ${http_port}." >&2 + sudo systemctl status nextpath.service --no-pager >&2 || true + sudo journalctl -u nextpath.service -n 100 --no-pager >&2 || true + return 1 + fi + sleep 3 + elapsed=$((elapsed + 3)) + done + echo "NextPath is healthy on http://${bind_ip}:${http_port}/; private data remains in ${install_dir}/data." +} + deploy_matrix() { local mode="${LAB_MATRIX_DEPLOY:-true}" local install_dir="${LAB_MATRIX_INSTALL_DIR:-/home/jv/matrix-server}" diff --git a/tests/jeannie/test_nextpath_pipeline.py b/tests/jeannie/test_nextpath_pipeline.py new file mode 100644 index 0000000..c57ef15 --- /dev/null +++ b/tests/jeannie/test_nextpath_pipeline.py @@ -0,0 +1,33 @@ +import pathlib +import unittest + + +ROOT = pathlib.Path(__file__).resolve().parents[2] + + +class NextPathPipelineTests(unittest.TestCase): + def test_deployment_is_debian_hosted_private_and_health_checked(self): + pipeline = (ROOT / "lib/jeannie/pipeline.sh").read_text(encoding="utf-8") + command = (ROOT / "jeannie").read_text(encoding="utf-8") + server = (ROOT / "cmd/jeannie-server/main.go").read_text(encoding="utf-8") + + self.assertIn("deploy_nextpath()", pipeline) + self.assertIn('require_debian_server "deploy-nextpath"', pipeline) + self.assertIn("GOTOOLCHAIN=local go test ./cmd/nextpath/...", pipeline) + self.assertIn("NEXTPATH_ACCOUNT_STORE=${install_dir}/data/accounts.json", pipeline) + self.assertIn("ReadWritePaths=${install_dir}/data", pipeline) + self.assertIn("sudo chmod 0700", pipeline) + self.assertIn('curl -fsS --connect-timeout 3 "http://127.0.0.1:${http_port}/healthz"', pipeline) + self.assertIn("nextpath.service", pipeline) + self.assertIn("deploy-nextpath)", command) + self.assertIn('"deploy-nextpath": true', server) + + def test_inventory_declares_public_wip(self): + inventory = (ROOT / "homelab.yml").read_text(encoding="utf-8") + self.assertIn("nextpath.lab2025.duckdns.org", inventory) + self.assertIn("install_dir: /data/homelab-nextpath", inventory) + self.assertIn("http_port: 8892", inventory) + + +if __name__ == "__main__": + unittest.main()