Compare commits
6 Commits
d03fa5021f
...
renovate/n
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b5dd00474 | |||
| a30e60b557 | |||
| 2536e855e5 | |||
| dbe11dc8fa | |||
| b27f3e58ca | |||
| 5b3f2cf8f4 |
38
1-nixos-node/.terraform.lock.hcl
generated
38
1-nixos-node/.terraform.lock.hcl
generated
@@ -2,22 +2,32 @@
|
|||||||
# Manual edits may be lost in future updates.
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
provider "registry.terraform.io/hashicorp/null" {
|
provider "registry.terraform.io/hashicorp/null" {
|
||||||
version = "3.2.1"
|
version = "3.2.4"
|
||||||
constraints = "3.2.1"
|
constraints = "3.2.4"
|
||||||
hashes = [
|
hashes = [
|
||||||
"h1:FbGfc+muBsC17Ohy5g806iuI1hQc4SIexpYCrQHQd8w=",
|
"h1:+Ag4hSb4qQjNtAS6gj2+gsGl7v0iB/Bif6zZZU8lXsw=",
|
||||||
"zh:58ed64389620cc7b82f01332e27723856422820cfd302e304b5f6c3436fb9840",
|
"h1:127ts0CG8hFk1bHIfrBsKxcnt9bAYQCq3udWM+AACH8=",
|
||||||
"zh:62a5cc82c3b2ddef7ef3a6f2fedb7b9b3deff4ab7b414938b08e51d6e8be87cb",
|
"h1:1fD1DCOTkei4uxrLwszCkQapuZcw5sq4CatKFtRg58E=",
|
||||||
"zh:63cff4de03af983175a7e37e52d4bd89d990be256b16b5c7f919aff5ad485aa5",
|
"h1:DskWuCIvJ4FBUpngJsiRCtVFiKZMQbT3WQgn9GBnFPc=",
|
||||||
"zh:74cb22c6700e48486b7cabefa10b33b801dfcab56f1a6ac9b6624531f3d36ea3",
|
"h1:L5V05xwp/Gto1leRryuesxjMfgZwjb7oool4WS1UEFQ=",
|
||||||
|
"h1:Oz/OcdizPzjor4pnGHNvcXURwyS6uDDXAZccg4R6iR4=",
|
||||||
|
"h1:TpiL9vwc23kFuJgQlFsgIlaI4WjAsX9H3LLzcZ36Yfs=",
|
||||||
|
"h1:VMNuSHZMkfsbrzvhpp6lzm2vWdmT/1vuUdW0x+Dsa0Q=",
|
||||||
|
"h1:dNVrmZwFvVPlL2FqTMDasI6mbDIr9pcn7tHexkZU9z8=",
|
||||||
|
"h1:hkf5w5B6q8e2A42ND2CjAvgvSN3puAosDmOJb3zCVQM=",
|
||||||
|
"h1:wTNrZnwQdOOT/TW9pa+7GgJeFK2OvTvDmx78VmUmZXM=",
|
||||||
|
"zh:59f6b52ab4ff35739647f9509ee6d93d7c032985d9f8c6237d1f8a59471bbbe2",
|
||||||
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
|
"zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
|
||||||
"zh:79e553aff77f1cfa9012a2218b8238dd672ea5e1b2924775ac9ac24d2a75c238",
|
"zh:795c897119ff082133150121d39ff26cb5f89a730a2c8c26f3a9c1abf81a9c43",
|
||||||
"zh:a1e06ddda0b5ac48f7e7c7d59e1ab5a4073bbcf876c73c0299e4610ed53859dc",
|
"zh:7b9c7b16f118fbc2b05a983817b8ce2f86df125857966ad356353baf4bff5c0a",
|
||||||
"zh:c37a97090f1a82222925d45d84483b2aa702ef7ab66532af6cbcfb567818b970",
|
"zh:85e33ab43e0e1726e5f97a874b8e24820b6565ff8076523cc2922ba671492991",
|
||||||
"zh:e4453fbebf90c53ca3323a92e7ca0f9961427d2f0ce0d2b65523cc04d5d999c2",
|
"zh:9d32ac3619cfc93eb3c4f423492a8e0f79db05fec58e449dee9b2d5873d5f69f",
|
||||||
"zh:e80a746921946d8b6761e77305b752ad188da60688cfd2059322875d363be5f5",
|
"zh:9e15c3c9dd8e0d1e3731841d44c34571b6c97f5b95e8296a45318b94e5287a6e",
|
||||||
"zh:fbdb892d9822ed0e4cb60f2fedbdbb556e4da0d88d3b942ae963ed6ff091e48f",
|
"zh:b4c2ab35d1b7696c30b64bf2c0f3a62329107bd1a9121ce70683dec58af19615",
|
||||||
"zh:fca01a623d90d0cad0843102f9b8b9fe0d3ff8244593bd817f126582b52dd694",
|
"zh:c43723e8cc65bcdf5e0c92581dcbbdcbdcf18b8d2037406a5f2033b1e22de442",
|
||||||
|
"zh:ceb5495d9c31bfb299d246ab333f08c7fb0d67a4f82681fbf47f2a21c3e11ab5",
|
||||||
|
"zh:e171026b3659305c558d9804062762d168f50ba02b88b231d20ec99578a6233f",
|
||||||
|
"zh:ed0fe2acdb61330b01841fa790be00ec6beaac91d41f311fb8254f74eb6a711f",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
preferred_address_family = "ipv4";
|
preferred_address_family = "ipv4";
|
||||||
%{if cpu_total_compute != null ~}
|
%{if cpu_total_compute != null ~}
|
||||||
cpu_total_compute = ${cpu_total_compute};
|
cpu_total_compute = ${cpu_total_compute};
|
||||||
|
%{endif ~}
|
||||||
|
%{if node_class != null ~}
|
||||||
|
node_class = "${node_class}";
|
||||||
%{endif ~}
|
%{endif ~}
|
||||||
host_volume = {
|
host_volume = {
|
||||||
%{ for volume in host_volumes ~}
|
%{ for volume in host_volumes ~}
|
||||||
@@ -116,6 +119,17 @@
|
|||||||
# Ensure Docker daemon is available (Nomad enableDocker only configures Nomad, does not guarantee docker service)
|
# Ensure Docker daemon is available (Nomad enableDocker only configures Nomad, does not guarantee docker service)
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
|
|
||||||
|
%{if node_class == "latte-panda-n150" ~}
|
||||||
|
# Enable Intel iGPU (N150 UHD Graphics) for OpenVINO / VA-API workloads running in Docker
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
intel-media-driver # VA-API (iHD)
|
||||||
|
intel-compute-runtime # OpenCL / oneAPI
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
%{endif ~}
|
||||||
# Proper systemd service definition for macvlan network creation
|
# Proper systemd service definition for macvlan network creation
|
||||||
systemd.services.docker-macvlan-network = {
|
systemd.services.docker-macvlan-network = {
|
||||||
description = "Ensure macvlan Docker network exists";
|
description = "Ensure macvlan Docker network exists";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ terraform {
|
|||||||
required_providers {
|
required_providers {
|
||||||
null = {
|
null = {
|
||||||
source = "hashicorp/null"
|
source = "hashicorp/null"
|
||||||
version = "3.2.1"
|
version = "3.2.4"
|
||||||
}
|
}
|
||||||
template = {
|
template = {
|
||||||
source = "hashicorp/template"
|
source = "hashicorp/template"
|
||||||
@@ -21,6 +21,7 @@ variable "nodes" {
|
|||||||
bind_interface = string
|
bind_interface = string
|
||||||
bootstrap = optional(bool, false) # Optional field for bootstrap nodes
|
bootstrap = optional(bool, false) # Optional field for bootstrap nodes
|
||||||
cpu_total_compute = optional(number, null) # Optional field for CPU total compute
|
cpu_total_compute = optional(number, null) # Optional field for CPU total compute
|
||||||
|
node_class = optional(string, null) # Optional Nomad node_class for scheduling constraints
|
||||||
host_volumes = list(string)
|
host_volumes = list(string)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@@ -32,6 +33,7 @@ locals {
|
|||||||
bind_interface = v.bind_interface
|
bind_interface = v.bind_interface
|
||||||
bootstrap = v.bootstrap
|
bootstrap = v.bootstrap
|
||||||
cpu_total_compute = v.cpu_total_compute
|
cpu_total_compute = v.cpu_total_compute
|
||||||
|
node_class = v.node_class
|
||||||
host_volumes = v.host_volumes
|
host_volumes = v.host_volumes
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -157,11 +157,6 @@ http:
|
|||||||
service: unraid
|
service: unraid
|
||||||
middlewares:
|
middlewares:
|
||||||
- auth
|
- auth
|
||||||
frigate:
|
|
||||||
rule: "Host(`frigate.othrayte.one`)"
|
|
||||||
service: frigate
|
|
||||||
middlewares:
|
|
||||||
- auth
|
|
||||||
kopia:
|
kopia:
|
||||||
rule: "Host(`kopia.othrayte.one`)"
|
rule: "Host(`kopia.othrayte.one`)"
|
||||||
service: kopia
|
service: kopia
|
||||||
@@ -199,10 +194,6 @@ http:
|
|||||||
loadBalancer:
|
loadBalancer:
|
||||||
servers:
|
servers:
|
||||||
- url: "http://betelgeuse-seven-unraid.lan:80"
|
- url: "http://betelgeuse-seven-unraid.lan:80"
|
||||||
frigate:
|
|
||||||
loadBalancer:
|
|
||||||
servers:
|
|
||||||
- url: "http://betelgeuse-seven-unraid.lan:5000"
|
|
||||||
kopia:
|
kopia:
|
||||||
loadBalancer:
|
loadBalancer:
|
||||||
servers:
|
servers:
|
||||||
|
|||||||
216
2-nomad-config/frigate.nomad.hcl
Normal file
216
2-nomad-config/frigate.nomad.hcl
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
job "frigate" {
|
||||||
|
# Pin to N150 LattePanda nodes - Intel UHD iGPU for OpenVINO-accelerated detection.
|
||||||
|
# hardware.graphics (intel-compute-runtime) is deployed to these nodes via configuration.nix.
|
||||||
|
constraint {
|
||||||
|
attribute = "${node.class}"
|
||||||
|
value = "latte-panda-n150"
|
||||||
|
}
|
||||||
|
|
||||||
|
group "frigate" {
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
network {
|
||||||
|
port "http" {
|
||||||
|
to = 5000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prestart: restore Frigate's SQLite DB from the Litestream file replica on the CIFS share.
|
||||||
|
# Runs to completion before the frigate task starts. Safe on first boot (-if-replica-exists
|
||||||
|
# is a no-op when no replica exists yet).
|
||||||
|
task "litestream-restore" {
|
||||||
|
lifecycle {
|
||||||
|
hook = "prestart"
|
||||||
|
sidecar = false
|
||||||
|
}
|
||||||
|
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "litestream/litestream:0.5.9"
|
||||||
|
command = "restore"
|
||||||
|
args = ["-if-replica-exists", "-config", "/local/litestream.yml", "/alloc/data/frigate.db"]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Litestream config: replicate to /config/frigate.db.litestream/ on the CIFS share.
|
||||||
|
# Litestream writes its own segment format - no SQLite advisory locking involved.
|
||||||
|
# Frigate must be configured with database.path: /alloc/data/frigate.db in config.yml.
|
||||||
|
template {
|
||||||
|
data = <<EOH
|
||||||
|
dbs:
|
||||||
|
- path: /alloc/data/frigate.db
|
||||||
|
replicas:
|
||||||
|
- url: file:///config/frigate.db.litestream
|
||||||
|
EOH
|
||||||
|
destination = "local/litestream.yml"
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "unraid_appdata_frigate"
|
||||||
|
destination = "/config"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 100
|
||||||
|
memory = 64
|
||||||
|
memory_max = 256
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sidecar: continuously stream WAL changes from /alloc/data/frigate.db to the CIFS replica.
|
||||||
|
# Runs alongside frigate for the lifetime of the allocation.
|
||||||
|
task "litestream-replicate" {
|
||||||
|
lifecycle {
|
||||||
|
hook = "poststart"
|
||||||
|
sidecar = true
|
||||||
|
}
|
||||||
|
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "litestream/litestream:0.5"
|
||||||
|
command = "replicate"
|
||||||
|
args = ["-config", "/local/litestream.yml"]
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
data = <<EOH
|
||||||
|
dbs:
|
||||||
|
- path: /alloc/data/frigate.db
|
||||||
|
replicas:
|
||||||
|
- url: file:///config/frigate.db.litestream
|
||||||
|
EOH
|
||||||
|
destination = "local/litestream.yml"
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "unraid_appdata_frigate"
|
||||||
|
destination = "/config"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 100
|
||||||
|
memory = 64
|
||||||
|
memory_max = 256
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "frigate" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "ghcr.io/blakeblackshear/frigate:0.17.1"
|
||||||
|
ports = ["http"]
|
||||||
|
privileged = true
|
||||||
|
|
||||||
|
# Shared memory for inter-process frame buffers (frigate forks detector processes).
|
||||||
|
shm_size = 268435456 # 256 MiB
|
||||||
|
|
||||||
|
# Large tmpfs for decoded frame cache - avoids wearing out any storage.
|
||||||
|
mounts = [
|
||||||
|
{
|
||||||
|
type = "tmpfs"
|
||||||
|
target = "/tmp/cache"
|
||||||
|
readonly = false
|
||||||
|
tmpfs_options = {
|
||||||
|
size = 1000000000 # 1 GiB in bytes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
# Intel iGPU render node - Frigate's bundled OpenVINO runtime auto-detects
|
||||||
|
# GPU device and uses it for object detection without any extra env vars.
|
||||||
|
# Requires hardware.graphics.enable = true on the NixOS node (N150 nodes).
|
||||||
|
devices = [
|
||||||
|
{
|
||||||
|
host_path = "/dev/dri/renderD128"
|
||||||
|
container_path = "/dev/dri/renderD128"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# RTSP password injected from Nomad variables (sourced from sops secrets).
|
||||||
|
# Reference in config.yml as: {FRIGATE_RTSP_PASSWORD}
|
||||||
|
template {
|
||||||
|
data = <<EOH
|
||||||
|
FRIGATE_RTSP_PASSWORD="{{ with nomadVar "nomad/jobs/frigate" }}{{ .rtsp_password }}{{ end }}"
|
||||||
|
EOH
|
||||||
|
destination = "secrets/frigate.env"
|
||||||
|
env = true
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "frigate"
|
||||||
|
port = "http"
|
||||||
|
|
||||||
|
tags = [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.frigate.middlewares=auth@file",
|
||||||
|
"traefik.http.routers.frigate-token.rule=Host(`n7gdph5cuh7bd1cakbq8s099rvrv3qhs-frigate.othrayte.one`)",
|
||||||
|
]
|
||||||
|
|
||||||
|
check {
|
||||||
|
name = "alive"
|
||||||
|
type = "http"
|
||||||
|
path = "/api/version"
|
||||||
|
port = "http"
|
||||||
|
interval = "10s"
|
||||||
|
timeout = "5s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
TZ = "Australia/Melbourne"
|
||||||
|
}
|
||||||
|
|
||||||
|
# config.yml lives here (read from CIFS). SQLite DB is at /alloc/data/frigate.db
|
||||||
|
# (local NVMe, managed by Litestream). Requires in config.yml:
|
||||||
|
# database:
|
||||||
|
# path: /alloc/data/frigate.db
|
||||||
|
volume_mount {
|
||||||
|
volume = "unraid_appdata_frigate"
|
||||||
|
destination = "/config"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
# Recordings, clips, and exports.
|
||||||
|
volume_mount {
|
||||||
|
volume = "unraid_media_frigate"
|
||||||
|
destination = "/media/frigate"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
# GPU handles inference; CPU manages stream ingestion, motion detection, and recording.
|
||||||
|
cpu = 2000
|
||||||
|
memory = 2048
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volume "unraid_appdata_frigate" {
|
||||||
|
type = "csi"
|
||||||
|
read_only = false
|
||||||
|
source = "unraid_appdata_frigate"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
|
||||||
|
mount_options {
|
||||||
|
mount_flags = ["nobrl", "uid=0", "gid=0"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volume "unraid_media_frigate" {
|
||||||
|
type = "csi"
|
||||||
|
read_only = false
|
||||||
|
source = "unraid_media_frigate"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
|
||||||
|
mount_options {
|
||||||
|
mount_flags = ["nobrl", "uid=0", "gid=0"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
2-nomad-config/frigate.tf
Normal file
23
2-nomad-config/frigate.tf
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
resource "nomad_job" "frigate" {
|
||||||
|
jobspec = file("frigate.nomad.hcl")
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "nomad_variable" "frigate" {
|
||||||
|
path = "nomad/jobs/frigate"
|
||||||
|
items = {
|
||||||
|
rtsp_password = data.sops_file.secrets.data["frigate.rtsp_password"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module "appdata_frigate" {
|
||||||
|
source = "./modules/appdata"
|
||||||
|
name = "frigate"
|
||||||
|
}
|
||||||
|
|
||||||
|
module "unraid_smb_frigate_media" {
|
||||||
|
source = "./modules/unraid_smb"
|
||||||
|
name = "frigate"
|
||||||
|
share = "media"
|
||||||
|
subDir = "frigate"
|
||||||
|
}
|
||||||
@@ -37,6 +37,17 @@ job "gitea" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Separate service for Consul Connect ingress (address_mode=alloc avoids hairpin NAT issue)
|
||||||
|
service {
|
||||||
|
name = "code-connect"
|
||||||
|
port = "http"
|
||||||
|
address_mode = "alloc"
|
||||||
|
|
||||||
|
connect {
|
||||||
|
sidecar_service {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task "gitea" {
|
task "gitea" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
|
|||||||
100
2-nomad-config/ntfy.nomad.hcl
Normal file
100
2-nomad-config/ntfy.nomad.hcl
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
job "ntfy" {
|
||||||
|
group "ntfy" {
|
||||||
|
network {
|
||||||
|
mode = "bridge"
|
||||||
|
port "http" {
|
||||||
|
to = 80
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Consul Connect sidecar with upstream to postgres
|
||||||
|
service {
|
||||||
|
connect {
|
||||||
|
sidecar_service {
|
||||||
|
proxy {
|
||||||
|
upstreams {
|
||||||
|
destination_name = "postgres"
|
||||||
|
local_bind_port = 5432
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "ntfy"
|
||||||
|
port = "http"
|
||||||
|
|
||||||
|
tags = [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.ntfy.middlewares=auth@file",
|
||||||
|
# Token subdomain bypasses Authelia — ntfy's own token auth is sufficient for API access
|
||||||
|
"traefik.http.routers.ntfy-token.rule=Host(`ntfy-2e30e5869ab6bfde4961012b48761a9b.othrayte.one`)",
|
||||||
|
]
|
||||||
|
|
||||||
|
check {
|
||||||
|
type = "http"
|
||||||
|
path = "/healthz"
|
||||||
|
interval = "10s"
|
||||||
|
timeout = "2s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Users and tokens are provisioned declaratively via auth-users / auth-tokens in server.yml.
|
||||||
|
# ntfy reads and applies them on every startup — no poststart task, no race conditions.
|
||||||
|
#
|
||||||
|
# Bcrypt hashes are not secrets and are hardcoded below (same as /etc/shadow — safe to commit).
|
||||||
|
# Generate with: docker run --rm -it binwiederhier/ntfy user hash
|
||||||
|
# or: echo "mypassword" | docker run --rm -i binwiederhier/ntfy user hash
|
||||||
|
# For the diun account the plaintext is irrelevant (token-only auth); use a random password:
|
||||||
|
# openssl rand -base64 32 | docker run --rm -i binwiederhier/ntfy user hash
|
||||||
|
#
|
||||||
|
# Required SOPS keys:
|
||||||
|
# ntfy.database_pw — postgres password for the ntfy role
|
||||||
|
# diun.ntfy_token — access token for Diun (actual secret — grants write access)
|
||||||
|
# Must start with "tk_" and be exactly 32 chars total.
|
||||||
|
# Generate: tok=$(openssl rand -hex 15); echo "tk_${tok:0:29}"
|
||||||
|
task "ntfy" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "binwiederhier/ntfy:latest"
|
||||||
|
ports = ["http"]
|
||||||
|
command = "serve"
|
||||||
|
volumes = [
|
||||||
|
"local/server.yml:/etc/ntfy/server.yml",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
env = {
|
||||||
|
TZ = "Australia/Melbourne"
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
data = <<EOF
|
||||||
|
base-url: "https://ntfy.othrayte.one"
|
||||||
|
listen-http: ":80"
|
||||||
|
database-url: "postgres://ntfy:{{ with nomadVar "nomad/jobs/ntfy" }}{{ .database_pw }}{{ end }}@localhost:5432/ntfy"
|
||||||
|
auth-default-access: "deny-all"
|
||||||
|
behind-proxy: true
|
||||||
|
enable-login: true
|
||||||
|
auth-users:
|
||||||
|
- "admin:$2a$10$rLp4qagJnsA8Es5hQlISH.WrlzwMrXE2MBaEgz7zdd2lkAVu30lMy:admin"
|
||||||
|
- "diun:$2y$10$4wi1VG.Vp5p3Q2OEIXaTSOmwZm.G9dpNca9BqQRMdGGnk2yQqK3Gq:user"
|
||||||
|
auth-tokens:
|
||||||
|
- "diun:{{with nomadVar "nomad/jobs/ntfy"}}{{.diun_token}}{{end}}:Diun"
|
||||||
|
auth-access:
|
||||||
|
- "diun:diun:write-only"
|
||||||
|
EOF
|
||||||
|
destination = "local/server.yml"
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 50
|
||||||
|
memory = 64
|
||||||
|
memory_max = 128
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
22
2-nomad-config/ntfy.tf
Normal file
22
2-nomad-config/ntfy.tf
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
resource "nomad_job" "ntfy" {
|
||||||
|
jobspec = file("ntfy.nomad.hcl")
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "nomad_variable" "ntfy" {
|
||||||
|
path = "nomad/jobs/ntfy"
|
||||||
|
items = {
|
||||||
|
database_pw = data.sops_file.secrets.data["ntfy.database_pw"]
|
||||||
|
diun_token = data.sops_file.secrets.data["diun.ntfy_token"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "postgresql_role" "ntfy" {
|
||||||
|
name = "ntfy"
|
||||||
|
password = data.sops_file.secrets.data["ntfy.database_pw"]
|
||||||
|
login = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "postgresql_database" "ntfy" {
|
||||||
|
name = "ntfy"
|
||||||
|
owner = postgresql_role.ntfy.name
|
||||||
|
}
|
||||||
116
2-nomad-config/openreader.nomad.hcl
Normal file
116
2-nomad-config/openreader.nomad.hcl
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
job "openreader" {
|
||||||
|
group "openreader" {
|
||||||
|
network {
|
||||||
|
mode = "bridge"
|
||||||
|
port "http" {
|
||||||
|
to = 3003
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Consul Connect sidecar with upstream to postgres
|
||||||
|
service {
|
||||||
|
connect {
|
||||||
|
sidecar_service {
|
||||||
|
proxy {
|
||||||
|
upstreams {
|
||||||
|
destination_name = "postgres"
|
||||||
|
local_bind_port = 5432
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "openreader"
|
||||||
|
port = "http"
|
||||||
|
|
||||||
|
tags = [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.openreader.middlewares=auth@file",
|
||||||
|
]
|
||||||
|
|
||||||
|
check {
|
||||||
|
type = "http"
|
||||||
|
path = "/"
|
||||||
|
interval = "10s"
|
||||||
|
timeout = "2s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "openreader-api"
|
||||||
|
port = "http"
|
||||||
|
address_mode = "alloc" # Use allocation IP for Connect as the sidecar can't access the host's published port (hairpin/loopback NAT issue)
|
||||||
|
|
||||||
|
connect {
|
||||||
|
sidecar_service {}
|
||||||
|
}
|
||||||
|
|
||||||
|
check {
|
||||||
|
type = "http"
|
||||||
|
path = "/"
|
||||||
|
interval = "10s"
|
||||||
|
timeout = "2s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "openreader" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "ghcr.io/richardr1126/openreader:v2.1.2"
|
||||||
|
ports = ["http"]
|
||||||
|
}
|
||||||
|
|
||||||
|
env = {
|
||||||
|
TZ = "Australia/Melbourne"
|
||||||
|
|
||||||
|
# Use embedded SeaweedFS for blob storage (data lives in /app/docstore/seaweedfs).
|
||||||
|
# Port 8333 is not exposed; browser uploads/downloads fall back through the app API.
|
||||||
|
USE_EMBEDDED_WEED_MINI = "true"
|
||||||
|
S3_ENDPOINT = "http://localhost:8333"
|
||||||
|
S3_FORCE_PATH_STYLE = "true"
|
||||||
|
|
||||||
|
# Auth is intentionally disabled (no BASE_URL / AUTH_SECRET set).
|
||||||
|
# Access is controlled by the Authelia middleware on the Traefik router above.
|
||||||
|
|
||||||
|
# To enable server-side library import from an Unraid share, add a second CSI volume
|
||||||
|
# mount for the share (e.g. unraid_media_books → /app/docstore/library:ro) and set:
|
||||||
|
# IMPORT_LIBRARY_DIR = "/app/docstore/library"
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
data = <<EOF
|
||||||
|
POSTGRES_URL=postgresql://openreader:{{ with nomadVar "nomad/jobs/openreader" }}{{ .database_pw }}{{ end }}@localhost:5432/openreader
|
||||||
|
EOF
|
||||||
|
destination = "secrets/openreader.env"
|
||||||
|
env = true
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "unraid_appdata_openreader"
|
||||||
|
destination = "/app/docstore"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 200
|
||||||
|
memory = 750
|
||||||
|
memory_max = 1024
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
volume "unraid_appdata_openreader" {
|
||||||
|
type = "csi"
|
||||||
|
read_only = false
|
||||||
|
source = "unraid_appdata_openreader"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
|
||||||
|
mount_options {
|
||||||
|
mount_flags = ["uid=1000", "gid=1000"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
2-nomad-config/openreader.tf
Normal file
26
2-nomad-config/openreader.tf
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
resource "nomad_job" "openreader" {
|
||||||
|
jobspec = file("openreader.nomad.hcl")
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "nomad_variable" "openreader" {
|
||||||
|
path = "nomad/jobs/openreader"
|
||||||
|
items = {
|
||||||
|
database_pw = data.sops_file.secrets.data["openreader.database_pw"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "postgresql_role" "openreader" {
|
||||||
|
name = "openreader"
|
||||||
|
password = data.sops_file.secrets.data["openreader.database_pw"]
|
||||||
|
login = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "postgresql_database" "openreader" {
|
||||||
|
name = "openreader"
|
||||||
|
owner = postgresql_role.openreader.name
|
||||||
|
}
|
||||||
|
|
||||||
|
module "appdata_openreader" {
|
||||||
|
source = "./modules/appdata"
|
||||||
|
name = "openreader"
|
||||||
|
}
|
||||||
64
2-nomad-config/renovate.nomad.hcl
Normal file
64
2-nomad-config/renovate.nomad.hcl
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
job "renovate" {
|
||||||
|
type = "batch"
|
||||||
|
|
||||||
|
periodic {
|
||||||
|
cron = "0 4 * * *" # Daily at 4am
|
||||||
|
prohibit_overlap = true
|
||||||
|
}
|
||||||
|
|
||||||
|
group "renovate" {
|
||||||
|
network {
|
||||||
|
mode = "bridge"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Consul Connect sidecar with upstream to Gitea (service: code-connect, port 3000)
|
||||||
|
service {
|
||||||
|
name = "renovate"
|
||||||
|
connect {
|
||||||
|
sidecar_service {
|
||||||
|
proxy {
|
||||||
|
upstreams {
|
||||||
|
destination_name = "code-connect"
|
||||||
|
local_bind_port = 3000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "renovate" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "renovate/renovate:latest"
|
||||||
|
}
|
||||||
|
|
||||||
|
env = {
|
||||||
|
RENOVATE_PLATFORM = "gitea"
|
||||||
|
RENOVATE_ENDPOINT = "http://localhost:3000"
|
||||||
|
RENOVATE_GIT_URL = "endpoint"
|
||||||
|
RENOVATE_REPOSITORIES = "othrayte/infra"
|
||||||
|
RENOVATE_GIT_AUTHOR = "Renovate Bot <renovate@othrayte.one>"
|
||||||
|
LOG_LEVEL = "debug"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Required SOPS key:
|
||||||
|
# renovate.gitea_token — PAT for the renovate bot account in Gitea
|
||||||
|
# Create a dedicated 'renovate' user in Gitea with these token scopes:
|
||||||
|
# repo (read+write), user (read), issue (read+write), organization (read)
|
||||||
|
template {
|
||||||
|
data = <<EOF
|
||||||
|
RENOVATE_TOKEN={{ with nomadVar "nomad/jobs/renovate" }}{{ .gitea_token }}{{ end }}
|
||||||
|
EOF
|
||||||
|
destination = "secrets/renovate.env"
|
||||||
|
env = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 500
|
||||||
|
memory = 512
|
||||||
|
memory_max = 1024
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
2-nomad-config/renovate.tf
Normal file
10
2-nomad-config/renovate.tf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
resource "nomad_job" "renovate" {
|
||||||
|
jobspec = file("renovate.nomad.hcl")
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "nomad_variable" "renovate" {
|
||||||
|
path = "nomad/jobs/renovate"
|
||||||
|
items = {
|
||||||
|
gitea_token = data.sops_file.secrets.data["renovate.gitea_token"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,18 @@
|
|||||||
"prowlarr": {
|
"prowlarr": {
|
||||||
"database_pw": "ENC[AES256_GCM,data:FkW5LPoyn8bh0UfWcFq3og==,iv:SFq4Xsdz3FfCDyPjIaAmz5nsC/SPdFrR03GCr3KE/nw=,tag:PVYj7hSWDnfeE7igSXGBSA==,type:str]"
|
"database_pw": "ENC[AES256_GCM,data:FkW5LPoyn8bh0UfWcFq3og==,iv:SFq4Xsdz3FfCDyPjIaAmz5nsC/SPdFrR03GCr3KE/nw=,tag:PVYj7hSWDnfeE7igSXGBSA==,type:str]"
|
||||||
},
|
},
|
||||||
|
"frigate": {
|
||||||
|
"rtsp_password": "ENC[AES256_GCM,data:8vq06/IkNOUgpHmf,iv:lj8buuIC0ub0YOUiOiaN6tokkIT2/+bBwFNz2QXmCd4=,tag:EMm/bIHdJSAtjYAlrNOCMw==,type:str]"
|
||||||
|
},
|
||||||
|
"openreader": {
|
||||||
|
"database_pw": "ENC[AES256_GCM,data:2Ey9Ypb2Ked/LP/ApJhCqhKWuzognxVK7ku60nERp7I=,iv:KdLFD+fuNpYmPEU5G96SvFcQeZB0XlnOh/6uf7OfFqI=,tag:h7DQlqx5fxhiHuWyFd7svQ==,type:str]"
|
||||||
|
},
|
||||||
|
"ntfy": {
|
||||||
|
"database_pw": "ENC[AES256_GCM,data:79c2KFs3tcbet1dSGnkSDlAeKLCZrh4aMYLXTROM8w==,iv:eZ4limyjl++nsvHUzPKy82hfLZEOc+XQYpO6Czo/8os=,tag:iX9SiEACQ5IM8f1jhZh5Qw==,type:str]"
|
||||||
|
},
|
||||||
|
"renovate": {
|
||||||
|
"gitea_token": "ENC[AES256_GCM,data:/J3CDMgWZLe20oQ+ENKBMi8fs/+jgsARV7xihMq0OLmRk8C8ae/IXg==,iv:e7WYOanSOCZ/LhN6SKrH0VrR3xLPTTppOKpGpSl+oAc=,tag:XBAilRdK3jL7WtM+92Fsmg==,type:str]"
|
||||||
|
},
|
||||||
"sops": {
|
"sops": {
|
||||||
"age": [
|
"age": [
|
||||||
{
|
{
|
||||||
@@ -50,8 +62,8 @@
|
|||||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSByUWM4ZDVVbGFrUGdMRHBX\nUFBmU3Nlc0RBSzhFK0tHNHpkQXUvUVdiZUZJCmpRN1lFdENpWW0rcThjVlVQNUl6\nWnlLU0RnQ3FZby81Ly8xTFBrek9nMncKLS0tIFQ4UTRNOC9CRmx4OFJWem1wckZz\nUDFTSzdWZldFK3FqcTNWTWRyNDhHQ2MKS811mR5xn7qiC/aVgPFYJ5c6Q3zxRfcr\nHcvxUvB01vNJKZpRg92vvKPkV6lQO3DXCT98OdfwiymlEOvYxg71Pg==\n-----END AGE ENCRYPTED FILE-----\n"
|
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSByUWM4ZDVVbGFrUGdMRHBX\nUFBmU3Nlc0RBSzhFK0tHNHpkQXUvUVdiZUZJCmpRN1lFdENpWW0rcThjVlVQNUl6\nWnlLU0RnQ3FZby81Ly8xTFBrek9nMncKLS0tIFQ4UTRNOC9CRmx4OFJWem1wckZz\nUDFTSzdWZldFK3FqcTNWTWRyNDhHQ2MKS811mR5xn7qiC/aVgPFYJ5c6Q3zxRfcr\nHcvxUvB01vNJKZpRg92vvKPkV6lQO3DXCT98OdfwiymlEOvYxg71Pg==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"lastmodified": "2025-11-18T12:09:57Z",
|
"lastmodified": "2026-04-18T06:07:22Z",
|
||||||
"mac": "ENC[AES256_GCM,data:zchzaSPjJVbUBzXTrRPGAtQE6xzqxMjTCXRABvwEvgNqLO7i2C/d04hI+pwOuLWyZXiUfqHlGt798ZnP5+MJi249FJmK08l8dAXxKSc+KSc4EfDoF+jWiwmoDEf5SypyHL9RPTeI7zoSJ0IxhtP3zZcD/7Q2PPG7cLDBKHdTJFU=,iv:+UiyEfMtAObZ/vvs2ZaIup9OxxP0uqSmo+h45PrymLk=,tag:f/D8417EGjuOfSdzZtir4Q==,type:str]",
|
"mac": "ENC[AES256_GCM,data:4UJMEZNS8HXtn1vIJ+qCkBJL5oh3Jp7wbaGm5hMiSNPseNq3smTYmMgh+TNK4t/K7yxfukTuhEFTUsnMfi7rIxTrbCpcTdnqJSYm/iflkdA57Tx+mHpY9iG7wtRmObow18Ea0rj6foMu+1V8pVFomzhc/ipafinTCuqodKW1a2Y=,iv:Gu/Lh8mir36ltN++qJg122ry+eJA0GKSrfijulYM7q4=,tag:5tjBzrCZcQUvc76No+E9Ow==,type:str]",
|
||||||
"encrypted_regex": "^(.*)$",
|
"encrypted_regex": "^(.*)$",
|
||||||
"version": "3.10.2"
|
"version": "3.10.2"
|
||||||
}
|
}
|
||||||
|
|||||||
15
renovate.json
Normal file
15
renovate.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": ["config:recommended"],
|
||||||
|
"customManagers": [
|
||||||
|
{
|
||||||
|
"description": "Update Docker image tags in Nomad job files",
|
||||||
|
"customType": "regex",
|
||||||
|
"fileMatch": ["\\.nomad\\.hcl$"],
|
||||||
|
"matchStrings": [
|
||||||
|
"image\\s*=\\s*\"(?<depName>[^:\"]+):(?<currentValue>[^\"]+)\""
|
||||||
|
],
|
||||||
|
"datasourceTemplate": "docker"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user