Switch to host volumes. Grafana not working yet.

This commit is contained in:
2023-07-17 21:02:59 +01:00
parent 9a4d00bfd3
commit 91f801401e
8 changed files with 17 additions and 148 deletions

View File

@@ -21,6 +21,11 @@ in
interface = "tailscale0"; interface = "tailscale0";
cidr = "100.64.0.0/10"; 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 = { server = {

View File

@@ -8,11 +8,9 @@ job "grafana" {
} }
} }
volume "data-volume" { volume "appdata" {
type = "csi" type = "host"
source = "grafana-data" source = "appdata-grafana"
access_mode = "single-node-writer"
attachment_mode = "file-system"
} }
task "grafana" { task "grafana" {
@@ -29,7 +27,7 @@ job "grafana" {
} }
volume_mount { volume_mount {
volume = "data-volume" volume = "appdata"
destination = "/var/lib/grafana" destination = "/var/lib/grafana"
} }

View File

@@ -26,12 +26,10 @@ job "pi.paler.net" {
} }
} }
volume "sites-volume" { volume "sites" {
type = "csi" type = "host"
source = "sites-volume" source = "sites"
access_mode = "single-node-reader-only"
read_only = true read_only = true
attachment_mode = "file-system"
} }
task "http-server" { task "http-server" {
@@ -50,7 +48,7 @@ job "pi.paler.net" {
} }
volume_mount { volume_mount {
volume = "sites-volume" volume = "sites"
destination = "/srv/http" destination = "/srv/http"
} }
} }

View File

@@ -15,11 +15,9 @@ job "traefik" {
} }
} }
volume "config-volume" { volume "config" {
type = "csi" type = "host"
source = "config-volume" source = "config"
access_mode = "single-node-writer"
attachment_mode = "file-system"
} }
task "traefik" { task "traefik" {
@@ -54,7 +52,7 @@ job "traefik" {
} }
volume_mount { volume_mount {
volume = "config-volume" volume = "config"
destination = "/config" destination = "/config"
} }

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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
}
}
}
}

View File

@@ -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"
}