Commit Graph

622 Commits

Author SHA1 Message Date
Scott Lamb c9cb5f2f01 disable hanging test for now 2021-02-18 09:10:43 -08:00
Scott Lamb f281922359 start a new React-based UI (#111)
This doesn't do much yet but should provide a better foundation for
improvement than the jQuery UI, as described in the github issue.
2021-02-17 19:42:32 -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
Scott Lamb aab36bb5b6 replacing travis-ci with github actions 2020-12-22 22:49:43 -08:00
Scott Lamb b34914c73e prepare to merge schema version 6 to master 2020-12-22 19:53:29 -08:00
Scott Lamb 7fbbd82ae7 remove stale warning about time handling 2020-12-22 19:51:50 -08:00
Scott Lamb b078851ad7 remove half-baked object detection schema
I want to release schema version 6 now, with the fully developed pieces.
2020-12-22 19:50:51 -08:00
Scott Lamb 99ef052f80 fix timestamp duration calculation panic
The code was confused about whether this was relative to the start of
the recording or the desired range of the recording. When the two
differ (that is, when the beginning of the segment is skipped), the
duration was incorrect. The thread would panic when skipping beyond
the start of the next second.

Also add some missing info to Segment's Debug impl.
2020-11-27 21:56:15 -08:00
Scott Lamb f08732057e fixes to check subcommand
* fixes for schema version 6
* clearer output when there are no schema diffs
* don't compare sqlite's internal tables (which causes false positives)
2020-11-24 13:42:29 -08:00
Scott Lamb c8c65206d5 always optimize scrypt password hashes 2020-11-24 08:53:54 -08:00
Scott Lamb 877e455686 upgrade some deps including parking_lot
Now there's a single parking_lot version, yay.
2020-11-23 22:46:05 -08:00
Scott Lamb 8812dab639 update libpasta/ring
This uses my (hopefully short-lived) libpasta fork.
2020-11-23 21:47:56 -08:00