Host upbank2firefly #78

Merged
wi11-holdsworth merged 2 commits from 71 into main 2026-01-14 21:34:28 +11:00
4 changed files with 78 additions and 0 deletions

View file

@ -28,6 +28,7 @@
"readarr" "readarr"
"sonarr" "sonarr"
"syncthing" "syncthing"
"upbank2firefly"
"vaultwarden" "vaultwarden"
# keep-sorted end # keep-sorted end
]; ];

View file

@ -0,0 +1,76 @@
{
config,
pkgs,
...
}:
let
port = 5021;
in
{
virtualisation.oci-containers = {
backend = "docker";
containers.upbank2firefly = {
extraOptions = [
"--network=host"
];
image = "compose2nix/upbank2firefly";
environment = {
FIREFLY_BASEURL = "https://firefly.fi33.buzz";
TZ = "Australia/Melbourne";
};
environmentFiles = [ config.age.secrets.upbank2firefly.path ];
volumes = [
"/srv/upbank2firefly/app:/app:rw"
];
ports = [
"${toString port}:80/tcp"
];
};
};
systemd = {
services = {
"docker-build-upbank2firefly" = {
path = with pkgs; [
docker
git
];
serviceConfig = {
Type = "oneshot";
TimeoutSec = 300;
};
script = ''
cd /srv/upbank2firefly
git pull
docker build -t compose2nix/upbank2firefly .
'';
};
"upbank2firefly-getall" = {
script = ''
cd /srv/upbank2firefly
docker container exec -e FLASK_APP=main upbank2firefly flask getall --since "$(date -d "1 hour ago" +"%Y-%m-%d %H:%M:%S")"
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
};
timers."upbank2firefly-getall" = {
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "upbank2firefly-getall.service";
OnCalendar = "hourly";
Persistent = true;
};
};
};
services.nginx.virtualHosts."upbank2firefly.fi33.buzz" = {
forceSSL = true;
useACMEHost = "fi33.buzz";
locations."/".proxyPass = "http://localhost:${toString port}";
};
age.secrets.upbank2firefly.file = ../../../secrets/upbank2firefly.age;
}

View file

@ -39,6 +39,7 @@ in
"radicale.age".publicKeys = users; "radicale.age".publicKeys = users;
"readarr.age".publicKeys = users; "readarr.age".publicKeys = users;
"sonarr.age".publicKeys = users; "sonarr.age".publicKeys = users;
"upbank2firefly.age".publicKeys = users;
"vaultwarden-admin.age".publicKeys = users; "vaultwarden-admin.age".publicKeys = users;
# keep-sorted end # keep-sorted end
} }

BIN
secrets/upbank2firefly.age Normal file

Binary file not shown.