Commit Graph

24 Commits

Author SHA1 Message Date
Scott Lamb 140f625a80 clippy 2024-08-19 08:13:35 -07:00
Scott Lamb f385215d6e clippy 2024-02-12 17:32:37 -08:00
Scott Lamb 86816e862a update some Rust dependencies
I didn't go to quite the latest version of everything, in an effort to
minimize duplicates in the cargo tree.
2024-01-06 11:41:28 -08:00
Scott Lamb a76483a912 stop using cargo pkg version
One fewer thing to manage at release time.
2023-10-17 09:44:30 -07:00
Scott Lamb b9db9c11cc improve some error logs
...in particular, pass the error as a tracing param rather than directly
in the main error message. The new behavior is nicer with e.g.
OpenTelemetry.
2023-08-03 15:46:36 -05:00
Scott Lamb 64ca096ff3 massive error overhaul
* fully stop using ancient `failure` crate in favor of own error type
* set an `ErrorKind` on everything
2023-07-09 22:04:17 -07:00
Scott Lamb ebcdd76084 switch from `log` to `tracing`
I think this is a big improvement in readability.

I removed the `lnav` config, which is a little sad, but I don't think it
supports this structured logging format well. Still seems worthwhile on
balance.
2023-07-04 16:51:22 -07:00
Scott Lamb 0866b23991 clean up the easy clippy errors
I'm still not running clippy on CI and probably should.
There are a few left that were a little more involved to address.
2022-09-28 09:29:16 -07:00
Scott Lamb 841e06e354 update a few deps 2022-05-02 11:23:03 -07:00
Scott Lamb 7ad5bf56a7 fix out-of-date sql in `nvr check` 2021-10-26 14:32:37 -07:00
Scott Lamb 721141770f flexible config for sample_file_dir 2021-10-26 11:47:13 -07:00
Scott Lamb dad349840d more flexible signals
Now there's room to add arbitrary configuration to signals and types.
Several things are no longer fixed columns/tables but instead within
the configuration types.
2021-10-26 10:15:09 -07:00
Scott Lamb 54bd068706 address some no-op clippy warnings 2021-05-17 15:00:51 -07:00
Scott Lamb cb4f30b5a2 rearrange check deletes to satisfy foreign key
Otherwise `moonfire-nvr check --delete-orphan-rows` can fail with this
error:

```
I0305 113848.655 main moonfire_db::check] Deleting 2 recording rows
E0305 113848.655 main moonfire_nvr] Exiting due to error: FOREIGN KEY constraint failed
```

The new order matches the online system's `db::raw::delete_recordings`.
2021-03-05 12:02:43 -08:00
Scott Lamb c547a49ac8 shorten per-file copyright headers
I'm tired of all the boilerplate, so use the new
GPL-3.0-linking-exception license identifier instead in all the server
components.

I left the ui stuff alone because I'm just going to replace it (#111).

Add a checker for the header because it's easy to forget.
2021-02-17 15:39:17 -08:00
Scott Lamb 97678f42e4 rustfmt everything
I want to make the project more accessible by not expecting folks to
match my idiosyncratic style. Now almost [1] everything is written
in the "standard" style. CI enforces this.

[1] "Almost": I used #[rustfmt::skip] in a few sections where I felt
aligning things in columns significantly improves readability.
2021-02-17 09:17:24 -08:00
Scott Lamb ed521521a4 fix SQLite3 integrity check 2021-02-11 20:27:12 -08:00
Scott Lamb fdb6603b5e also cleanup "Recording .. missing playback row" 2021-02-11 20:10:38 -08:00
Scott Lamb 7f711eedeb add some mutation flags to moonfire-nvr check
For recovering from corruption, as in #107. These should aid in
restoring database integrity without throwing away the entire database.
I only added the conditions that came up in #107, so far.

*   "Missing ... row" => --trash-orphan-sample-files
*   "Recording ... missing file" => --delete-orphan-rows
*   "bad video_index" => --trash-corrupt-rows
2021-02-11 20:03:28 -08:00
Scott Lamb 972f26f30a check SQLite database integrity 2021-02-11 15:24:24 -08:00
Scott Lamb cdd878f452 compare schema version on "moonfire-nvr check" 2021-02-11 15:21:05 -08:00
Scott Lamb 51f43e9124 suppress some "moonfire-nvr check" false positives
In particular, if there are recordings in progress when the process
dies, they may still be around when check runs. They are easily
identifiable by having an id > cum_recordings and get automatically
deleted on startup, so there's no reason to complain about them.
2021-02-11 15:06:04 -08:00
Scott Lamb 9a5957d5ef overhaul error messages
Inspired by the poor error message here:
https://github.com/scottlamb/moonfire-nvr/issues/107#issuecomment-777587727

*   print the friendlier Display version of the error rather than Debug.
    Eg, "EROFS: Read-only filesystem" rather than "Sys(EROFS)". Do this
    everywhere: on command exit, on syncer retries, and on stream
    retries.
*   print the most immediate problem and additional lines for each
    cause.
*   print the backtrace or an advertisement for RUST_BACKTRACE=1 if it's
    unavailable.
*   also mention RUST_BACKTRACE=1 in the troubleshooting guide.
*   add context in various places, including pathnames. There are surely
    many places more it'd be helpful, but this is a start.
*   allow subcommands to return failure without an Error.
    In particular, "moonfire-nvr check" does its own error printing
    because it wants to print all the errors it finds. Printing "see
    earlier errors" with a meaningless stack trace seems like it'd just
    confuse. But I also want to get rid of the misleading "Success" at
    the end and 0 return to the OS.
2021-02-11 10:57:09 -08:00
Scott Lamb dd66c7b0dd restructure into "server" and "ui" subdirs
Besides being more clear about what belongs to which, this helps with
docker caching. The server and ui parts are only rebuilt when their
respective subdirectories change.

Extend this a bit further by making the webpack build not depend on
the target architecture. And adding cache dirs so parts of the server
and ui build process can be reused when layer-wide caching fails.
2021-01-22 22:01:17 -08:00