-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services/nomad/apps/popcorn-report.nomad: add nomad job
this component of popcorn reads what statrepo has collected and dumps it to json every night. these json dumps are used by pqueryd and served by nginx.
- Loading branch information
1 parent
3a1f4c6
commit dca3159
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
job "popcorn-report" { | ||
datacenters = ["VOID-MIRROR"] | ||
namespace = "apps" | ||
type = "batch" | ||
|
||
periodic { | ||
crons = ["@daily"] | ||
prohibit_overlap = true | ||
} | ||
|
||
group "report" { | ||
count = 1 | ||
|
||
network { mode = "bridge" } | ||
|
||
volume "popcorn_data" { | ||
type = "host" | ||
source = "popcorn_data" | ||
read_only = false | ||
} | ||
|
||
task "report" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "ghcr.io/void-linux/infra-popcorn:20240704R1" | ||
command = "/local/popcorn-report" | ||
} | ||
|
||
volume_mount { | ||
volume = "popcorn_data" | ||
destination = "/data" | ||
} | ||
|
||
env { | ||
OUTDIR = "/data" | ||
} | ||
|
||
template { | ||
data = <<EOF | ||
#!/bin/sh | ||
{{ range service "popcorn-statrepo" }} | ||
exec popcornctl --server "{{ .Address }}" --port "{{ .Port }}" \ | ||
report --reset --key "${POPCORN_KEY}" --file "${OUTDIR}/popcorn_$(date +%F).json" | ||
{{ end }} | ||
EOF | ||
destination = "local/popcorn-report" | ||
perms = "755" | ||
} | ||
|
||
template { | ||
data = <<EOF | ||
{{- with nomadVar "nomad/jobs/popcorn" -}} | ||
POPCORN_KEY={{.reset_key}} | ||
{{- end -}} | ||
EOF | ||
destination = "secrets/env" | ||
env = true | ||
} | ||
} | ||
} | ||
} |