Fix Namespace Apple runner dispatch
This commit is contained in:
parent
212b129c31
commit
a4db952d3f
12 changed files with 77 additions and 15 deletions
|
|
@ -50,6 +50,29 @@ let
|
|||
forgeAuthorizedKeys = map
|
||||
(username: builtins.readFile identities.${username}.sshPublicKeyPath)
|
||||
(builtins.attrNames (lib.filterAttrs (_: identity: identity.forgeAuthorized or false) identities));
|
||||
forgejoNscMaterializeTokenCache = ''
|
||||
install -d -m 700 -o forgejo-nsc -g forgejo-nsc /var/lib/forgejo-nsc/.config/ns
|
||||
${pkgs.python3}/bin/python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
raw = Path("/var/lib/forgejo-nsc/nsc.token").read_text(encoding="utf-8").strip()
|
||||
if not raw:
|
||||
raise SystemExit("empty Namespace token")
|
||||
if raw.startswith("{"):
|
||||
data = json.loads(raw)
|
||||
if "bearer_token" not in data and "session_token" not in data:
|
||||
raise SystemExit("Namespace token JSON must contain bearer_token or session_token")
|
||||
else:
|
||||
data = {"session_token": raw}
|
||||
Path("/var/lib/forgejo-nsc/.config/ns/token.json").write_text(
|
||||
json.dumps(data) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
PY
|
||||
chown forgejo-nsc:forgejo-nsc /var/lib/forgejo-nsc/.config/ns/token.json
|
||||
chmod 600 /var/lib/forgejo-nsc/.config/ns/token.json
|
||||
'';
|
||||
in
|
||||
|
||||
{
|
||||
|
|
@ -250,6 +273,7 @@ in
|
|||
|
||||
services.forgejo-nsc = {
|
||||
enable = true;
|
||||
nscPackage = self.packages.${pkgs.stdenv.hostPlatform.system}.nsc;
|
||||
nscTokenFile = config.age.secrets.burrowForgejoNscToken.path;
|
||||
dispatcher = {
|
||||
configFile = config.age.secrets.burrowForgejoNscDispatcherConfig.path;
|
||||
|
|
@ -260,6 +284,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
systemd.services.forgejo-nsc-dispatcher.preStart = lib.mkAfter forgejoNscMaterializeTokenCache;
|
||||
systemd.services.forgejo-nsc-autoscaler.preStart = lib.mkAfter forgejoNscMaterializeTokenCache;
|
||||
|
||||
services.burrow.authentik = {
|
||||
enable = true;
|
||||
envFile = config.age.secrets.burrowAuthentikEnv.path;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue