Skip to content

Commit 4ffa25f

Browse files
authored
frigate: 0.14.1 -> 0.15.0 (#386266)
2 parents 46c7edc + 1faec56 commit 4ffa25f

File tree

6 files changed

+558
-136
lines changed

6 files changed

+558
-136
lines changed

nixos/modules/services/video/frigate.nix

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ in
254254
proxy_set_header Cookie $http_cookie;
255255
proxy_set_header X-CSRF-TOKEN "1";
256256
257+
# Header used to validate reverse proxy trust
258+
proxy_set_header X-Proxy-Secret $http_x_proxy_secret;
259+
257260
# Pass headers for common auth proxies
258261
proxy_set_header Remote-User $http_remote_user;
259262
proxy_set_header Remote-Groups $http_remote_groups;
@@ -282,6 +285,8 @@ in
282285
283286
add_header Cache-Control "no-store";
284287
expires off;
288+
289+
keepalive_disable safari;
285290
'';
286291
};
287292
"/stream/" = {
@@ -407,7 +412,7 @@ in
407412
proxyPass = "http://frigate-api";
408413
recommendedProxySettings = true;
409414
extraConfig = nginxAuthRequest + nginxProxySettings + ''
410-
rewrite ^/api/(.*)$ $1 break;
415+
rewrite ^/api/(.*)$ /$1 break;
411416
'';
412417
};
413418
"/api/" = {
@@ -443,7 +448,7 @@ in
443448
location /api/stats {
444449
${nginxAuthRequest}
445450
access_log off;
446-
rewrite ^/api/(.*)$ $1 break;
451+
rewrite ^/api(/.*)$ $1 break;
447452
add_header Cache-Control "no-store";
448453
proxy_pass http://frigate-api;
449454
${nginxProxySettings}
@@ -452,7 +457,7 @@ in
452457
location /api/version {
453458
${nginxAuthRequest}
454459
access_log off;
455-
rewrite ^/api/(.*)$ $1 break;
460+
rewrite ^/api(/.*)$ $1 break;
456461
add_header Cache-Control "no-store";
457462
proxy_pass http://frigate-api;
458463
${nginxProxySettings}
@@ -560,7 +565,7 @@ in
560565
"multi-user.target"
561566
];
562567
environment = {
563-
CONFIG_FILE = format.generate "frigate.yml" filteredConfig;
568+
CONFIG_FILE = "/run/frigate/frigate.yml";
564569
HOME = "/var/lib/frigate";
565570
PYTHONPATH = cfg.package.pythonPath;
566571
} // optionalAttrs (cfg.vaapiDriver != null) {
@@ -578,11 +583,17 @@ in
578583
] ++ optionals (!stdenv.hostPlatform.isAarch64) [
579584
# not available on aarch64-linux
580585
intel-gpu-tools
586+
rocmPackages.rocminfo
581587
];
582588
serviceConfig = {
583-
ExecStartPre = pkgs.writeShellScript "frigate-clear-cache" ''
584-
rm --recursive --force /var/cache/frigate/*
585-
'';
589+
ExecStartPre = [
590+
(pkgs.writeShellScript "frigate-clear-cache" ''
591+
rm --recursive --force /var/cache/frigate/*
592+
'')
593+
(pkgs.writeShellScript "frigate-create-writable-config" ''
594+
cp --no-preserve=mode "${format.generate "frigate.yml" filteredConfig}" /run/frigate/frigate.yml
595+
'')
596+
];
586597
ExecStart = "${cfg.package.python.interpreter} -m frigate";
587598
Restart = "on-failure";
588599
SyslogIdentifier = "frigate";

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ in {
410410
freeswitch = handleTest ./freeswitch.nix {};
411411
freetube = discoverTests (import ./freetube.nix);
412412
freshrss = handleTest ./freshrss {};
413-
frigate = handleTest ./frigate.nix {};
413+
frigate = runTest ./frigate.nix;
414414
frp = handleTest ./frp.nix {};
415415
frr = handleTest ./frr.nix {};
416416
fsck = handleTest ./fsck.nix {};

nixos/tests/frigate.nix

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,81 @@
1-
import ./make-test-python.nix (
2-
{ pkgs, lib, ... }:
1+
{
2+
pkgs,
3+
lib,
4+
...
5+
}:
36

4-
{
5-
name = "frigate";
6-
meta.maintainers = with lib.maintainers; [ hexa ];
7+
{
8+
name = "frigate";
9+
meta = { inherit (pkgs.frigate.meta) maintainers; };
710

8-
nodes = {
9-
machine = {
10-
services.frigate = {
11-
enable = true;
11+
nodes = {
12+
machine = {
13+
services.frigate = {
14+
enable = true;
1215

13-
hostname = "localhost";
16+
hostname = "localhost";
1417

15-
settings = {
16-
mqtt.enabled = false;
18+
settings = {
19+
mqtt.enabled = false;
1720

18-
cameras.test = {
19-
ffmpeg = {
20-
input_args = "-fflags nobuffer -strict experimental -fflags +genpts+discardcorrupt -r 10 -use_wallclock_as_timestamps 1";
21-
inputs = [
22-
{
23-
path = "http://127.0.0.1:8080";
24-
roles = [
25-
"record"
26-
];
27-
}
28-
];
29-
};
21+
cameras.test = {
22+
ffmpeg = {
23+
input_args = "-fflags nobuffer -strict experimental -fflags +genpts+discardcorrupt -r 10 -use_wallclock_as_timestamps 1";
24+
inputs = [
25+
{
26+
path = "http://127.0.0.1:8080";
27+
roles = [
28+
"record"
29+
];
30+
}
31+
];
3032
};
31-
32-
record.enabled = true;
3333
};
34-
};
3534

36-
systemd.services.video-stream = {
37-
description = "Start a test stream that frigate can capture";
38-
before = [
39-
"frigate.service"
40-
];
41-
wantedBy = [
42-
"multi-user.target"
43-
];
44-
serviceConfig = {
45-
DynamicUser = true;
46-
ExecStart = "${lib.getExe pkgs.ffmpeg-headless} -re -f lavfi -i smptebars=size=1280x720:rate=5 -f mpegts -listen 1 http://0.0.0.0:8080";
47-
Restart = "always";
48-
};
35+
record.enabled = true;
4936
};
37+
};
5038

51-
environment.systemPackages = with pkgs; [ httpie ];
39+
systemd.services.video-stream = {
40+
description = "Start a test stream that frigate can capture";
41+
before = [
42+
"frigate.service"
43+
];
44+
wantedBy = [
45+
"multi-user.target"
46+
];
47+
serviceConfig = {
48+
DynamicUser = true;
49+
ExecStart = "${lib.getExe pkgs.ffmpeg-headless} -re -f lavfi -i smptebars=size=1280x720:rate=5 -f mpegts -listen 1 http://0.0.0.0:8080";
50+
Restart = "always";
51+
};
5252
};
53+
54+
environment.systemPackages = with pkgs; [ httpie ];
5355
};
56+
};
5457

55-
testScript = ''
56-
start_all()
58+
testScript = ''
59+
start_all()
5760
58-
# wait until frigate is up
59-
machine.wait_for_unit("frigate.service")
60-
machine.wait_for_open_port(5001)
61+
# wait until frigate is up
62+
machine.wait_for_unit("frigate.service")
63+
machine.wait_for_open_port(5001)
6164
62-
# extract admin password from logs
63-
machine.wait_until_succeeds("journalctl -u frigate.service -o cat | grep -q 'Password: '")
64-
password = machine.execute("journalctl -u frigate.service -o cat | grep -oP '([a-f0-9]{32})'")[1]
65+
# extract admin password from logs
66+
machine.wait_until_succeeds("journalctl -u frigate.service -o cat | grep -q 'Password: '")
67+
password = machine.execute("journalctl -u frigate.service -o cat | grep -oP '([a-f0-9]{32})'")[1]
6568
66-
# login and store session
67-
machine.log(machine.succeed(f"http --check-status --session=frigate post http://localhost/api/login user=admin password={password}"))
69+
# login and store session
70+
machine.log(machine.succeed(f"http --check-status --session=frigate post http://localhost/api/login user=admin password={password}"))
6871
69-
# make authenticated api request
70-
machine.log(machine.succeed("http --check-status --session=frigate get http://localhost/api/version"))
72+
# make authenticated api request
73+
machine.log(machine.succeed("http --check-status --session=frigate get http://localhost/api/version"))
7174
72-
# make unauthenticated api request
73-
machine.log(machine.succeed("http --check-status get http://localhost:5000/api/version"))
75+
# make unauthenticated api request
76+
machine.log(machine.succeed("http --check-status get http://localhost:5000/api/version"))
7477
75-
# wait for a recording to appear
76-
machine.wait_for_file("/var/cache/frigate/test@*.mp4")
77-
'';
78-
}
79-
)
78+
# wait for a recording to appear
79+
machine.wait_for_file("/var/cache/frigate/test@*.mp4")
80+
'';
81+
}

0 commit comments

Comments
 (0)