Commit Graph

531 Commits

Author SHA1 Message Date
Scott Lamb
e66a88a591 fix invariant violation on pts jump (#112)
Looks like a refactoring in 9d7cdc09 introduced the possibility this
could fail (where before it might produce a silly i32 pts) and forgot
to restore the invariant.
2021-03-10 12:45:32 -08:00
Scott Lamb
458bda3fbb Add a bug template
Link to newly extended guide on log files (#112)
2021-03-10 11:04:55 -08:00
Scott Lamb
9099d07dfa improve panic messages and docs (#112) 2021-03-10 08:12:49 -08:00
Scott Lamb
a845ba9769 send ffmpeg's logs through log crate (#112) 2021-03-09 22:09:30 -08:00
Scott Lamb
ea8bdef7d9 support color coding logs (#112)
ffmpeg was already doing this; now do it for native logs.
2021-03-09 22:09:30 -08:00
Scott Lamb
242368aa47 more help reading logs 2021-03-09 13:15:25 -08:00
Scott Lamb
2808d5e139 help folks read logs (#112)
*   add more description to the troubleshooting guide
*   adjust the log format to match more recent glog
*   include a config for the lnav tool, which will help colorize,
    browse, and search the logs.

Next up: install an ffmpeg log callback for consistency.
2021-03-09 00:10:32 -08:00
Scott Lamb
2d45799b7d better error handling for authentication 2021-03-06 05:49:49 -08: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
9aa72fe670 small but important fix to instructions
Without quotes around the here-document word, the expansion happens
as the command is run, which isn't what I had in mind.
2021-02-28 22:13:38 -08:00
Scott Lamb
d7eea63829 minor api fixes
*   videoSampleEntryId should be a number, not a string
*   fix some markdown formatting
*   fix missing description of sampleFileBytes
2021-02-22 13:46:51 -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
64f8d38e01 0.6.1 2021-02-16 12:01:51 -08:00
Scott Lamb
44039889c5 switch from yarn to npm
This eases build setup. Where Yarn requires a separate package
repository, npm is available in the standard one.

yarn's package repository signature was recently expired, and apparently
will expire again in a year. Avoid dealing with that.

Fixes #110.
2021-02-16 12:01:51 -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
5acca1a253 tips on hardware failures and fs corruption 2021-02-11 16:04:40 -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
8bfd96f9a3 fix missing newline in error msg 2021-02-11 11:07:16 -08:00
Scott Lamb
fb5b414297 fix missing newline in error msg 2021-02-11 11:06:13 -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
ff1615a0b4 address database upgrade slowness (#107)
* give a rule of thumb for update time in the documentation
* log the SQLite3 version, which can affect performance
* do the vacuum in non-WAL mode, to correctly set the page size and to
  avoid very slow behavior on older SQLite3 versions. Larger page sizes
  are generally faster (including subsequent vacuum operations).
  This won't help much for the first vacuum after this change, but it
  will help afterward.
* likewise, set the page size properly on "moonfire-nvr init".
2021-02-10 22:28:40 -08:00
Scott Lamb
4e67af9909 upgrade some other deps 2021-01-27 12:42:29 -08:00
Scott Lamb
b114493729 upgrade tokio, bytes, hyper, reqwest, http-serve
This was mostly straightforward. The most confusing part waas the Sync
bound change on body streams. I copied what hyper did and it seemed to
work. /shruggie
2021-01-27 11:47:52 -08:00
Scott Lamb
4c5444740b
Merge pull request #103 from scottlamb/dependabot/npm_and_yarn/ui/bl-4.0.3
Bump bl from 4.0.2 to 4.0.3 in /ui
2021-01-25 16:45:56 -08:00
Scott Lamb
14d674bc67
Merge pull request #101 from scottlamb/dependabot/npm_and_yarn/ui/http-proxy-1.18.1
Bump http-proxy from 1.18.0 to 1.18.1 in /ui
2021-01-25 16:45:45 -08:00
Scott Lamb
a74824854f
Merge pull request #100 from scottlamb/dependabot/npm_and_yarn/ui/ini-1.3.8
Bump ini from 1.3.5 to 1.3.8 in /ui
2021-01-25 16:45:34 -08:00
Scott Lamb
23a54ff8d5
Merge pull request #104 from scottlamb/dependabot/npm_and_yarn/ui/elliptic-6.5.3
Bump elliptic from 6.5.2 to 6.5.3 in /ui
2021-01-25 16:45:14 -08:00
Scott Lamb
163dc4cb1d
Merge pull request #102 from scottlamb/dependabot/npm_and_yarn/ui/lodash-4.17.20
Bump lodash from 4.17.15 to 4.17.20 in /ui
2021-01-25 16:44:57 -08:00
dependabot[bot]
11c3fa7062
Bump bl from 4.0.2 to 4.0.3 in /ui
Bumps [bl](https://github.com/rvagg/bl) from 4.0.2 to 4.0.3.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](https://github.com/rvagg/bl/compare/v4.0.2...v4.0.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 22:09:15 +00:00
dependabot[bot]
876becccbb
Bump lodash from 4.17.15 to 4.17.20 in /ui
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.20.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.20)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 22:08:50 +00:00
dependabot[bot]
b90495fb6f
Bump ini from 1.3.5 to 1.3.8 in /ui
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-25 22:08:49 +00:00
Scott Lamb
b7095e9b07 upgrade favicons-webpack-plugin
Fixes #105

I still don't know why it wasn't working properly, but I'm happy that
a simple upgrade fixed it.
2021-01-25 14:06:54 -08:00
dependabot[bot]
1cb0ce6f00
Bump elliptic from 6.5.2 to 6.5.3 in /ui
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-23 06:02:56 +00:00
dependabot[bot]
9a641e7468
Bump http-proxy from 1.18.0 to 1.18.1 in /ui
Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.18.0 to 1.18.1.
- [Release notes](https://github.com/http-party/node-http-proxy/releases)
- [Changelog](https://github.com/http-party/node-http-proxy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/http-party/node-http-proxy/compare/1.18.0...1.18.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-23 06:02:53 +00: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
Scott Lamb
adcfc5e5f0 don't flatten UI directory
my previous COPY was doing this accidentally, breaking the favicons.
2021-01-22 12:49:42 -08:00
Scott Lamb
c77acf3c47 fix incorrect ui path in docker deploy target 2021-01-22 12:00:13 -08:00
Scott Lamb
02a4f1f74e fix date picker error east of UTC (#93) 2021-01-22 10:46:36 -08:00
Scott Lamb
c140296da2 fix dependencies in CI
Running "apt-get install" without a preceding "apt-get update" has
started failing on GitHub Actions, eg:

https://github.com/scottlamb/moonfire-nvr/runs/1750609817

I believe the problem is that older packages have been removed from
the mirror, and the update will fix this, as described here:

https://github.com/actions/virtual-environments/issues/675#issuecomment-671057659

Also, I was using ncurses version 5 packages, when I should be using the
unversioned default. Same in the build guide.
2021-01-22 10:39:09 -08:00
Scott Lamb
a21e606121 fix confusing typo 2021-01-21 21:59:09 -08:00
Scott Lamb
7eac83fc51
Update install.md
fix timezone setting
2021-01-21 16:57:07 -08:00
Scott Lamb
436217f4d5 small updates to the top-level README 2021-01-21 16:30:46 -08:00
Scott Lamb
31801e20c3 update docs to recommend new Docker setup
and remove the old scripts, to reduce the supported ways of doing
things.
2021-01-21 16:00:38 -08:00
Scott Lamb
9349a2a164 new docker-based build
This replaces the previous Dockerfile, which was a single stage for
building and deployment.

The new one is a multi-stage build. Its "dev" target has the full
development environment; its "deploy" target is more slim. It supports
cross-compiled builds via BuildKit, eg to prepare a build suitable for
a Raspberry Pi:

docker buildx build --load --platform=linux/arm64/v8 --tag=moonfire-nvr --progress=plain --target=deploy -f docker/Dockerfile .

Coming next: updating the installation docs.
2021-01-15 09:54:10 -08:00
Scott Lamb
b2bf7bdfa4 refresh some editor configs and such 2020-12-22 23:44:45 -08:00