1
0
Fork 0

hswaw/machines/customs: import checkinator via hscloud namespace

Change-Id: I4586c92af4126ec1f1d0d1a1aa2d9dc5c84dec44
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1220
Reviewed-by: q3k <q3k@hackerspace.pl>
master
vuko 2021-12-28 15:05:59 +01:00 committed by q3k
parent 54a34b24a1
commit bd124bd066
6 changed files with 20 additions and 65 deletions

View File

@ -54,7 +54,7 @@ def app(instance_path, devices_api, config):
app.updater = devices_api
if app.config.get('PROXY_FIX'):
from werkzeug.contrib.fixers import ProxyFix
from werkzeug.middleware.proxy_fix import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app)
app.space_auth = SpaceAuth(app)

View File

@ -1,11 +1,11 @@
{ pkgs ? (import <nixpkgs> {}).c.unstable_2020-05}:
{ pkgs, ... }:
let
spaceauth = pkgs.callPackage "${pkgs.fetchgit {
url = "http://code.hackerspace.pl/vuko/nix-spaceauth";
rev = "1c289eafe041d7730a834bb437b7173ca4b9e2c9";
sha256 = "0f2mhbkm92rlx3a1il3wfr4bq6xghdiajczgg349v6a01iazm4qz";
}}/spaceauth.nix" {};
url = "https://code.hackerspace.pl/informatic/flask-spaceauth";
rev = "d3e1a4412cbc929249e407ccecfb54fbbd14e53a";
sha256 = "01qnjj647jw81hcyvq359rwqjpc5ah9ghvc6ic0a0wppp13mgw94";
}}" {};
in pkgs.python3Packages.buildPythonPackage {
pname = "checkinator";
version = "0.2";
@ -13,6 +13,11 @@ in pkgs.python3Packages.buildPythonPackage {
doCheck = false;
src = ./.;
postInstall = ''
cp -r dbsetup.sql $out/dbsetup.sql
cp -r static $out/static
'';
propagatedBuildInputs = with pkgs; [
python3Packages.gunicorn
python3Packages.flask

View File

@ -1,7 +1,8 @@
{ pkgs, ... }:
{ pkgs, workspace, ... }:
let
checkinator = pkgs.callPackage ./checkinator.nix {};
hscloud = workspace;
checkinator = hscloud.hswaw.checkinator;
name = "checkinator-tracker";
user = name;
@ -22,7 +23,7 @@ let
${pkgs.acl}/bin/setfacl -m "u:checkinator-web:rx" ${socket_dir}
'';
config = builtins.toFile "${name}-config.yaml" (pkgs.lib.generators.toYAML {} {
# path to dhcpd lease file
# path to dhcpd lease file
LEASE_FILE = "/var/lib/dhcp/dhcpd.leases";
# timeout for old leases
@ -31,7 +32,7 @@ let
# optional - local trusted socket
GRPC_UNIX_SOCKET = "${socket_dir}/checkinator.sock";
# optional - remote authenticated (TLS cert) socket
# optional - remote authenticated (TLS cert) socket
GRPC_TLS_CERT_DIR = "/mnt/secrets/checkinator-tracker";
GRPC_TLS_CA_CERT = "/mnt/secrets/checkinator-tracker/ca.pem";
GRPC_TLS_ADDRESS = "[::]:2847";

View File

@ -1,7 +1,8 @@
{ pkgs, ... }:
{ pkgs, workspace, ... }:
let
checkinator = pkgs.callPackage ./checkinator.nix {};
hscloud = workspace;
checkinator = hscloud.hswaw.checkinator;
name = "checkinator-web";
user = name;
@ -32,7 +33,7 @@ let
'';
config = builtins.toFile "${name}-config.yaml" (pkgs.lib.generators.toYAML {} {
# local sqlite db for storing user and MAC
# local sqlite db for storing user and MAC
DB = "/var/checkinator-web/at.db";
# debug option interpreted by flask app

View File

@ -1,13 +0,0 @@
diff --git a/at/web.py b/at/web.py
index 34b6337..9eb5e6a 100644
--- a/at/web.py
+++ b/at/web.py
@@ -54,7 +54,7 @@ def app(instance_path, devices_api, config):
app.updater = devices_api
if app.config.get('PROXY_FIX'):
- from werkzeug.contrib.fixers import ProxyFix
+ from werkzeug.middleware.proxy_fix import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app)
app.space_auth = SpaceAuth(app)

View File

@ -1,39 +0,0 @@
{ pkgs }:
let
spaceauth = pkgs.callPackage "${pkgs.fetchgit {
url = "https://code.hackerspace.pl/informatic/flask-spaceauth";
rev = "d3e1a4412cbc929249e407ccecfb54fbbd14e53a";
sha256 = "01qnjj647jw81hcyvq359rwqjpc5ah9ghvc6ic0a0wppp13mgw94";
}}" {};
in pkgs.python3Packages.buildPythonPackage {
pname = "checkinator";
version = "0.2";
doCheck = false;
src = ../../../hswaw/checkinator;
patches = [
./checkinator-werkzeug.patch
];
postInstall = ''
cp -r dbsetup.sql $out/dbsetup.sql
cp -r static $out/static
'';
propagatedBuildInputs = with pkgs; [
python3Packages.gunicorn
python3Packages.flask
python3Packages.pyyaml
python3Packages.isodate
python3Packages.requests
python3Packages.requests-unixsocket
python3Packages.grpcio
python3Packages.grpcio-tools
python3Packages.setuptools
python3Packages.protobuf
spaceauth
iproute
];
}