Commit Graph

1011 Commits

Author SHA1 Message Date
Scott Lamb 115b081dcd update arm docker build notes 2021-08-12 09:36:13 -07:00
Scott Lamb f512d5cacb typo: don't run on node 18 2021-08-11 23:56:29 -07:00
Scott Lamb 164c8c5b21 clarify support for node 12 and 14
* run node 12, 14, and 16 (next to be supported) on CI. This will catch
  node version-specific problems like that solved in dad9bdc.
* mention 12 and 14 in build instructions and link to instructions for
  installing that version.
* follow this in Dockerfile, installing version 14. This addresses
  a "Cannot find module 'worker_threads'" error introduced in
  39a63e0, which (inadvisedly) upgraded gzipper 4->5 in addition to
  the material-ui upgrade.
* use utf-8 encoding rather than ascii in live part parser. Those
  builds apparently don't support ascii. iThey must use "small-icu" or
  have ICU disabled, as described here:
  https://nodejs.org/api/util.html#util_encodings_supported_when_node_js_is_built_with_the_small_icu_option
2021-08-11 23:45:17 -07:00
Scott Lamb 6426745c8c link to material-ui issue about date picker sizing 2021-08-11 15:06:03 -07:00
Scott Lamb f4c70803d3 add warning about docker builds not working on arm
see #141
2021-08-11 14:38:41 -07:00
Scott Lamb 889deac5be explicitly cd into dir in build instructions
as suggested in #141
2021-08-11 13:52:53 -07:00
Scott Lamb dad9bdc20f fix test error with node 14
This worked fine on my workstation with node 12. But on CI or my laptop
with node 14, it failed. Apparently there @testing-library/user-events
expects a peer @testing-library/dom dependency. At least copying the
"npm install --save-dev @testing-library/user-event @testing-library/dom" command
from the top of https://testing-library.com/docs/ecosystem-user-event/
made it work again on my laptop; fingers crossed about CI.
2021-08-10 13:07:13 -07:00
Scott Lamb 39a63e03ae upgrade material-ui to latest beta
This is a surprisingly complex upgrade. Some relevant changes from
[their CHANGELOG](https://github.com/mui-org/material-ui/blob/v5.0.0-beta.3/CHANGELOG.md):

* @material-ui/core/styles no longer re-exports some stuff from
  @material-ui/styles
* there's no more defaultTheme, so tests need to provide one
* select's onChange has a new type; match that. I haven't actually
  tried that the string form (apparently from autofill) works correctly.
* checkboxes no longer default to the secondary color; explicitly
  request this in some places.
* checkbox no longer has a checked argument; use event.target.checked
  instead.
* date pickers have switched to the new style system, so I had to
  redo how I was overridding their spacing for desktop.
* LoadingButton now has a loading property, not pending
* createMuiTheme is no createTheme
2021-08-10 12:43:10 -07:00
Scott Lamb c55032dfcd don't panic on bind failure
Fixes #136

Before:

```
E20210803 09:00:31.161 main moonfire_nvr] panic at '/Users/slamb/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.10/src/server/server.rs:68:17': error binding to 0.0.0.0:80: error creating server listener: Address already in use (os error 48)

(set environment variable RUST_BACKTRACE=1 to see backtraces)
...potentially unrelated log msgs from other threads before exiting...
```

After:

```
E20210803 09:06:02.633 main moonfire_nvr] Exiting due to error: unable to bind --http-addr=0.0.0.0:80
caused by: error creating server listener: Address already in use (os error 48)

(set environment variable RUST_BACKTRACE=1 to see backtraces)
```
2021-08-03 09:09:11 -05:00
Scott Lamb dcfe792032 display String panic msgs as well as &str ones
For #136. I'm also going to make this particular case no longer panic,
but there will surely be other affected panics.

Before:

```
E20210803 08:58:31.606 main moonfire_nvr] panic at '/Users/slamb/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.10/src/server/server.rs:68:17'
```

After:

```
E20210803 08:59:51.319 main moonfire_nvr] panic at '/Users/slamb/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.10/src/server/server.rs:68:17': error binding to 0.0.0.0:80: error creating server listener: Address already in use (os error 48)
```
2021-08-03 09:00:37 -05:00
Scott Lamb 84ce447fab
use journald log driver in docker wrapper script
As mentioned in https://lwn.net/Articles/676831/, Docker's default loses the logs every time a container is destroyed. Also, https://docs.docker.com/config/containers/logging/configure/ says that the default never rotates the logfiles.
2021-07-16 09:23:45 -07:00
Scott Lamb 3ce9366b0c links to system setup wiki page 2021-07-13 16:08:50 -07:00
Scott Lamb 2c3a22c223 link to our own guide on disabling UAS 2021-07-13 12:49:17 -07:00
Scott Lamb 6046598179 use "unless-stopped" rather than "on-failure"
The latter doesn't restart the docker container on system startup.
2021-07-13 11:23:41 -07:00
Scott Lamb 1bd05348bf troubleshooting section about incorrect timestamps 2021-07-13 11:18:17 -07:00
Scott Lamb 1df55efc43 upgrade some server deps
I avoided rtcp 0.2.2->0.2.3 because of an accidental semver break.
2021-07-09 15:01:15 -07:00
Scott Lamb 75e3b85850 upgrade to retina v0.0.5
While I'm here, return a clean error if a non-initial video frame
includes a parameter change, rather than doing something crazy (#42).
It's still broken under ffmpeg, it's untested, and it's not as clean
as seamlessly starting a new recording with the new parameters, but
it's better than nothing.
2021-07-08 16:06:30 -07:00
Scott Lamb f078328935 prepare v0.6.4 2021-06-28 20:32:33 -07:00
Scott Lamb a50625e769 add camera name to rtp packet loss messages 2021-06-28 17:49:47 -07:00
Scott Lamb 5be69baaa6 switch default RTSP library to retina 2021-06-28 16:38:21 -07:00
Scott Lamb 7034480cfe make retina's behavior more like ffmpeg's
*   have a timeout for opening the connection and getting the next
    video frame. The former is quite important. The latter is arguably
    redundant with the keepalive timer, but this ensures we actually
    get a full frame in this timespan rather than some keepalive
    responses, RTCP sender reports, or partial frames.
*   don't drop extra stuff on loss; just note it. I'm not sure what the
    right behavior is but I think I shouldn't change too much at once.
2021-06-28 16:29:53 -07:00
Scott Lamb a0ed74e8e0 use retina 0.0.4
retina 0.0.3 had a fatal bug: it broke after keepalive responses.
2021-06-28 15:41:50 -07:00
Scott Lamb 144a640339 allow overriding tokio worker threads
I see a lot of yields and such in CPU profiles. I think the workers
are frequently waking up, finding there's not much to do, and going back
to sleep. Reducing the number of worker threads seems reasonable.
2021-06-28 15:00:12 -07:00
Scott Lamb 547c106e6b tell retina not to enforce timestamps
Moonfire NVR has some enforcement on its own; this makes retina vs
ffmpeg more of an apples-to-apples comparison.

I'm also thinking of dropping enforcement from retina; enough things
have sketchy timestamps that this policy doesn't make much sense anyway.
2021-06-28 14:26:36 -07:00
Scott Lamb 4c95df5ba7 upgrade to retina 0.0.3
The new version is more efficient.
2021-06-28 14:25:35 -07:00
Scott Lamb 9cb19d5c82 tweak deps, eliminating strsim 0.8 dependency
I also enabled the colored help option for clap, since we're paying for
the color dep anyway.
2021-06-15 00:45:11 -07:00
Scott Lamb 92a365eb73 use released versions of a few deps 2021-06-09 14:36:14 -07:00
Scott Lamb 3a6918f3df raise minimum Rust version to 1.52
as required by Retina
2021-06-07 14:43:26 -07:00
Scott Lamb 032bd76577 support --rtsp-library=retina (#37)
This isn't well-tested and doesn't yet support an initial connection
timeout. But in a quick test, it successfully returns video!

I'd like to do some more aggressive code restructuring for zero-copy
and to have only one writer thread per sample file directory (rather
than the syncer thread + one writer thread per RTSP stream). But I'll
likely wait until I drop support for ffmpeg entirely.
2021-06-07 14:40:26 -07:00
Scott Lamb 7699696bd9 remove half-baked analytics module
This is (slightly) complicating the switch from ffmpeg to retina
as the RTSP client. And it's not really that close to what I want
to end up with for analytics:

*   I'd prefer the analytics happen in a separate process for
    several reasons
*   Feeding the entire frame to the object detector doesn't produce
    good results.
*   It doesn't do anything with the results yet anyway.
2021-06-06 21:14:42 -07:00
dependabot[bot] cf57073d6e Bump ws from 6.2.1 to 6.2.2 in /ui
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-06 09:56:16 -07:00
dependabot[bot] 568e47b843 Bump dns-packet from 1.3.1 to 1.3.4 in /ui
Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mafintosh/dns-packet/compare/v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-05 20:02:29 -07:00
Scott Lamb 9cc63faf29 logging improvements
*   allow debug/trace logging on release builds again
*   enable log messages from hyper. I didn't notice they went
    away with 0.14.0, although there's a breaking change in the log:
    https://github.com/hyperium/hyper/blob/master/CHANGELOG.md#v0140-2020-12-23
*   downgrade some particularly spammy messages
2021-06-04 23:33:51 -07:00
Scott Lamb 7591146928 fix thinko in video sample chunk code
This caused served chunks to be truncated. On seek, nginx sometimes
served 502 errors, chrome sometimes returned
ERR_CONTENT_LENGTH_MISMATCH, and videos weren't playing properly.
2021-06-04 23:10:13 -07:00
Scott Lamb bb69d1488e cargo fmt 2021-06-04 20:25:19 -07:00
Scott Lamb 23d77693de read sample files from dedicated threads
Reading from the mmap()ed region in the tokio threads could cause
them to stall:

*   That could affect UI serving when there were concurrent
    UI requests (i.e., not just requests that needed the reads in
    question anyway).
*   If there's a faulty disk, it could cause the UI to totally hang.
    Better to not mix disks between threads.
*   Soon, I want to handle RTSP from the tokio threads (#37). Similarly,
    we don't want RTSP streaming to block on operations from unrelated
    disks.

I went with just one thread per disk which I think is sufficient.
But it'd be possible to do a fixed-size pool instead which might improve
latency when some pages are already cached.

I also dropped the memmap dependency. I had to compute the page
alignment anyway to get mremap to work, and Moonfire NVR already is
Unix-specific, so there wasn't much value from the memmap or memmap2
crates.

Fixes #88
2021-06-04 19:50:13 -07:00
Scott Lamb 90dd68ee7c update nginx tutorial link 2021-06-04 09:00:24 -07:00
Scott Lamb 0068a9ae70 more anamorphic streams
* my dad's GW4089IP cameras use 720x480
* some Reolink cameras use 640x352
* I'm playing with rotated cameras (16x9 -> 9x16)

I'd prefer to calculate pasp from a configured camera aspect ratio
than to hardcode the assumption these are 16x9, but that requires
a schema change. This is an improvement for now.
2021-05-22 20:45:07 -07:00
Scott Lamb 54bd068706 address some no-op clippy warnings 2021-05-17 15:00:51 -07:00
Scott Lamb 603f02b686 stop using old tempdir crate 2021-05-17 13:08:18 -07:00
Scott Lamb 13b497e243 update libpasta deps 2021-05-17 13:02:26 -07:00
Scott Lamb 8b37c77558 de-dupe prettydiff deps via a fork 2021-05-17 12:17:18 -07:00
Scott Lamb ef0bc8acf9 update various other deps 2021-05-17 11:05:54 -07:00
Scott Lamb f922afaa26 update rusqlite
The big difference here is query_named and execute_named have gone
away. Fair number of lines changes but straightforward.
2021-05-17 10:50:48 -07:00
Scott Lamb dc1c9afa73 cargo update
The immediate motivation is to address these CI failures with nightly:
https://github.com/scottlamb/moonfire-nvr/runs/2593322801?check_suite_focus=true
```
   Compiling lock_api v0.4.2
error[E0557]: feature has been removed
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.2/src/lib.rs:91:42
   |
91 | #![cfg_attr(feature = "nightly", feature(const_fn))]
   |                                          ^^^^^^^^ feature has been removed
   |
   = note: split into finer-grained feature gates
```

Strangely, they don't occur locally with "rustc 1.54.0-nightly
(fe72845f7 2021-05-16)" but do on CI with the exact same version?!?
I don't get it, but lock-api 0.4.4 is advertised as being updated for
latest nightly, so I expect this will address the problem anyway.
2021-05-17 10:31:06 -07:00
Scott Lamb 80ec7ab1d0 cleanup some awkward Option call chains 2021-05-17 09:34:10 -07:00
Scott Lamb 33e8359b01 fix broken toc link 2021-05-15 21:54:53 -07:00
Scott Lamb d0c7bb0b9c fix broken link to on-demand section 2021-05-15 21:53:36 -07:00
Scott Lamb a1e78ea48b better debugging when unable to insert VSE
I saw this error once:

Apr 27 21:01:33 nuc moonfire-nvr[188570]: s-reolink-sub
moonfire_nvr::streamer] reolink-sub: sleeping for Duration { secs: 1,
nanos: 0 } after error: CHECK constraint failed: video_sample_entry

and would like to understand it better.
2021-04-27 22:52:47 -07:00
Scott Lamb d99e18d17e adjust support instructions
*   send folks to the issue tracker with the same template as bug
    reports. Gathering this extra info up front should help things
    move more quickly.
*   in the template, ask for camera info.
2021-04-27 11:08:54 -07:00