forked from CCCHH/nix-infra
		
	Use new spaceapid version and configure temp. and humid. sensors
This commit is contained in:
		
					parent
					
						
							
								ec5430ee34
							
						
					
				
			
			
				commit
				
					
						5b61a31904
					
				
			
		
					 3 changed files with 128 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -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"
 | 
			
		||||
        ]
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue