1
0

Deploy iot-data

This commit is contained in:
2021-06-19 12:51:38 +02:00
parent 416c19b1c3
commit 4707c565b1
4 changed files with 67 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
./bubblesort.nix
./clerie.nix
./gitea.nix
./iot-data.nix
./ip.nix
./meow.nix
./milchinsel.nix

37
hosts/web-2/iot-data.nix Normal file
View File

@@ -0,0 +1,37 @@
{pkgs, ...}:
{
users.users.iot-data = {
description = "IOT Data Service";
group = "iot-data";
home = "/var/lib/iot-data/";
useDefaultShell = true;
isSystemUser = true;
};
users.groups.iot-data = {};
systemd.services.iot-data = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
RuntimeDirectory = "iot-data";
StateDirectory = "iot-data";
User = "iot-data";
Group = "iot-data";
};
environment = {
IOT_DATA_CONFIG = "/var/src/iot-data-config.json";
};
script = "gunicorn -w 1 -b [::1]:8235 iot_data:app";
path = with pkgs; [ (python38.withPackages (ps: [ ps.gunicorn iot-data ])) ];
};
services.nginx.virtualHosts = {
"iot-data.clerie.de" = {
enableACME = true;
addSSL = true;
locations."/" = {
proxyPass = "http://[::1]:8235";
};
};
};
}