working garbage collector
This commit is contained in:
parent
dbd4922f9a
commit
3781696316
3 changed files with 39 additions and 2 deletions
|
@ -125,6 +125,38 @@ job "builder" {
|
|||
memory = 4000
|
||||
}
|
||||
}
|
||||
task "garbage-collect-cache" {
|
||||
driver = "docker"
|
||||
config {
|
||||
image = "nixpkgs/nix:nixos-22.11"
|
||||
args = [ "/tmp/gc.sh" ]
|
||||
volumes = [
|
||||
"local/gc.sh:/tmp/gc.sh",
|
||||
"local/nix.conf:/etc/nix/nix.conf",
|
||||
"/var/cache/albatros/nix:/nix",
|
||||
]
|
||||
}
|
||||
|
||||
lifecycle {
|
||||
hook = "poststop"
|
||||
sidecar = false
|
||||
}
|
||||
|
||||
template {
|
||||
data = file("./nix.conf")
|
||||
destination = "local/nix.conf"
|
||||
}
|
||||
|
||||
template {
|
||||
data = file("./gc.sh")
|
||||
destination = "local/gc.sh"
|
||||
perms = "555"
|
||||
}
|
||||
|
||||
restart {
|
||||
attempts = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
set -f # disable globbing
|
||||
|
||||
echo "hook on $DRV_PATH"
|
||||
mkdir -p /nix/var/nix/gcroots/albatros
|
||||
DRV_NAME=$(echo $DRV_PATH | cut -d '/' -f 4)
|
||||
GCROOT=/nix/var/nix/gcroots/albatros/$DRV_NAME
|
||||
rm -f $GCROOT
|
||||
ln -s $DRV_PATH $GCROOT
|
||||
|
|
2
main.go
2
main.go
|
@ -413,7 +413,7 @@ func main() {
|
|||
http.HandleFunc("/build", build)
|
||||
|
||||
// launch
|
||||
log.Println("Listen on :8080")
|
||||
log.Println("Albatros listen on :8080")
|
||||
if err = http.ListenAndServe(":8080", nil); err != nil {
|
||||
log.Fatal("Can't start HTTP server")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue