Skip to content

Commit

Permalink
services/nomad/build/buildsync*.nomad: combine
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp authored and the-maldridge committed Oct 17, 2023
1 parent acdb697 commit 4a59ec8
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 188 deletions.
94 changes: 0 additions & 94 deletions services/nomad/build/buildsync-aarch64.nomad

This file was deleted.

94 changes: 0 additions & 94 deletions services/nomad/build/buildsync-musl.nomad

This file was deleted.

104 changes: 104 additions & 0 deletions services/nomad/build/buildsync.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
job "buildsync" {
type = "service"
datacenters = ["VOID"]
namespace = "build"

dynamic "group" {
for_each = [ "aarch64", "musl", ]
labels = [ "buildsync-${group.value}" ]

content {
count = 1
network { mode = "bridge" }

dynamic "volume" {
for_each = [ "${group.value}" ]
labels = [ "${volume.value}_hostdir" ]

content {
type = "host"
source = "${volume.value}_hostdir"
read_only = true
}
}

task "rsync" {
driver = "docker"

vault {
policies = ["void-secrets-buildsync"]
}

config {
image = "ghcr.io/void-linux/infra-lsyncd:20230814"
}

volume_mount {
volume = "${group.value}_hostdir"
destination = "/hostdir"
}

template {
data = <<EOF
{{- with secret "secret/buildsync/${group.value}" -}}
{{.Data.password}}
{{- end -}}
EOF
destination = "secrets/rsync_passwd"
perms = "0400"
}

template {
data = <<EOF
settings {
statusFile = "/tmp/lsyncd.status",
nodaemon = true,
}
sync {
default.rsync,
source = "/hostdir/binpkgs",
{{- range nomadService "build-rsyncd" -}}
target = "rsync://buildsync-${group.value}@a-fsn-de.node.consul:{{ .Port }}/${group.value}",
{{- end -}}
delay = 15,
filter = {
"+ */",
"+ *-repodata",
"+ *.xbps",
"+ otime",
"- .*",
"- *",
},
rsync = {
verbose = true,
update = true,
copy_dirlinks = true,
password_file = "/secrets/rsync_passwd",
_extra = { "--delete-after" },
}
}
sync {
default.rsync,
source = "/hostdir/sources",
{{- range nomadService "build-rsyncd" -}}
target = "rsync://buildsync-${group.value}@a-fsn-de.node.consul:{{ .Port }}/sources",
{{- end -}}
delay = 15,
rsync = {
verbose = true,
update = true,
copy_dirlinks = true,
password_file = "/secrets/rsync_passwd",
_extra = { "--delete-after" },
}
}
EOF
destination = "local/lsyncd.conf"
perms = "0644"
}
}
}
}
}

0 comments on commit 4a59ec8

Please sign in to comment.