run attic as a swarm service with deploy.attic.enable
This commit is contained in:
parent
f59ed01353
commit
458a046b8d
1 changed files with 1242 additions and 66 deletions
41
nix/script-tests/attic-init.nix
Normal file
41
nix/script-tests/attic-init.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# `checks.script-test-attic-init` — runs ../host-modules/lib/attic-init.nix's two
|
||||
# scripts, as the cache's host units run them, against stub `bao`, `openssl`,
|
||||
# `atticadm`, `attic`, `curl` and `systemctl`. The cases are in ./attic-init.sh.
|
||||
#
|
||||
# What runs is the rendered script, behind the same helpers the units put in
|
||||
# front of it.
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
init = import ../host-modules/lib/attic-init.nix { inherit (pkgs) lib; } {
|
||||
jwtPath = "secret/swarm/services/attic/jwt-secret";
|
||||
pullPath = "secret/swarm/services/attic/pull-token";
|
||||
pushPath = "secret/swarm/services/attic/push-token";
|
||||
cache = "grid";
|
||||
endpoint = "http://127.0.0.1:8910";
|
||||
configFile = "@DIR@/server.toml";
|
||||
envFile = "@DIR@/secrets/server.env";
|
||||
machine = "swarm-attic";
|
||||
unit = "swarm-attic";
|
||||
};
|
||||
render =
|
||||
name: body:
|
||||
pkgs.writeText name ''
|
||||
set -euo pipefail
|
||||
${import ../host-modules/lib/atomic-write-secret.nix { }}
|
||||
${import ../host-modules/lib/refresh-consumer.nix { }}
|
||||
${init.prelude}
|
||||
${body}
|
||||
'';
|
||||
in
|
||||
pkgs.runCommand "hyperhive-script-test-attic-init"
|
||||
{
|
||||
ENSURE_JWT = render "ensure-jwt.sh" init.ensureJwt;
|
||||
PROVISION = render "provision.sh" init.provision;
|
||||
}
|
||||
''
|
||||
${pkgs.bash}/bin/bash ${./attic-init.sh}
|
||||
touch "$out"
|
||||
''
|
||||
Loading…
Reference in a new issue