diff --git a/hosts/common/nomad.nix b/hosts/common/nomad.nix index a03b760..8cfd5f9 100644 --- a/hosts/common/nomad.nix +++ b/hosts/common/nomad.nix @@ -21,6 +21,11 @@ in interface = "tailscale0"; cidr = "100.64.0.0/10"; }; + host_volume = { + sites.path = "/data/compute/sites"; + config.path = "/data/compute/config"; + appdata-grafana.path = "/data/compute/appdata/grafana"; + }; }; server = { diff --git a/services/grafana.hcl b/services/grafana.hcl index 81bc2a3..a37ad48 100644 --- a/services/grafana.hcl +++ b/services/grafana.hcl @@ -8,11 +8,9 @@ job "grafana" { } } - volume "data-volume" { - type = "csi" - source = "grafana-data" - access_mode = "single-node-writer" - attachment_mode = "file-system" + volume "appdata" { + type = "host" + source = "appdata-grafana" } task "grafana" { @@ -29,7 +27,7 @@ job "grafana" { } volume_mount { - volume = "data-volume" + volume = "appdata" destination = "/var/lib/grafana" } diff --git a/services/pi.paler.net.hcl b/services/pi.paler.net.hcl index 068fe6a..40e2615 100644 --- a/services/pi.paler.net.hcl +++ b/services/pi.paler.net.hcl @@ -26,12 +26,10 @@ job "pi.paler.net" { } } - volume "sites-volume" { - type = "csi" - source = "sites-volume" - access_mode = "single-node-reader-only" + volume "sites" { + type = "host" + source = "sites" read_only = true - attachment_mode = "file-system" } task "http-server" { @@ -50,7 +48,7 @@ job "pi.paler.net" { } volume_mount { - volume = "sites-volume" + volume = "sites" destination = "/srv/http" } } diff --git a/services/traefik.hcl b/services/traefik.hcl index 53896bb..dcd6232 100644 --- a/services/traefik.hcl +++ b/services/traefik.hcl @@ -15,11 +15,9 @@ job "traefik" { } } - volume "config-volume" { - type = "csi" - source = "config-volume" - access_mode = "single-node-writer" - attachment_mode = "file-system" + volume "config" { + type = "host" + source = "config" } task "traefik" { @@ -54,7 +52,7 @@ job "traefik" { } volume_mount { - volume = "config-volume" + volume = "config" destination = "/config" } diff --git a/storage/config-volume.hcl b/storage/config-volume.hcl deleted file mode 100644 index 962a9b3..0000000 --- a/storage/config-volume.hcl +++ /dev/null @@ -1,26 +0,0 @@ -id = "config-volume" -name = "config-volume" -type = "csi" -plugin_id = "seaweedfs" - -capacity_min = "1GiB" -capacity_max = "2GiB" - -capability { - access_mode = "multi-node-single-writer" - attachment_mode = "file-system" -} - -# Optional: for 'nomad volume create', specify mount options to validate for -# 'attachment_mode = "file-system". Registering an existing volume will record -# but ignore these fields. -mount_options { - mount_flags = ["rw"] -} - -parameters { - # Available options: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/pkg/driver/mounter_seaweedfs.go - collection = "config" - replication = "001" - path = "/config" -} diff --git a/storage/grafana-volume.hcl b/storage/grafana-volume.hcl deleted file mode 100644 index 1a34425..0000000 --- a/storage/grafana-volume.hcl +++ /dev/null @@ -1,26 +0,0 @@ -id = "grafana-data" -name = "grafana-data" -type = "csi" -plugin_id = "seaweedfs" - -capacity_min = "10GiB" -capacity_max = "20GiB" - -capability { - access_mode = "single-node-writer" - attachment_mode = "file-system" -} - -# Optional: for 'nomad volume create', specify mount options to validate for -# 'attachment_mode = "file-system". Registering an existing volume will record -# but ignore these fields. -mount_options { - mount_flags = ["rw"] -} - -parameters { - # Available options: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/pkg/driver/mounter_seaweedfs.go - collection = "appdata" - replication = "001" - path = "/appdata/grafana" -} diff --git a/storage/seaweedfs-csi.hcl b/storage/seaweedfs-csi.hcl deleted file mode 100644 index 89215b2..0000000 --- a/storage/seaweedfs-csi.hcl +++ /dev/null @@ -1,52 +0,0 @@ -job "seaweedfs-csi" { - datacenters = ["alo"] - - type = "system" - - update { - max_parallel = 1 - stagger = "60s" - } - - group "nodes" { - - ephemeral_disk { - migrate = false - size = 10240 - sticky = false - } - - task "plugin" { - driver = "docker" - - config { - image = "chrislusf/seaweedfs-csi-driver:latest" - force_pull = "true" - network_mode = "host" - - args = [ - "--endpoint=unix://csi/csi.sock", - "--filer=localhost:8888", - "--nodeid=${node.unique.name}", - "--cacheCapacityMB=256", - "--cacheDir=${NOMAD_TASK_DIR}/cache_dir", - ] - - privileged = true - } - - csi_plugin { - id = "seaweedfs" - type = "monolith" - mount_dir = "/csi" - } - - resources { - cpu = 512 - memory = 1024 - memory_max = 3072 # W need to have memory oversubscription enabled - } - } - } -} - diff --git a/storage/sites-volume.hcl b/storage/sites-volume.hcl deleted file mode 100644 index 6a5d3f5..0000000 --- a/storage/sites-volume.hcl +++ /dev/null @@ -1,26 +0,0 @@ -id = "sites-volume" -name = "sites-volume" -type = "csi" -plugin_id = "seaweedfs" - -capacity_min = "256GiB" -capacity_max = "512GiB" - -capability { - access_mode = "multi-node-single-writer" - attachment_mode = "file-system" -} - -# Optional: for 'nomad volume create', specify mount options to validate for -# 'attachment_mode = "file-system". Registering an existing volume will record -# but ignore these fields. -mount_options { - mount_flags = ["rw"] -} - -parameters { - # Available options: https://github.com/seaweedfs/seaweedfs-csi-driver/blob/master/pkg/driver/mounter_seaweedfs.go - collection = "sites" - replication = "001" - path = "/sites" -}