homelab/nomad-job/seedboxsync.nomad

65 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-10-12 19:18:43 +00:00
job "seedboxsync" {
datacenters = ["homelab"]
2022-10-29 08:40:01 +00:00
priority = 50
type = "batch"
2022-10-12 19:18:43 +00:00
meta {
forcedeploy = "0"
}
2022-10-23 15:32:01 +00:00
constraint {
attribute = "${attr.cpu.arch}"
2022-10-29 08:40:01 +00:00
value = "amd64"
2022-10-23 15:32:01 +00:00
}
2022-10-12 19:18:43 +00:00
periodic {
2022-10-29 08:40:01 +00:00
cron = "0,30 * * * *"
2022-10-12 19:18:43 +00:00
prohibit_overlap = true
}
2022-10-29 08:40:01 +00:00
group "seedboxsync" {
2022-10-12 19:18:43 +00:00
network {
mode = "host"
}
2022-10-29 08:40:01 +00:00
vault {
2022-10-30 08:33:39 +00:00
policies = ["seedbox"]
2022-10-12 19:18:43 +00:00
}
task "server" {
driver = "docker"
service {
name = "lftp"
}
config {
2022-10-23 15:32:01 +00:00
image = "ducampsv/lftp:latest"
2022-10-12 19:18:43 +00:00
volumes = [
"/mnt/diskstation/media/download:/media"
]
2022-10-29 08:40:01 +00:00
args = [
"-u", "${USERNAME},${PASSWORD}",
"-e", "mirror -c -P 5 -x seed ${REMOTE_PATH} /media;quit",
2022-10-12 19:18:43 +00:00
"${REMOTE_SERVER}"
]
}
2022-10-23 15:32:01 +00:00
env {
2022-10-29 08:40:01 +00:00
USER_ID = 1000001
GROUP_ID = 1000007
2022-10-23 15:32:01 +00:00
}
2022-10-12 19:18:43 +00:00
template {
2022-10-29 08:40:01 +00:00
data = <<EOH
2022-10-30 08:33:39 +00:00
{{ with secret "secrets/data/nomad/seedbox"}}
2022-10-12 19:18:43 +00:00
USERNAME = "{{ .Data.data.username }}"
PASSWORD = "{{ .Data.data.password }}"
REMOTE_PATH = "{{ .Data.data.remote_path }}"
REMOTE_SERVER = "{{ .Data.data.remote_server }}"
{{end}}
EOH
destination = "secrets/sample.env"
2022-10-29 08:40:01 +00:00
env = true
2022-10-12 19:18:43 +00:00
}
resources {
2022-10-23 15:32:01 +00:00
memory = 100
2022-10-12 19:18:43 +00:00
}
}
}
}