2020-12-02 10:33:12 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
frontend-config = builtins.toFile "owntracks-frontend-config.js" ''
|
|
|
|
window.owntracks = window.owntracks || {};
|
|
|
|
window.owntracks.config = {};
|
|
|
|
'';
|
|
|
|
in {
|
2022-05-30 01:43:22 +02:00
|
|
|
age.secrets.owntracks-recorder-env.file =
|
|
|
|
../secrets/owntracks/recorder.env.age;
|
2022-05-06 03:16:17 +02:00
|
|
|
age.secrets.owntracks-htpasswd.file = ../secrets/owntracks/htpasswd.age;
|
|
|
|
|
2020-12-02 10:33:12 +01:00
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
owntracks-recorder = {
|
|
|
|
# official image does not support aarch64
|
|
|
|
# image = "owntracks/recorder";
|
|
|
|
image = "easypi/ot-recorder-arm";
|
|
|
|
ports = [ "8083:8083" ];
|
|
|
|
environment = {
|
|
|
|
OTR_HOST = "localhost";
|
|
|
|
OTR_PORT = "1883";
|
|
|
|
OTR_USER = "owntracks";
|
|
|
|
};
|
2022-05-30 01:43:22 +02:00
|
|
|
# provide OTR_PASS
|
|
|
|
environmentFiles = [ config.age.secrets.owntracks-recorder-env.path ];
|
2020-12-02 10:33:12 +01:00
|
|
|
# easypi/ot-recorder-arm uses different store location
|
|
|
|
# volumes = [ "/var/lib/owntracks/recorder/store:/store" ];
|
2022-01-01 02:13:02 +01:00
|
|
|
volumes = [
|
|
|
|
"/var/lib/owntracks/recorder/store:/var/spool/owntracks/recorder/store"
|
|
|
|
];
|
2022-05-30 01:43:22 +02:00
|
|
|
extraOptions = [ "--network=host" ];
|
2020-12-02 10:33:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
owntracks-frontend = {
|
|
|
|
image = "owntracks/frontend";
|
|
|
|
ports = [ "8085:8085" ];
|
|
|
|
environment = {
|
|
|
|
SERVER_HOST = "localhost";
|
|
|
|
SERVER_PORT = "8083";
|
|
|
|
LISTEN_PORT = "8085";
|
|
|
|
};
|
2022-01-01 02:13:02 +01:00
|
|
|
volumes = [ "${frontend-config}:/usr/share/nginx/html/config/config.js" ];
|
2020-12-02 10:33:12 +01:00
|
|
|
extraOptions = [ "--network=host" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
nginx = {
|
|
|
|
virtualHosts."owntracks.felschr.com" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/".proxyPass = "http://localhost:8085";
|
2022-05-04 03:02:47 +02:00
|
|
|
basicAuthFile = config.age.secrets.owntracks-htpasswd.path;
|
2020-12-02 10:33:12 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|