2023-06-15 23:04:59 +02:00
|
|
|
variable "flake_ref" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "flake_sha" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
2023-06-29 19:11:39 +02:00
|
|
|
variable "store_path" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
2023-06-15 23:04:59 +02:00
|
|
|
job "syncthing" {
|
|
|
|
datacenters = [ "homelab-1" ]
|
|
|
|
type = "service"
|
|
|
|
|
|
|
|
group "syncthing" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
volume "syncthing-data" {
|
|
|
|
type = "csi"
|
|
|
|
source = "syncthing-data"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "syncthing-config" {
|
|
|
|
type = "csi"
|
|
|
|
source = "syncthing-config"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
volume "syncthing-storage" {
|
|
|
|
type = "csi"
|
|
|
|
source = "syncthing-storage"
|
|
|
|
read_only = false
|
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "syncthing"
|
|
|
|
port = "8384"
|
|
|
|
|
|
|
|
## Syncthing with auth returns 402: Unauthorized and Nomad interprets it as
|
|
|
|
## service failure.
|
|
|
|
# check {
|
|
|
|
# type = "http"
|
|
|
|
# address_mode = "alloc"
|
|
|
|
# path = "/"
|
|
|
|
# port = "8384"
|
|
|
|
# interval = "10s"
|
|
|
|
# timeout = "10s"
|
|
|
|
# }
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
|
|
|
|
sidecar_task {
|
|
|
|
resources {
|
|
|
|
cpu = 75
|
|
|
|
memory = 48
|
|
|
|
memory_max = 96
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "syncthing" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
2023-06-19 00:50:02 +02:00
|
|
|
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.syncthing.config.system.build.toplevel"
|
2023-06-15 23:04:59 +02:00
|
|
|
nix_flake_sha = var.flake_sha
|
2023-06-29 19:11:39 +02:00
|
|
|
nix_flake_store_path = var.store_path
|
2023-06-15 23:04:59 +02:00
|
|
|
entrypoint = [ "init" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 512
|
|
|
|
memory = 512
|
|
|
|
memory_max = 1024
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "syncthing-data"
|
|
|
|
destination = "/var/syncthing/data"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "syncthing-config"
|
|
|
|
destination = "/var/syncthing/config"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
|
|
|
volume_mount {
|
|
|
|
volume = "syncthing-storage"
|
|
|
|
destination = "/var/syncthing/storage"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|