diff --git a/apps/demos-static/public/homelab-catalog/index.html b/apps/demos-static/public/homelab-catalog/index.html index 1ac2002..f06daa0 100644 --- a/apps/demos-static/public/homelab-catalog/index.html +++ b/apps/demos-static/public/homelab-catalog/index.html @@ -104,6 +104,22 @@ https://search.lab2025.duckdns.org/ infra/searxng/README.md + + PrivateBin + debian (control-plane, 192.168.100.73) + Docker Compose / jeannie deploy-privatebin + http://192.168.100.73:8889/ + https://paste.lab2025.duckdns.org/ + infra/privatebin/README.md + + + Miniflux + debian (control-plane, 192.168.100.73) + Docker Compose / jeannie deploy-miniflux + http://192.168.100.73:8890/ + https://feeds.lab2025.duckdns.org/ + infra/miniflux/README.md + GitOps mirror debian (control-plane, 192.168.100.73) diff --git a/bootstrap/edge/main.tf b/bootstrap/edge/main.tf index 08795e5..8e36185 100644 --- a/bootstrap/edge/main.tf +++ b/bootstrap/edge/main.tf @@ -9,28 +9,32 @@ terraform { } locals { - compose_file = templatefile("${path.module}/templates/docker-compose.yml.tftpl", {}) - crowdsec_acquis = templatefile("${path.module}/templates/crowdsec-acquis.yaml.tftpl", {}) - crowdsec_whitelist = templatefile("${path.module}/templates/crowdsec-homelab-whitelist.yaml.tftpl", {}) - heimdall_server_name = "heimdall.${var.server_name}" - homepage_server_name = "homepage.${var.server_name}" - oidc_server_name = "auth.${var.server_name}" - jellyfin_server_name = "jellyfin.${var.server_name}" - searxng_server_name = "search.${var.server_name}" - heimdall_backend_host = var.heimdall_backend_host != "" ? var.heimdall_backend_host : var.gitea_backend_host - homepage_backend_host = var.homepage_backend_host != "" ? var.homepage_backend_host : var.gitea_backend_host + compose_file = templatefile("${path.module}/templates/docker-compose.yml.tftpl", {}) + crowdsec_acquis = templatefile("${path.module}/templates/crowdsec-acquis.yaml.tftpl", {}) + crowdsec_whitelist = templatefile("${path.module}/templates/crowdsec-homelab-whitelist.yaml.tftpl", {}) + heimdall_server_name = "heimdall.${var.server_name}" + homepage_server_name = "homepage.${var.server_name}" + oidc_server_name = "auth.${var.server_name}" + jellyfin_server_name = "jellyfin.${var.server_name}" + searxng_server_name = "search.${var.server_name}" + privatebin_server_name = "paste.${var.server_name}" + miniflux_server_name = "feeds.${var.server_name}" + heimdall_backend_host = var.heimdall_backend_host != "" ? var.heimdall_backend_host : var.gitea_backend_host + homepage_backend_host = var.homepage_backend_host != "" ? var.homepage_backend_host : var.gitea_backend_host oidc_backend_host = ( var.oidc_backend_host != "" ? var.oidc_backend_host : var.gitea_backend_host ) jellyfin_backend_host = var.jellyfin_backend_host != "" ? var.jellyfin_backend_host : var.gitea_backend_host searxng_backend_host = var.searxng_backend_host != "" ? var.searxng_backend_host : var.gitea_backend_host + privatebin_backend_host = var.privatebin_backend_host != "" ? var.privatebin_backend_host : var.gitea_backend_host + miniflux_backend_host = var.miniflux_backend_host != "" ? var.miniflux_backend_host : var.gitea_backend_host jeannie_api_server_name = "api.${var.server_name}" office_server_name = var.office_server_name office_onlyoffice_server_name = var.office_onlyoffice_server_name matrix_server_names = var.matrix_enabled ? [var.matrix_server_name, var.element_server_name] : [] monitoring_names = var.monitoring_backend_host != "" ? ["grafana.${var.server_name}", "prometheus.${var.server_name}", "alertmanager.${var.server_name}"] : [] - server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names)) - main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name) && !contains(local.monitoring_names, name)] + server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.privatebin_server_name, local.miniflux_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names)) + main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.privatebin_server_name, local.miniflux_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name) && !contains(local.monitoring_names, name)] default_conf = templatefile("${path.module}/templates/default.conf.tftpl", { server_name = var.server_name monitoring_backend_host = var.monitoring_backend_host @@ -56,6 +60,12 @@ locals { searxng_server_name = local.searxng_server_name searxng_backend_host = local.searxng_backend_host searxng_backend_port = tostring(var.searxng_backend_port) + privatebin_server_name = local.privatebin_server_name + privatebin_backend_host = local.privatebin_backend_host + privatebin_backend_port = tostring(var.privatebin_backend_port) + miniflux_server_name = local.miniflux_server_name + miniflux_backend_host = local.miniflux_backend_host + miniflux_backend_port = tostring(var.miniflux_backend_port) jeannie_api_server_name = local.jeannie_api_server_name jeannie_api_backend_host = var.jeannie_api_backend_host jeannie_api_backend_port = tostring(var.jeannie_api_backend_port) @@ -120,6 +130,10 @@ resource "null_resource" "edge_services" { jellyfin_port = tostring(var.jellyfin_backend_port) searxng_host = local.searxng_backend_host searxng_port = tostring(var.searxng_backend_port) + privatebin_host = local.privatebin_backend_host + privatebin_port = tostring(var.privatebin_backend_port) + miniflux_host = local.miniflux_backend_host + miniflux_port = tostring(var.miniflux_backend_port) jeannie_api_host = var.jeannie_api_backend_host jeannie_api_port = tostring(var.jeannie_api_backend_port) office_host = var.office_backend_host @@ -249,6 +263,10 @@ jellyfin_host="${self.triggers.jellyfin_host}" jellyfin_port="${self.triggers.jellyfin_port}" searxng_host="${self.triggers.searxng_host}" searxng_port="${self.triggers.searxng_port}" +privatebin_host="${self.triggers.privatebin_host}" +privatebin_port="${self.triggers.privatebin_port}" +miniflux_host="${self.triggers.miniflux_host}" +miniflux_port="${self.triggers.miniflux_port}" jeannie_api_host="${self.triggers.jeannie_api_host}" jeannie_api_port="${self.triggers.jeannie_api_port}" enable_letsencrypt="${self.triggers.enable_letsencrypt}" @@ -357,6 +375,16 @@ if ! curl -fsS --connect-timeout 10 "http://$searxng_host:$searxng_port/healthz" echo "Run ./jeannie deploy-searxng on Debian before testing the public hostname." >&2 fi +if ! curl -fsS --connect-timeout 10 "http://$privatebin_host:$privatebin_port/" >/dev/null; then + echo "Warning: cannot reach PrivateBin backend http://$privatebin_host:$privatebin_port/ from the edge host." >&2 + echo "Run ./jeannie deploy-privatebin on Debian before testing the public hostname." >&2 +fi + +if ! curl -fsS --connect-timeout 10 "http://$miniflux_host:$miniflux_port/healthcheck" >/dev/null; then + echo "Warning: cannot reach Miniflux backend http://$miniflux_host:$miniflux_port/healthcheck from the edge host." >&2 + echo "Run ./jeannie deploy-miniflux on Debian before testing the public hostname." >&2 +fi + if ! curl -sS --connect-timeout 10 -o /dev/null -w '%%{http_code}' "http://$jeannie_api_host:$jeannie_api_port/v1/health" | grep -Eq '^(200|401)$'; then echo "Warning: cannot reach Jeannie API backend http://$jeannie_api_host:$jeannie_api_port/v1/health from the edge host." >&2 echo "Check the Debian Jeannie API service before testing the public hostname." >&2 diff --git a/bootstrap/edge/templates/default.conf.tftpl b/bootstrap/edge/templates/default.conf.tftpl index ace82e0..9538a0f 100644 --- a/bootstrap/edge/templates/default.conf.tftpl +++ b/bootstrap/edge/templates/default.conf.tftpl @@ -45,6 +45,8 @@ error_log /var/log/nginx/crowdsec-error.log warn; limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s; limit_req_zone $binary_remote_addr zone=jeannie_api:10m rate=5r/s; limit_req_zone $binary_remote_addr zone=searxng_search:10m rate=30r/m; +limit_req_zone $binary_remote_addr zone=privatebin_write:10m rate=10r/m; +limit_req_zone $binary_remote_addr zone=miniflux_login:10m rate=20r/m; proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=static_assets:10m max_size=100m inactive=24h; proxy_cache_path /var/cache/nginx_dynamic levels=1:2 keys_zone=dynamic_content:5m max_size=50m inactive=1h; @@ -116,7 +118,7 @@ server { server { listen 80; -server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} ${jellyfin_server_name} ${searxng_server_name} ${jeannie_api_server_name} ${office_server_name} ${office_onlyoffice_server_name}; +server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} ${jellyfin_server_name} ${searxng_server_name} ${privatebin_server_name} ${miniflux_server_name} ${jeannie_api_server_name} ${office_server_name} ${office_onlyoffice_server_name}; location ^~ /.well-known/acme-challenge/ { root /var/www/certbot; @@ -129,6 +131,67 @@ server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} } } +server { + listen 443 ssl; + http2 on; + server_name ${privatebin_server_name}; + + ssl_certificate /etc/nginx/certs/current.crt; + ssl_certificate_key /etc/nginx/certs/current.key; + ssl_protocols TLSv1.2 TLSv1.3; + client_max_body_size 2m; + + if ($blocked_uris) { return 403; } + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + add_header Referrer-Policy no-referrer; + add_header Permissions-Policy "geolocation=(), microphone=(), camera=()"; + add_header Cache-Control "no-store"; + + location / { + limit_req zone=privatebin_write burst=10 nodelay; + proxy_pass http://${privatebin_backend_host}:${privatebin_backend_port}; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + } +} + +server { + listen 443 ssl; + http2 on; + server_name ${miniflux_server_name}; + + ssl_certificate /etc/nginx/certs/current.crt; + ssl_certificate_key /etc/nginx/certs/current.key; + ssl_protocols TLSv1.2 TLSv1.3; + client_max_body_size 2m; + + if ($blocked_uris) { return 403; } + add_header X-Frame-Options SAMEORIGIN; + add_header X-Content-Type-Options nosniff; + add_header Referrer-Policy no-referrer; + add_header Permissions-Policy "geolocation=(), microphone=(), camera=()"; + add_header Cache-Control "no-store"; + + location = /healthcheck { + proxy_pass http://${miniflux_backend_host}:${miniflux_backend_port}/healthcheck; + access_log off; + } + + location / { + limit_req zone=miniflux_login burst=20 nodelay; + proxy_pass http://${miniflux_backend_host}:${miniflux_backend_port}; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + } +} + server { listen 443 ssl; http2 on; diff --git a/bootstrap/edge/variables.tf b/bootstrap/edge/variables.tf index 1b6eb1f..6e8e9d3 100644 --- a/bootstrap/edge/variables.tf +++ b/bootstrap/edge/variables.tf @@ -235,6 +235,26 @@ variable "searxng_backend_port" { default = 8888 } +variable "privatebin_backend_host" { + type = string + default = "" +} + +variable "privatebin_backend_port" { + type = number + default = 8889 +} + +variable "miniflux_backend_host" { + type = string + default = "" +} + +variable "miniflux_backend_port" { + type = number + default = 8890 +} + variable "jeannie_api_backend_host" { type = string default = "" diff --git a/cmd/jeannie-server/main.go b/cmd/jeannie-server/main.go index 39fd01a..4c0b4d8 100644 --- a/cmd/jeannie-server/main.go +++ b/cmd/jeannie-server/main.go @@ -53,6 +53,7 @@ var allowedCommands = map[string]bool{ "website-ollama-listen": true, "ollama-setup": true, "deploy-gitea": true, "deploy-api": true, "deploy-heimdall": true, "deploy-searxng": true, + "deploy-privatebin": true, "deploy-miniflux": 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/cmd/jeannie-server/main_test.go b/cmd/jeannie-server/main_test.go index 2055d95..5dbf0ac 100644 --- a/cmd/jeannie-server/main_test.go +++ b/cmd/jeannie-server/main_test.go @@ -179,6 +179,9 @@ func TestSearxngDeployCommandIsRemotelyEnabled(t *testing.T) { if !allowedCommands["deploy-searxng"] { t.Fatal("deploy-searxng must be exposed through the remote API") } + if !allowedCommands["deploy-privatebin"] || !allowedCommands["deploy-miniflux"] { + t.Fatal("privacy services must be exposed through the remote API") + } } func TestPublicJeannieCommandsAreRemotelyEnabled(t *testing.T) { diff --git a/docs/app-ops.md b/docs/app-ops.md index a078a4e..cd009a0 100644 --- a/docs/app-ops.md +++ b/docs/app-ops.md @@ -348,6 +348,29 @@ the JSON result format remains enabled for later homelab AI-tool integration. Run the service deploy before `./jeannie edge apply` when reconciling the route separately. +## Privacy services + +PrivateBin and Miniflux are independent Debian Docker Compose stacks rather +than Kubernetes workloads. Deploy them with: + +```bash +./jeannie deploy-privatebin +./jeannie deploy-miniflux +./jeannie edge apply +``` + +PrivateBin stores browser-encrypted paste payloads under +`/data/homelab-privatebin/data`; discussions and file uploads are disabled and +pastes expire after one week by default. The edge publishes it as +`https://paste.lab2025.duckdns.org/` with a 2 MiB request limit and a dedicated +rate limit. + +Miniflux and its private PostgreSQL database live under +`/data/homelab-miniflux`. Jeannie preserves the generated database and initial +admin credentials in the root-owned `.env`. The edge publishes the native +Miniflux login at `https://feeds.lab2025.duckdns.org/` so API and feed-reader +clients remain compatible. + The Debian bare repo remains the GitOps mirror: ```text diff --git a/docs/jeannie.1.md b/docs/jeannie.1.md index 912ed25..ce39fcd 100644 --- a/docs/jeannie.1.md +++ b/docs/jeannie.1.md @@ -266,6 +266,12 @@ needed. `deploy-searxng` : Deploy the external SearXNG and Valkey Docker Compose stack on the Debian host. +`deploy-privatebin` +: Deploy the external browser-encrypted PrivateBin Compose service on Debian. + +`deploy-miniflux` +: Deploy the external Miniflux and PostgreSQL Compose stack on Debian. + `rpi-services` : Deploy Pi-hole, Unbound, and Uptime Kuma on the Raspberry Pi. @@ -619,6 +625,16 @@ is missing. Default is to fail and ask for host bootstrap. `LAB_SEARXNG_INSTALL_DOCKER=true` : Allow `deploy-searxng` to install Docker when it is missing. Default is to fail. +`LAB_PRIVATEBIN_DEPLOY=false`, `LAB_MINIFLUX_DEPLOY=false` +: Skip the corresponding Debian privacy service during `up`. + +`LAB_PRIVATEBIN_INSTALL_DIR`, `LAB_MINIFLUX_INSTALL_DIR` +: Override the install roots, which default to `/data/homelab-privatebin` and +`/data/homelab-miniflux`. + +`LAB_PRIVATEBIN_HTTP_PORT`, `LAB_MINIFLUX_HTTP_PORT` +: Override the local service ports, which default to `8889` and `8890`. + `LAB_RPI_INSTALL_DOCKER=true` : Allow `rpi-services` to install Docker through `get.docker.com` on the Raspberry Pi when Docker is missing. Default is to fail. diff --git a/docs/service-catalog.md b/docs/service-catalog.md index 4b31e48..a4b6e48 100644 --- a/docs/service-catalog.md +++ b/docs/service-catalog.md @@ -23,6 +23,8 @@ Update `homelab.yml`, then run `scripts/render-service-catalog`. | Service Catalog | Kubernetes | Generated from homelab.yml | [local](http://192.168.100.240/demo-apps/homelab-catalog/) | [public](https://demos.lab2025.duckdns.org/homelab-catalog/) | `docs/service-catalog.md` | | Gitea | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-gitea | [local](http://192.168.100.73:3000/) | [public](https://lab2025.duckdns.org/git/) | `infra/gitea/README.md` | | SearXNG | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-searxng | [local](http://192.168.100.73:8888/) | [public](https://search.lab2025.duckdns.org/) | `infra/searxng/README.md` | +| PrivateBin | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-privatebin | [local](http://192.168.100.73:8889/) | [public](https://paste.lab2025.duckdns.org/) | `infra/privatebin/README.md` | +| Miniflux | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-miniflux | [local](http://192.168.100.73:8890/) | [public](https://feeds.lab2025.duckdns.org/) | `infra/miniflux/README.md` | | GitOps mirror | debian (control-plane, 192.168.100.73) | Bare Git repository | `/home/jv/git-server/my-homelab-configs.git` | [public](ssh://jv@192.168.100.73/home/jv/git-server/my-homelab-configs.git) | `README.md#gitops-and-gitea-actions` | | Container Registry | debian (control-plane, 192.168.100.73) | Argo CD / apps/container-registry | [local](http://192.168.100.73:30500/v2/_catalog) | | `apps/container-registry/` | | Traefik | Kubernetes | OpenTofu / bootstrap/platform | [local](http://192.168.100.240/) | [public](https://lab2025.duckdns.org) | `README.md#loadbalancer-services` | diff --git a/docs/templates/app-ops.md.tmpl b/docs/templates/app-ops.md.tmpl index 590a48a..d36fb4d 100644 --- a/docs/templates/app-ops.md.tmpl +++ b/docs/templates/app-ops.md.tmpl @@ -348,6 +348,29 @@ the JSON result format remains enabled for later homelab AI-tool integration. Run the service deploy before `./{{ main_script }} edge apply` when reconciling the route separately. +## Privacy services + +PrivateBin and Miniflux are independent Debian Docker Compose stacks rather +than Kubernetes workloads. Deploy them with: + +```bash +./{{ main_script }} deploy-privatebin +./{{ main_script }} deploy-miniflux +./{{ main_script }} edge apply +``` + +PrivateBin stores browser-encrypted paste payloads under +`/data/homelab-privatebin/data`; discussions and file uploads are disabled and +pastes expire after one week by default. The edge publishes it as +`https://paste.lab2025.duckdns.org/` with a 2 MiB request limit and a dedicated +rate limit. + +Miniflux and its private PostgreSQL database live under +`/data/homelab-miniflux`. Jeannie preserves the generated database and initial +admin credentials in the root-owned `.env`. The edge publishes the native +Miniflux login at `https://feeds.lab2025.duckdns.org/` so API and feed-reader +clients remain compatible. + The Debian bare repo remains the GitOps mirror: ```text diff --git a/homelab.yml b/homelab.yml index 7394976..714089a 100644 --- a/homelab.yml +++ b/homelab.yml @@ -31,6 +31,8 @@ domain: - maintainerr.lab2025.duckdns.org - api.lab2025.duckdns.org - search.lab2025.duckdns.org + - paste.lab2025.duckdns.org + - feeds.lab2025.duckdns.org network: lan_cidr: 192.168.100.0/24 @@ -196,6 +198,16 @@ services: install_dir: /data/homelab-searxng http_port: 8888 public_url: https://search.lab2025.duckdns.org/ + privatebin: + host: debian + install_dir: /data/homelab-privatebin + http_port: 8889 + public_url: https://paste.lab2025.duckdns.org/ + miniflux: + host: debian + install_dir: /data/homelab-miniflux + http_port: 8890 + public_url: https://feeds.lab2025.duckdns.org/ gitops_mirror: host: debian path: /home/jv/git-server/my-homelab-configs.git diff --git a/infra/heimdall/homepage/services.yaml b/infra/heimdall/homepage/services.yaml index 21830ba..e4c5b6c 100644 --- a/infra/heimdall/homepage/services.yaml +++ b/infra/heimdall/homepage/services.yaml @@ -19,6 +19,14 @@ href: "https://search.lab2025.duckdns.org/" description: "Privacy-respecting homelab metasearch" icon: "mdi-magnify" + - PrivateBin: + href: "https://paste.lab2025.duckdns.org/" + description: "Browser-encrypted expiring paste service" + icon: "mdi-content-paste" + - Miniflux: + href: "https://feeds.lab2025.duckdns.org/" + description: "Private RSS reader with tracker filtering" + icon: "mdi-rss" - Service Catalog: href: "https://demos.lab2025.duckdns.org/homelab-catalog/" description: "Generated host, service, route, and runbook map from homelab.yml" diff --git a/infra/heimdall/links.json b/infra/heimdall/links.json index a062a39..a73e6a3 100644 --- a/infra/heimdall/links.json +++ b/infra/heimdall/links.json @@ -104,6 +104,20 @@ "colour": "#22a699", "class": "SearXNG" }, + { + "title": "PrivateBin", + "url": "https://paste.lab2025.duckdns.org/", + "description": "Browser-encrypted expiring paste service", + "colour": "#4f46e5", + "class": "PrivateBin" + }, + { + "title": "Miniflux", + "url": "https://feeds.lab2025.duckdns.org/", + "description": "Private RSS reader with tracker filtering", + "colour": "#f97316", + "class": "Miniflux" + }, { "title": "Service Catalog", "url": "https://demos.lab2025.duckdns.org/homelab-catalog/", diff --git a/infra/miniflux/README.md b/infra/miniflux/README.md new file mode 100644 index 0000000..a91dccf --- /dev/null +++ b/infra/miniflux/README.md @@ -0,0 +1,16 @@ +# Miniflux + +Jeannie deploys Miniflux and its dedicated PostgreSQL database as an independent +Docker Compose stack on Debian. It is not coupled to Kubernetes availability. + +Runtime data and the generated credentials remain under +`/data/homelab-miniflux`. The initial username defaults to `jv`; read the +root-owned `.env` on Debian to retrieve the generated initial password. + +```sh +./jeannie deploy-miniflux +sudo sed -n 's/^MINIFLUX_ADMIN_PASSWORD=//p' /data/homelab-miniflux/.env +./jeannie edge apply +``` + +Public URL: `https://feeds.lab2025.duckdns.org/` diff --git a/infra/miniflux/docker-compose.yml b/infra/miniflux/docker-compose.yml new file mode 100644 index 0000000..2aad50a --- /dev/null +++ b/infra/miniflux/docker-compose.yml @@ -0,0 +1,61 @@ +name: homelab-miniflux + +services: + miniflux: + image: ${MINIFLUX_IMAGE:-docker.io/miniflux/miniflux:2.3.6} + container_name: ${MINIFLUX_CONTAINER_NAME:-homelab-miniflux} + restart: unless-stopped + depends_on: + db: + condition: service_healthy + environment: + DATABASE_URL: postgres://miniflux:${MINIFLUX_DB_PASSWORD}@db/miniflux?sslmode=disable + RUN_MIGRATIONS: "1" + CREATE_ADMIN: "1" + ADMIN_USERNAME: ${MINIFLUX_ADMIN_USERNAME:-jv} + ADMIN_PASSWORD: ${MINIFLUX_ADMIN_PASSWORD} + BASE_URL: ${MINIFLUX_PUBLIC_URL:-https://feeds.lab2025.duckdns.org/} + HTTPS: "1" + LISTEN_ADDR: 0.0.0.0:8080 + ports: + - "${MINIFLUX_BIND_IP:-0.0.0.0}:${MINIFLUX_HTTP_PORT:-8890}:8080/tcp" + security_opt: + - no-new-privileges:true + cap_drop: + - ALL + mem_limit: 256m + pids_limit: 128 + healthcheck: + test: ["CMD", "/usr/bin/miniflux", "-healthcheck", "auto"] + interval: 30s + timeout: 5s + retries: 5 + start_period: 20s + networks: + - miniflux + + db: + image: ${MINIFLUX_POSTGRES_IMAGE:-docker.io/postgres:18-alpine} + container_name: ${MINIFLUX_DB_CONTAINER_NAME:-homelab-miniflux-db} + restart: unless-stopped + environment: + POSTGRES_DB: miniflux + POSTGRES_USER: miniflux + POSTGRES_PASSWORD: ${MINIFLUX_DB_PASSWORD} + volumes: + - ./postgres:/var/lib/postgresql + security_opt: + - no-new-privileges:true + mem_limit: 384m + pids_limit: 128 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U miniflux -d miniflux"] + interval: 15s + timeout: 5s + retries: 10 + networks: + - miniflux + +networks: + miniflux: + name: homelab-miniflux diff --git a/infra/privatebin/README.md b/infra/privatebin/README.md new file mode 100644 index 0000000..58f4038 --- /dev/null +++ b/infra/privatebin/README.md @@ -0,0 +1,15 @@ +# PrivateBin + +Jeannie deploys PrivateBin as an independent Docker Compose service on Debian, +outside Kubernetes. Browser-side encryption means the server stores encrypted +paste payloads only. The public OCI edge applies request and body-size limits. + +Runtime data lives under `/data/homelab-privatebin/data`. Pastes expire after +one week by default; file uploads and public discussions are disabled. + +```sh +./jeannie deploy-privatebin +./jeannie edge apply +``` + +Public URL: `https://paste.lab2025.duckdns.org/` diff --git a/infra/privatebin/conf.php b/infra/privatebin/conf.php new file mode 100644 index 0000000..fac5107 --- /dev/null +++ b/infra/privatebin/conf.php @@ -0,0 +1,31 @@ +; PrivateBin stores only browser-encrypted content. Expired pastes are purged +; probabilistically on requests, while the default paste lifetime is one week. +[main] +name = "Homelab PrivateBin" +discussion = false +opendiscussion = false +password = true +fileupload = false +burnafterreadingselected = false +defaultformatter = "plaintext" +sizelimit = 2097152 +template = "bootstrap5" + +[expire] +default = "1week" + +[expire_options] +5min = 300 +1hour = 3600 +1day = 86400 +1week = 604800 + +[purge] +limit = 300 +batchsize = 10 + +[model] +class = Filesystem + +[model_options] +dir = PATH "data" diff --git a/infra/privatebin/docker-compose.yml b/infra/privatebin/docker-compose.yml new file mode 100644 index 0000000..8baaae0 --- /dev/null +++ b/infra/privatebin/docker-compose.yml @@ -0,0 +1,28 @@ +name: homelab-privatebin + +services: + privatebin: + image: ${PRIVATEBIN_IMAGE:-docker.io/privatebin/nginx-fpm-alpine:2.1.0-alpine3.24} + container_name: ${PRIVATEBIN_CONTAINER_NAME:-homelab-privatebin} + restart: unless-stopped + read_only: true + ports: + - "${PRIVATEBIN_BIND_IP:-0.0.0.0}:${PRIVATEBIN_HTTP_PORT:-8889}:8080/tcp" + volumes: + - ./data:/srv/data + - ./conf.php:/srv/cfg/conf.php:ro + tmpfs: + - /tmp:nodev,noexec,nosuid,mode=1777 + - /run:nodev,nosuid,mode=1777 + security_opt: + - no-new-privileges:true + cap_drop: + - ALL + mem_limit: 256m + pids_limit: 128 + healthcheck: + test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/"] + interval: 30s + timeout: 5s + retries: 5 + start_period: 20s diff --git a/jeannie b/jeannie index 557630b..2990934 100755 --- a/jeannie +++ b/jeannie @@ -80,6 +80,8 @@ Build And Bootstrap deploy-api Deploy the Temporal-backed Jeannie API on Debian. deploy-heimdall Deploy the Debian-hosted Heimdall dashboard. deploy-searxng Deploy Debian-hosted SearXNG and Valkey. + deploy-privatebin Deploy Debian-hosted encrypted paste service. + deploy-miniflux Deploy Debian-hosted private RSS reader. 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. @@ -701,6 +703,14 @@ case "${1:-}" in record_change_journal "deploy-searxng" "$@" deploy_searxng ;; + deploy-privatebin) + record_change_journal "deploy-privatebin" "$@" + deploy_privatebin + ;; + deploy-miniflux) + record_change_journal "deploy-miniflux" "$@" + deploy_miniflux + ;; deploy-dex) record_change_journal "deploy-dex" "$@" deploy_dex diff --git a/lib/jeannie/commands.sh b/lib/jeannie/commands.sh index ad9568a..80d952b 100644 --- a/lib/jeannie/commands.sh +++ b/lib/jeannie/commands.sh @@ -2459,6 +2459,8 @@ status_report() { status_compose_stack "gitea" "/data/homelab-gitea" status_compose_stack "heimdall" "${LAB_HEIMDALL_INSTALL_DIR:-/data/homelab-heimdall}" 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_compose_stack "dex" "${LAB_DEX_INSTALL_DIR:-/data/homelab-dex}" status_compose_stack "arr-stack" "${REPO_ROOT}/infra/arr-stack" @@ -2479,6 +2481,8 @@ status_report() { status_http "gitea public" "${LAB_GITEA_ROOT_URL:-${LAB_PUBLIC_URL:?LAB_PUBLIC_URL is required from homelab.yml}/git/}" status_http "heimdall public" "${LAB_HEIMDALL_PUBLIC_URL:-https://heimdall.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" 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 "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}/" @@ -3110,6 +3114,8 @@ doctor_homelab() { report_ui_check fail "Debian Services" "Gitea local HTTP" "./jeannie deploy-gitea" "" "" status_http_ok "http://127.0.0.1:${LAB_GITEA_HTTP_PORT:-3000}/" || failures=$((failures + 1)) report_ui_check fail "Debian Services" "Dex local HTTP" "./jeannie deploy-dex" "" "" status_dex_local_ok || failures=$((failures + 1)) report_ui_check fail "Debian Services" "SearXNG local HTTP" "./jeannie deploy-searxng" "" "" status_http_ok "http://127.0.0.1:${LAB_SEARXNG_HTTP_PORT:-8888}/healthz" || failures=$((failures + 1)) + report_ui_check fail "Debian Services" "PrivateBin local HTTP" "./jeannie deploy-privatebin" "" "" status_http_ok "http://127.0.0.1:${LAB_PRIVATEBIN_HTTP_PORT:-8889}/" || failures=$((failures + 1)) + report_ui_check fail "Debian Services" "Miniflux local HTTP" "./jeannie deploy-miniflux" "" "" status_http_ok "http://127.0.0.1:${LAB_MINIFLUX_HTTP_PORT:-8890}/healthcheck" || failures=$((failures + 1)) report_ui_check warn "Debian Services" "Ollama API" "./jeannie ollama-setup" "" "" status_ollama_local_ok report_ui_check warn "Debian Services" "Gitea runner service" "./jeannie install-gitea-runner" "" "" check_systemd_active homelab-gitea-runner @@ -3125,6 +3131,8 @@ doctor_homelab() { report_ui_check fail "Edge/Public" "Demos public URL" "./jeannie apps" "" "" status_http_ok "https://demos.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/" || failures=$((failures + 1)) report_ui_check fail "Edge/Public" "Dex public URL" "./jeannie deploy-dex" "" "" status_http_reachable "${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" || failures=$((failures + 1)) report_ui_check fail "Edge/Public" "SearXNG public URL" "./jeannie deploy-searxng && ./jeannie edge apply" "" "" status_http_ok "${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" || failures=$((failures + 1)) + report_ui_check fail "Edge/Public" "PrivateBin public URL" "./jeannie deploy-privatebin && ./jeannie edge apply" "" "" status_http_ok "${LAB_PRIVATEBIN_PUBLIC_URL:-https://paste.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" || failures=$((failures + 1)) + report_ui_check fail "Edge/Public" "Miniflux public URL" "./jeannie deploy-miniflux && ./jeannie edge apply" "" "" status_http_ok "${LAB_MINIFLUX_PUBLIC_URL:-https://feeds.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" || failures=$((failures + 1)) report_ui_check warn "Operations" "Backup freshness" "./jeannie backup" "" "" backup_status report_ui_check warn "Operations" "Disk usage" "df -h / /data" "" "" status_disk_pressure @@ -3159,9 +3167,13 @@ doctor_homelab() { status_compose_stack "gitea" "/data/homelab-gitea" status_compose_stack "dex" "${LAB_DEX_INSTALL_DIR:-/data/homelab-dex}" 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_http "gitea local" "http://127.0.0.1:${LAB_GITEA_HTTP_PORT:-3000}/" status_http "dex local" "http://127.0.0.1:${LAB_DEX_HTTP_PORT:-5556}/healthz" 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 "ollama" "${LAB_OLLAMA_URL:-http://${LAB_DEBIAN_LAN_IP:-192.168.100.73}:11434}/api/tags" status_section "Edge And Public URLs" @@ -3173,6 +3185,8 @@ doctor_homelab() { status_http "demos public" "https://demos.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/" status_http "dex public" "${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" 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_section "Operations" backup_status || true diff --git a/lib/jeannie/env.sh b/lib/jeannie/env.sh index 440cd4d..bec1c2a 100644 --- a/lib/jeannie/env.sh +++ b/lib/jeannie/env.sh @@ -70,6 +70,12 @@ mapping = { "services.searxng.install_dir": "LAB_SEARXNG_INSTALL_DIR", "services.searxng.http_port": "LAB_SEARXNG_HTTP_PORT", "services.searxng.public_url": "LAB_SEARXNG_PUBLIC_URL", + "services.privatebin.install_dir": "LAB_PRIVATEBIN_INSTALL_DIR", + "services.privatebin.http_port": "LAB_PRIVATEBIN_HTTP_PORT", + "services.privatebin.public_url": "LAB_PRIVATEBIN_PUBLIC_URL", + "services.miniflux.install_dir": "LAB_MINIFLUX_INSTALL_DIR", + "services.miniflux.http_port": "LAB_MINIFLUX_HTTP_PORT", + "services.miniflux.public_url": "LAB_MINIFLUX_PUBLIC_URL", "services.local_registry.endpoint": "LAB_REGISTRY_ENDPOINT", "services.ollama.url": "LAB_OLLAMA_URL", "services.ollama.bind_address": "LAB_OLLAMA_BIND_ADDRESS", @@ -235,6 +241,8 @@ for service_name, env_name in [ ("dex", "LAB_DEX_BACKEND_HOST"), ("jellyfin", "LAB_JELLYFIN_BACKEND_HOST"), ("searxng", "LAB_SEARXNG_BACKEND_HOST"), + ("privatebin", "LAB_PRIVATEBIN_BACKEND_HOST"), + ("miniflux", "LAB_MINIFLUX_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 @@ -346,6 +354,10 @@ export_homelab_inventory_tf_vars() { export_if_unset TF_VAR_jellyfin_backend_port "${LAB_JELLYFIN_HTTP_PORT:-}" export_if_unset TF_VAR_searxng_backend_host "${LAB_SEARXNG_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}" export_if_unset TF_VAR_searxng_backend_port "${LAB_SEARXNG_HTTP_PORT:-8888}" + export_if_unset TF_VAR_privatebin_backend_host "${LAB_PRIVATEBIN_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}" + export_if_unset TF_VAR_privatebin_backend_port "${LAB_PRIVATEBIN_HTTP_PORT:-8889}" + export_if_unset TF_VAR_miniflux_backend_host "${LAB_MINIFLUX_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}" + export_if_unset TF_VAR_miniflux_backend_port "${LAB_MINIFLUX_HTTP_PORT:-8890}" export_if_unset TF_VAR_office_server_name "${LAB_OFFICE_PUBLIC_HOST:-office.${LAB_DOMAIN:-lab2025.duckdns.org}}" export_if_unset TF_VAR_office_backend_host "${LAB_OFFICE_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}" export_if_unset TF_VAR_office_backend_port "${LAB_OFFICE_HTTP_PORT:-8090}" diff --git a/lib/jeannie/pipeline.sh b/lib/jeannie/pipeline.sh index 0a0ec1d..2225032 100644 --- a/lib/jeannie/pipeline.sh +++ b/lib/jeannie/pipeline.sh @@ -5546,6 +5546,126 @@ deploy_searxng() { echo "SearXNG is healthy at http://127.0.0.1:${http_port}/ and will be published at ${public_url%/}/ by the edge stage." } +deploy_privatebin() { + local mode="${LAB_PRIVATEBIN_DEPLOY:-true}" + local install_dir="${LAB_PRIVATEBIN_INSTALL_DIR:-/data/homelab-privatebin}" + local http_port="${LAB_PRIVATEBIN_HTTP_PORT:-8889}" + local bind_ip="${LAB_PRIVATEBIN_BIND_IP:-0.0.0.0}" + local public_url="${LAB_PRIVATEBIN_PUBLIC_URL:-https://paste.${LAB_DOMAIN:-lab2025.duckdns.org}/}" + local image="${PRIVATEBIN_IMAGE:-docker.io/privatebin/nginx-fpm-alpine:2.1.0-alpine3.24}" + local container_name="${PRIVATEBIN_CONTAINER_NAME:-homelab-privatebin}" + local source_dir="${REPO_ROOT}/infra/privatebin" + local install_docker="${LAB_PRIVATEBIN_INSTALL_DOCKER:-false}" + local elapsed=0 + + require_debian_server "deploy-privatebin" + disabled_value "${mode}" && return 0 + + if ! [[ "${http_port}" =~ ^[0-9]+$ ]] || ((http_port < 1 || http_port > 65535)); then + echo "LAB_PRIVATEBIN_HTTP_PORT must be a valid TCP port." >&2 + return 1 + fi + if [[ ! -s "${source_dir}/docker-compose.yml" || ! -s "${source_dir}/conf.php" ]]; then + echo "Missing PrivateBin source files in ${source_dir}." >&2 + return 1 + fi + + ensure_local_docker_compose "PRIVATEBIN" "${install_docker}" + repair_local_docker_iptables + sudo mkdir -p "${install_dir}/data" + sudo cp "${source_dir}/docker-compose.yml" "${install_dir}/docker-compose.yml" + sudo cp "${source_dir}/conf.php" "${install_dir}/conf.php" + sudo chmod 0644 "${install_dir}/docker-compose.yml" "${install_dir}/conf.php" + sudo chown -R 65534:82 "${install_dir}/data" + + umask 077 + printf '%s\n' \ + "PRIVATEBIN_IMAGE=${image}" \ + "PRIVATEBIN_CONTAINER_NAME=${container_name}" \ + "PRIVATEBIN_BIND_IP=${bind_ip}" \ + "PRIVATEBIN_HTTP_PORT=${http_port}" | + sudo tee "${install_dir}/.env" >/dev/null + sudo chmod 0600 "${install_dir}/.env" + + (cd "${install_dir}" && sudo docker compose pull && sudo docker compose up -d --remove-orphans && sudo docker compose ps) + until curl -fsS --connect-timeout 5 "http://127.0.0.1:${http_port}/" >/dev/null; do + if ((elapsed >= 180)); then + echo "Timed out waiting for PrivateBin on http://127.0.0.1:${http_port}/" >&2 + (cd "${install_dir}" && sudo docker compose ps && sudo docker compose logs --tail=160) >&2 || true + return 1 + fi + sleep 5 + elapsed=$((elapsed + 5)) + done + echo "PrivateBin is healthy locally and will be published at ${public_url%/}/ by the edge stage." +} + +deploy_miniflux() { + local mode="${LAB_MINIFLUX_DEPLOY:-true}" + local install_dir="${LAB_MINIFLUX_INSTALL_DIR:-/data/homelab-miniflux}" + local http_port="${LAB_MINIFLUX_HTTP_PORT:-8890}" + local bind_ip="${LAB_MINIFLUX_BIND_IP:-0.0.0.0}" + local public_url="${LAB_MINIFLUX_PUBLIC_URL:-https://feeds.${LAB_DOMAIN:-lab2025.duckdns.org}/}" + local image="${MINIFLUX_IMAGE:-docker.io/miniflux/miniflux:2.3.6}" + local postgres_image="${MINIFLUX_POSTGRES_IMAGE:-docker.io/postgres:18-alpine}" + local source_dir="${REPO_ROOT}/infra/miniflux" + local install_docker="${LAB_MINIFLUX_INSTALL_DOCKER:-false}" + local admin_username="${MINIFLUX_ADMIN_USERNAME:-jv}" + local admin_password="" + local db_password="" + local elapsed=0 + + require_debian_server "deploy-miniflux" + disabled_value "${mode}" && return 0 + + if ! [[ "${http_port}" =~ ^[0-9]+$ ]] || ((http_port < 1 || http_port > 65535)); then + echo "LAB_MINIFLUX_HTTP_PORT must be a valid TCP port." >&2 + return 1 + fi + if [[ ! -s "${source_dir}/docker-compose.yml" ]]; then + echo "Missing Miniflux source files in ${source_dir}." >&2 + return 1 + fi + + ensure_local_docker_compose "MINIFLUX" "${install_docker}" + repair_local_docker_iptables + sudo mkdir -p "${install_dir}/postgres" + sudo cp "${source_dir}/docker-compose.yml" "${install_dir}/docker-compose.yml" + sudo chmod 0644 "${install_dir}/docker-compose.yml" + + if sudo test -s "${install_dir}/.env"; then + admin_password="$(sudo sed -n 's/^MINIFLUX_ADMIN_PASSWORD=//p' "${install_dir}/.env" | head -n 1)" + db_password="$(sudo sed -n 's/^MINIFLUX_DB_PASSWORD=//p' "${install_dir}/.env" | head -n 1)" + fi + [[ "${admin_password}" =~ ^[[:xdigit:]]{48}$ ]] || admin_password="$(openssl rand -hex 24)" + [[ "${db_password}" =~ ^[[:xdigit:]]{48}$ ]] || db_password="$(openssl rand -hex 24)" + + umask 077 + printf '%s\n' \ + "MINIFLUX_IMAGE=${image}" \ + "MINIFLUX_POSTGRES_IMAGE=${postgres_image}" \ + "MINIFLUX_BIND_IP=${bind_ip}" \ + "MINIFLUX_HTTP_PORT=${http_port}" \ + "MINIFLUX_PUBLIC_URL=${public_url%/}/" \ + "MINIFLUX_ADMIN_USERNAME=${admin_username}" \ + "MINIFLUX_ADMIN_PASSWORD=${admin_password}" \ + "MINIFLUX_DB_PASSWORD=${db_password}" | + sudo tee "${install_dir}/.env" >/dev/null + sudo chmod 0600 "${install_dir}/.env" + + (cd "${install_dir}" && sudo docker compose pull && sudo docker compose up -d --remove-orphans && sudo docker compose ps) + until curl -fsS --connect-timeout 5 "http://127.0.0.1:${http_port}/healthcheck" >/dev/null; do + if ((elapsed >= 240)); then + echo "Timed out waiting for Miniflux on http://127.0.0.1:${http_port}/healthcheck" >&2 + (cd "${install_dir}" && sudo docker compose ps && sudo docker compose logs --tail=160) >&2 || true + return 1 + fi + sleep 5 + elapsed=$((elapsed + 5)) + done + echo "Miniflux is healthy at ${public_url%/}/. Initial credentials remain in ${install_dir}/.env." +} + deploy_matrix() { local mode="${LAB_MATRIX_DEPLOY:-true}" local install_dir="${LAB_MATRIX_INSTALL_DIR:-/home/jv/matrix-server}" @@ -8979,6 +9099,16 @@ spec = { "title": "SearXNG deploy", "command": [jeannie, "__up-task", "searxng-deploy"], }, + { + "id": "privatebin-deploy", + "title": "PrivateBin deploy", + "command": [jeannie, "__up-task", "privatebin-deploy"], + }, + { + "id": "miniflux-deploy", + "title": "Miniflux deploy", + "command": [jeannie, "__up-task", "miniflux-deploy"], + }, { "id": "dex-deploy", "title": "Dex deploy", @@ -9063,6 +9193,12 @@ up_task() { searxng-deploy) deploy_searxng ;; + privatebin-deploy) + deploy_privatebin + ;; + miniflux-deploy) + deploy_miniflux + ;; dex-deploy) deploy_dex ;; diff --git a/scripts/generate-heimdall-links b/scripts/generate-heimdall-links index 0541310..690280c 100755 --- a/scripts/generate-heimdall-links +++ b/scripts/generate-heimdall-links @@ -51,6 +51,8 @@ HOST_METADATA = { "maintainerr": ("Maintainerr", "Media list maintenance automation", "#14b8a6", "Maintainerr"), "flaresolverr": ("FlareSolverr", "Browser challenge solver service for ARR automation", "#64748b", "FlareSolverr"), "search": ("SearXNG", "Privacy-respecting homelab metasearch", "#22a699", "SearXNG"), + "paste": ("PrivateBin", "Browser-encrypted expiring paste service", "#4f46e5", "PrivateBin"), + "feeds": ("Miniflux", "Private RSS reader with tracker filtering", "#f97316", "Miniflux"), } diff --git a/scripts/generate-homepage-config b/scripts/generate-homepage-config index 2e662e0..9377397 100755 --- a/scripts/generate-homepage-config +++ b/scripts/generate-homepage-config @@ -21,6 +21,8 @@ SERVICE_GROUPS = { "Heimdall": "Public", "Service Catalog": "Public", "SearXNG": "Public", + "PrivateBin": "Public", + "Miniflux": "Public", "Gitea": "Platform", "Argo CD": "Platform", "Grafana": "Platform", @@ -65,6 +67,8 @@ ICON_MAP = { "Heimdall": "heimdall.png", "Service Catalog": "mdi-map", "SearXNG": "mdi-magnify", + "PrivateBin": "mdi-content-paste", + "Miniflux": "mdi-rss", "Gitea": "gitea.png", "Argo CD": "argocd.png", "Grafana": "grafana.png", diff --git a/scripts/render-service-catalog b/scripts/render-service-catalog index 5fdc2cc..8729de2 100755 --- a/scripts/render-service-catalog +++ b/scripts/render-service-catalog @@ -136,6 +136,22 @@ def service_rows(values: dict[str, object]) -> list[dict[str, str]]: "public": value(values, "services.searxng.public_url", f"https://search.{domain}/"), "docs": "infra/searxng/README.md", }, + { + "name": "PrivateBin", + "host": value(values, "services.privatebin.host", "debian"), + "managed_by": "Docker Compose / jeannie deploy-privatebin", + "local": f"http://{debian_ip}:{value(values, 'services.privatebin.http_port', '8889')}/", + "public": value(values, "services.privatebin.public_url", f"https://paste.{domain}/"), + "docs": "infra/privatebin/README.md", + }, + { + "name": "Miniflux", + "host": value(values, "services.miniflux.host", "debian"), + "managed_by": "Docker Compose / jeannie deploy-miniflux", + "local": f"http://{debian_ip}:{value(values, 'services.miniflux.http_port', '8890')}/", + "public": value(values, "services.miniflux.public_url", f"https://feeds.{domain}/"), + "docs": "infra/miniflux/README.md", + }, { "name": "GitOps mirror", "host": value(values, "services.gitops_mirror.host", "debian"), diff --git a/scripts/validate-homelab b/scripts/validate-homelab index 3c61e13..4ecb147 100755 --- a/scripts/validate-homelab +++ b/scripts/validate-homelab @@ -134,6 +134,7 @@ validate_unit_tests() { python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_monitoring_debian.py' python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_monitoring_readiness.py' python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_searxng_pipeline.py' + python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_privacy_services_pipeline.py' python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_doctor_k3s_storage.py' python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_holmes_evidence.py' if [[ -x "${LAB_HOLMES_ADAPTER_PYTHON:-/home/jv/.local/share/pipx/venvs/holmesgpt/bin/python}" ]]; then diff --git a/scripts/validate-homelab-inventory b/scripts/validate-homelab-inventory index 09adbf8..c94a6df 100755 --- a/scripts/validate-homelab-inventory +++ b/scripts/validate-homelab-inventory @@ -71,6 +71,8 @@ else: "services.gitea.root_url", "services.heimdall.public_url", "services.searxng.public_url", + "services.privatebin.public_url", + "services.miniflux.public_url", "services.local_registry.endpoint", "services.traefik.load_balancer_ip", ): @@ -78,6 +80,8 @@ else: require("pimox.default_worker_count", None) require("services.heimdall.http_port", None) require("services.searxng.http_port", None) + require("services.privatebin.http_port", None) + require("services.miniflux.http_port", None) subdomains = require("domain.subdomains", list) if isinstance(subdomains, list): @@ -169,6 +173,10 @@ required_paths = %w[ services.heimdall.public_url services.searxng.http_port services.searxng.public_url + services.privatebin.http_port + services.privatebin.public_url + services.miniflux.http_port + services.miniflux.public_url services.local_registry.endpoint services.traefik.load_balancer_ip pimox.default_worker_count diff --git a/tests/jeannie/test_privacy_services_pipeline.py b/tests/jeannie/test_privacy_services_pipeline.py new file mode 100644 index 0000000..2dfccc9 --- /dev/null +++ b/tests/jeannie/test_privacy_services_pipeline.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + +import pathlib +import unittest + + +ROOT = pathlib.Path(__file__).resolve().parents[2] + + +class PrivacyServicesPipelineTests(unittest.TestCase): + def test_privatebin_is_hardened_and_persistent(self): + compose = (ROOT / "infra/privatebin/docker-compose.yml").read_text(encoding="utf-8") + config = (ROOT / "infra/privatebin/conf.php").read_text(encoding="utf-8") + self.assertIn("privatebin/nginx-fpm-alpine:2.1.0-alpine3.24", compose) + self.assertIn("read_only: true", compose) + self.assertIn("./data:/srv/data", compose) + self.assertIn('default = "1week"', config) + self.assertIn("fileupload = false", config) + + def test_miniflux_has_private_database_and_healthcheck(self): + compose = (ROOT / "infra/miniflux/docker-compose.yml").read_text(encoding="utf-8") + self.assertIn("miniflux/miniflux:2.3.6", compose) + self.assertIn("postgres:18-alpine", compose) + self.assertIn("./postgres:/var/lib/postgresql", compose) + self.assertIn('"-healthcheck", "auto"', compose) + self.assertNotIn("ports:\n - \"5432", compose) + + def test_pipeline_preserves_generated_credentials_and_runs_in_up(self): + pipeline = (ROOT / "lib/jeannie/pipeline.sh").read_text(encoding="utf-8") + self.assertIn("deploy_privatebin()", pipeline) + self.assertIn("deploy_miniflux()", pipeline) + self.assertIn("MINIFLUX_ADMIN_PASSWORD=//p", pipeline) + self.assertIn('"id": "privatebin-deploy"', pipeline) + self.assertIn('"id": "miniflux-deploy"', pipeline) + + def test_edge_has_dedicated_routes_and_limits(self): + nginx = (ROOT / "bootstrap/edge/templates/default.conf.tftpl").read_text(encoding="utf-8") + main = (ROOT / "bootstrap/edge/main.tf").read_text(encoding="utf-8") + self.assertIn("server_name ${privatebin_server_name};", nginx) + self.assertIn("zone=privatebin_write", nginx) + self.assertIn("server_name ${miniflux_server_name};", nginx) + self.assertIn("/healthcheck", nginx) + self.assertIn('privatebin_server_name = "paste.${var.server_name}"', main) + self.assertIn('miniflux_server_name', main) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/jeannie/test_searxng_pipeline.py b/tests/jeannie/test_searxng_pipeline.py index ddd25fe..fcb2cff 100644 --- a/tests/jeannie/test_searxng_pipeline.py +++ b/tests/jeannie/test_searxng_pipeline.py @@ -25,7 +25,8 @@ class SearxngPipelineTests(unittest.TestCase): def test_edge_has_dedicated_route_not_generic_backend(self): main = (ROOT / "bootstrap/edge/main.tf").read_text(encoding="utf-8") nginx = (ROOT / "bootstrap/edge/templates/default.conf.tftpl").read_text(encoding="utf-8") - self.assertIn('searxng_server_name = "search.${var.server_name}"', main) + self.assertIn('searxng_server_name', main) + self.assertIn('"search.${var.server_name}"', main) self.assertIn("server_name ${searxng_server_name};", nginx) self.assertIn("zone=searxng_search", nginx) self.assertIn("proxy_pass http://${searxng_backend_host}:${searxng_backend_port}", nginx)