1
0

Deploy iot-data

This commit is contained in:
clerie 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 ./bubblesort.nix
./clerie.nix ./clerie.nix
./gitea.nix ./gitea.nix
./iot-data.nix
./ip.nix ./ip.nix
./meow.nix ./meow.nix
./milchinsel.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";
};
};
};
}

28
pkgs/iot-data/default.nix Normal file
View File

@ -0,0 +1,28 @@
{
buildPythonPackage,
flask,
python3,
}:
let
src = fetchGit {
url = "https://git.clerie.de/clerie/iot-data.git";
rev = "519c68c455961042b282db94a94f0fad0fa2e965";
};
pname = "iot-data";
version = "0.0.1";
in buildPythonPackage rec {
inherit src pname version;
propagatedBuildInputs = [
flask
];
postInstall = ''
mkdir -p $out/${python3.sitePackages}/iot_data
'';
doCheck = false;
}

View File

@ -1,6 +1,7 @@
self: super: { self: super: {
anycast_healthchecker = self.python3.pkgs.callPackage ./anycast_healthchecker {}; anycast_healthchecker = self.python3.pkgs.callPackage ./anycast_healthchecker {};
flask-excel = self.python3.pkgs.callPackage ./flask-excel {}; flask-excel = self.python3.pkgs.callPackage ./flask-excel {};
iot-data = self.python3.pkgs.callPackage ./iot-data {};
pyexcel-xlsx = self.python3.pkgs.callPackage ./pyexcel-xlsx {}; pyexcel-xlsx = self.python3.pkgs.callPackage ./pyexcel-xlsx {};
pyexcel-webio = self.python3.pkgs.callPackage ./pyexcel-webio {}; pyexcel-webio = self.python3.pkgs.callPackage ./pyexcel-webio {};
uptimestatus = self.python3.pkgs.callPackage ./uptimestatus {}; uptimestatus = self.python3.pkgs.callPackage ./uptimestatus {};