2021-12-26 23:17:13 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
backend_port = 30005;
|
|
|
|
#host = config.networking.hostName;
|
|
|
|
ident = 998;
|
|
|
|
user = "${toString ident}:${toString ident}";
|
2022-06-06 19:08:21 +00:00
|
|
|
backend_host = "tonie.lan";
|
|
|
|
#backend_host = "tonie.omo.r";
|
2021-12-26 23:17:13 +00:00
|
|
|
frontend_port = 30006;
|
|
|
|
homedir = "/var/lib/tonies";
|
|
|
|
albumdir = "${homedir}/albumart/";
|
|
|
|
vueconfig = pkgs.writeText "vueconfig" ''
|
|
|
|
module.exports = {
|
|
|
|
devServer: {
|
|
|
|
disableHostCheck: true
|
|
|
|
},
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
audiobookdir = "/media/cryptX/music/kinder_hoerspiele";
|
|
|
|
# TONIE_AUDIO_MATCH_USER = username;
|
|
|
|
# TONIE_AUDIO_MATCH_PASS = password;
|
|
|
|
tonie-env = toString <secrets/tonie.env>;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d ${albumdir} 1750 toniebox toniebox -"
|
|
|
|
];
|
|
|
|
networking.firewall.allowedTCPPorts = [ frontend_port backend_port ];
|
|
|
|
virtualisation.oci-containers.containers.toniebox-front = {
|
2021-12-27 12:12:39 +00:00
|
|
|
image = "makefoo/toniebox-audio-match_front:1.0.1";
|
2021-12-26 23:17:13 +00:00
|
|
|
inherit user;
|
|
|
|
environment = {
|
2021-12-27 12:12:39 +00:00
|
|
|
VUE_APP_BACKEND_IS_LOCAL = "true";
|
2021-12-26 23:17:13 +00:00
|
|
|
};
|
|
|
|
ports = [ "${toString frontend_port}:8080" ];
|
|
|
|
volumes = [
|
|
|
|
"${albumdir}:/frontend/public/assets/covers"
|
|
|
|
"${vueconfig}:/frontend/vue.config.js"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.toniebox = {
|
|
|
|
isSystemUser = true;
|
|
|
|
uid = ident;
|
|
|
|
home = homedir;
|
|
|
|
createHome = true;
|
|
|
|
group = "toniebox";
|
|
|
|
};
|
|
|
|
users.groups.toniebox.gid = ident;
|
|
|
|
|
|
|
|
virtualisation.oci-containers.containers.toniebox-back = {
|
|
|
|
image = "makefoo/toniebox-audio-match_back:1.0.0";
|
|
|
|
inherit user;
|
|
|
|
environmentFiles = [ tonie-env ];
|
|
|
|
ports = [ "${toString backend_port}:5000" ];
|
|
|
|
volumes = [
|
|
|
|
"${albumdir}:/backend/assets/covers"
|
|
|
|
"${audiobookdir}:/backend/assets/audiobooks"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
services.nginx.virtualHosts."tonie" = {
|
|
|
|
serverAliases = [ "tonie.lan" "tonie.omo.r" backend_host ];
|
2021-12-26 23:20:23 +00:00
|
|
|
locations."/".proxyPass = "http://localhost:${toString frontend_port}";
|
2021-12-26 23:17:13 +00:00
|
|
|
locations."/upload".proxyPass = "http://localhost:${toString backend_port}";
|
|
|
|
locations."/creativetonies".proxyPass = "http://localhost:${toString backend_port}";
|
|
|
|
locations."/audiobooks".proxyPass = "http://localhost:${toString backend_port}";
|
|
|
|
};
|
|
|
|
}
|