Add Unifi Network
This commit is contained in:
@@ -112,6 +112,9 @@ EOF
|
||||
template {
|
||||
data = <<EOF
|
||||
http:
|
||||
serversTransports:
|
||||
ignorecert:
|
||||
insecureSkipVerify: true
|
||||
middlewares:
|
||||
auth:
|
||||
forwardAuth:
|
||||
@@ -173,6 +176,11 @@ http:
|
||||
hass-token:
|
||||
rule: "Host(`${hass_magic_token}-hass.othrayte.one`)"
|
||||
service: hass
|
||||
unifi-network:
|
||||
rule: "Host(`network.othrayte.one`)"
|
||||
service: unifi-network
|
||||
middlewares:
|
||||
- auth
|
||||
|
||||
services:
|
||||
traefik:
|
||||
@@ -203,6 +211,11 @@ http:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://192.168.1.234:8123"
|
||||
unifi-network:
|
||||
loadBalancer:
|
||||
serversTransport: ignorecert
|
||||
servers:
|
||||
- url: "https://192.168.1.50:8443"
|
||||
EOF
|
||||
|
||||
destination = "local/configs/nomad.yml"
|
||||
|
||||
50
2-nomad-config/unifi.nomad.hcl
Normal file
50
2-nomad-config/unifi.nomad.hcl
Normal file
@@ -0,0 +1,50 @@
|
||||
job "unifi-network" {
|
||||
group "unifi-network" {
|
||||
count = 1
|
||||
|
||||
task "unifi-controller" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "jacobalberty/unifi:v9.5.21"
|
||||
|
||||
// Fixed IP on the actual network so that devices can find it
|
||||
network_mode = "macvlan"
|
||||
ipv4_address = "192.168.1.50"
|
||||
}
|
||||
|
||||
env {
|
||||
TZ = "Australia/Melbourne"
|
||||
SYSTEM_IP = "192.168.1.50"
|
||||
JVM_INIT_HEAP_SIZE = "1024M"
|
||||
JVM_MAX_HEAP_SIZE = "1024M"
|
||||
UNIFI_STDOUT = "true"
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
volume = "unraid_appdata_unifi_network"
|
||||
destination = "/unifi" # Expected root directory (contains data, log, cert subdirs)
|
||||
read_only = false
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 200
|
||||
memory = 1850
|
||||
memory_max = 2500
|
||||
}
|
||||
}
|
||||
|
||||
# CSI volume for UniFi Controller persistent data/logs
|
||||
volume "unraid_appdata_unifi_network" {
|
||||
type = "csi"
|
||||
read_only = false
|
||||
source = "unraid_appdata_unifi_network"
|
||||
access_mode = "single-node-writer"
|
||||
attachment_mode = "file-system"
|
||||
|
||||
mount_options {
|
||||
mount_flags = ["uid=0", "gid=0"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
2-nomad-config/unifi.tf
Normal file
32
2-nomad-config/unifi.tf
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
resource "nomad_job" "unifi_network" {
|
||||
jobspec = file("unifi.nomad.hcl")
|
||||
}
|
||||
|
||||
|
||||
resource "nomad_csi_volume_registration" "unraid_appdata_unifi_network" {
|
||||
# Note: Before changing the definition of this volume you need to stop the jobs that are using it
|
||||
depends_on = [data.nomad_plugin.smb]
|
||||
plugin_id = "smb"
|
||||
|
||||
volume_id = "unraid_appdata_unifi_network"
|
||||
name = "unraid_appdata_unifi_network"
|
||||
|
||||
external_id = "unraid_appdata_unifi_network"
|
||||
|
||||
capability {
|
||||
access_mode = "single-node-writer"
|
||||
attachment_mode = "file-system"
|
||||
}
|
||||
|
||||
context = {
|
||||
source = "//192.168.1.192/appdata"
|
||||
subDir = "unifi-network" # Note: Needs to be manually created on the share
|
||||
}
|
||||
|
||||
secrets = {
|
||||
"username" = "nomad"
|
||||
"password" = data.sops_file.secrets.data["unraid.nomad"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user