From 5b61a319049efb10bff543072465483122f0c06e Mon Sep 17 00:00:00 2001 From: June Date: Mon, 15 Jan 2024 03:25:48 +0100 Subject: [PATCH] Use new spaceapid version and configure temp. and humid. sensors --- .../spaceapid-config/ccchh-dynamic.json | 77 +++++++++++++++++++ .../spaceapid-config/ccchh-response.json | 44 +++++++++++ config/hosts/public-web-static/spaceapid.nix | 14 ++-- 3 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 config/hosts/public-web-static/spaceapid-config/ccchh-dynamic.json create mode 100644 config/hosts/public-web-static/spaceapid-config/ccchh-response.json diff --git a/config/hosts/public-web-static/spaceapid-config/ccchh-dynamic.json b/config/hosts/public-web-static/spaceapid-config/ccchh-dynamic.json new file mode 100644 index 0000000..f7688ff --- /dev/null +++ b/config/hosts/public-web-static/spaceapid-config/ccchh-dynamic.json @@ -0,0 +1,77 @@ +{ + "dynamic": { + "sensors": { + "temperature": [ + { + "sensor_data": { + "unit": "C", + "location": "Hauptraum", + "description": "Sensor im Hauptraum" + }, + "allowed_credentials": [ + "club-assistant" + ] + }, + { + "sensor_data": { + "unit": "C", + "location": "Loetschlauch", + "description": "Sensor im Lötschlauch (Teil der Werkstatt)" + }, + "allowed_credentials": [ + "club-assistant" + ] + }, + { + "sensor_data": { + "unit": "C", + "location": "Innenhof", + "description": "Sensor im Innenhof (erreichbar durch das Flurfenster)" + }, + "allowed_credentials": [ + "club-assistant" + ] + } + ], + "humidity": [ + { + "sensor_data": { + "unit": "%", + "location": "Hauptraum", + "description": "Sensor im Hauptraum" + }, + "allowed_credentials": [ + "club-assistant" + ] + }, + { + "sensor_data": { + "unit": "%", + "location": "Loetschlauch", + "description": "Sensor im Lötschlauch (Teil der Werkstatt)" + }, + "allowed_credentials": [ + "club-assistant" + ] + }, + { + "sensor_data": { + "unit": "%", + "location": "Innenhof", + "description": "Sensor im Innenhof (erreichbar durch das Flurfenster)" + }, + "allowed_credentials": [ + "club-assistant" + ] + } + ] + }, + "state": { + "open": { + "allowed_credentials": [ + "dooris-hauptraum" + ] + } + } + } +} diff --git a/config/hosts/public-web-static/spaceapid-config/ccchh-response.json b/config/hosts/public-web-static/spaceapid-config/ccchh-response.json new file mode 100644 index 0000000..d5a8bf4 --- /dev/null +++ b/config/hosts/public-web-static/spaceapid-config/ccchh-response.json @@ -0,0 +1,44 @@ +{ + "response": { + "api_compatibility": [ + "14" + ], + "space": "CCCHH", + "logo": "https://next.hamburg.ccc.de/images/logo.svg", + "ext_ccc": "erfa", + "url": "https://hamburg.ccc.de/", + "location": { + "address": "Zeiseweg 9, 22765 Hamburg, Germany", + "lon": 9.9445899999999998, + "lat": 53.55836 + }, + "contact": { + "phone": "+49 40 23830150", + "irc": "ircs://irc.hackint.org:6697/#ccchh", + "mastodon": "@ccchh@chaos.social", + "email": "mail@hamburg.ccc.de", + "ml": "talk@hamburg.ccc.de", + "matrix": "#ccchh:hamburg.ccc.de" + }, + "feeds": { + "blog": { + "type": "application/atom+xml", + "url": "https://hamburg.ccc.de/feed.xml" + }, + "calendar": { + "type": "ical", + "url": "webcal://cloud.hamburg.ccc.de/remote.php/dav/public-calendars/QJAdExziSnNJEz5g/?export" + } + }, + "links": [ + { + "name": "Wiki", + "url": "https://wiki.ccchh.net" + }, + { + "name": "GitLab", + "url": "https://gitlab.hamburg.ccc.de" + } + ] + } +} diff --git a/config/hosts/public-web-static/spaceapid.nix b/config/hosts/public-web-static/spaceapid.nix index a2eaa4a..f418f1b 100644 --- a/config/hosts/public-web-static/spaceapid.nix +++ b/config/hosts/public-web-static/spaceapid.nix @@ -2,9 +2,9 @@ let spaceapidSrc = builtins.fetchGit { - url = "https://gitlab.hamburg.ccc.de/ccchh/spaceapid.git"; + url = "https://git.hamburg.ccc.de/CCCHH/spaceapid.git"; ref = "main"; - rev = "baf73f33e7e8ef763869a1677ebf5cd2f334d897"; + rev = "42a012239fc7004c120a74c555a48202f5775bac"; }; spaceapid = pkgs.buildGoModule { pname = "spaceapid"; @@ -16,6 +16,8 @@ let # use the nonexistend vendored dependencies. vendorHash = null; }; + spaceapidConfigResponse = pkgs.writeText "spaceapid-config-ccchh-response.json" (builtins.readFile spaceapid-config/ccchh-response.json); + spaceapidConfigDynamic = pkgs.writeText "spaceapid-config-ccchh-dynamic.json" (builtins.readFile spaceapid-config/ccchh-dynamic.json); in { users.users.spaceapi = { @@ -32,20 +34,18 @@ in After = [ "network.target" "network-online.target" ]; }; serviceConfig = { - ExecStart = "${spaceapid}/bin/spaceapid"; + ExecStart = "${spaceapid}/bin/spaceapid -c ${spaceapidConfigResponse},${spaceapidConfigDynamic},/secrets/spaceapid-config-ccchh-credentials.secret"; User = "spaceapi"; Group = "spaceapi"; Restart = "on-failure"; - Environment = "BA_USERNAME=dooris JSON_TEMPLATE_PATH=${spaceapidSrc}/ccchh-template.json"; - EnvironmentFile = "/secrets/spaceapid-environment-secrets.secret"; StateDirectory = "spaceapid"; }; wantedBy = [ "multi-user.target" ]; }; deployment.keys = { - "spaceapid-environment-secrets.secret" = { - keyCommand = [ "pass" "noc/vm-secrets/chaosknoten/public-web-static/spaceapid-environment-secrets" ]; + "spaceapid-config-ccchh-credentials.secret" = { + keyCommand = [ "pass" "noc/vm-secrets/chaosknoten/public-web-static/spaceapid-config-ccchh-credentials" ]; destDir = "/secrets"; user = "spaceapi"; group = "spaceapi";