Skip to content

Commit

Permalink
WIP: use jiff crate
Browse files Browse the repository at this point in the history
TODO:
* use a released Retina
* look over `base/time.rs` changes
  • Loading branch information
scottlamb committed Aug 24, 2024
1 parent f9e3fb5 commit bee5b38
Show file tree
Hide file tree
Showing 22 changed files with 416 additions and 466 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ even on minor releases, e.g. `v0.7.5` -> `v0.7.6`.
recording ended.
* fix [#121](https://github.com/scottlamb/moonfire-nvr/issues/121):
iPhone live view.
* use `jiff` for time manipulations.

## v0.7.16 (2024-05-30)

Expand Down
5 changes: 2 additions & 3 deletions guide/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ services:
# - seccomp:unconfined

environment:
# Edit zone below to taste. The `:` is functional.
TZ: ":America/Los_Angeles"
# Edit zone below to taste.
TZ: "America/Los_Angeles"
RUST_BACKTRACE: 1

# docker's default log driver won't rotate logs properly, and will throw
Expand Down Expand Up @@ -323,7 +323,6 @@ After=network-online.target

[Service]
ExecStart=/usr/local/bin/moonfire-nvr run
Environment=TZ=:/etc/localtime
Environment=MOONFIRE_FORMAT=systemd
Environment=MOONFIRE_LOG=info
Environment=RUST_BACKTRACE=1
Expand Down
13 changes: 10 additions & 3 deletions guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ need more help.
* [Docker setup](#docker-setup)
* [`"/etc/moonfire-nvr.toml" is a directory`](#etcmoonfire-nvrtoml-is-a-directory)
* [`Error response from daemon: unable to find user UID: no matching entries in passwd file`](#error-response-from-daemon-unable-to-find-user-uid-no-matching-entries-in-passwd-file)
* [`clock_gettime failed: EPERM: Operation not permitted`](#clock_gettime-failed-eperm-operation-not-permitted)
* [`clock_gettime(CLOCK_MONOTONIC) failed: EPERM: Operation not permitted`](#clock_gettimeclock_monotonic-failed-eperm-operation-not-permitted)
* [`VFS is unable to determine a suitable directory for temporary files`](#vfs-is-unable-to-determine-a-suitable-directory-for-temporary-files)
* [Server errors](#server-errors)
* [`unable to get IANA time zone name; check your $TZ and /etc/localtime`](#unable-to-get-iana-time-zone-name-check-your-tz-and-etclocaltime)
* [`Error: pts not monotonically increasing; got 26615520 then 26539470`](#error-pts-not-monotonically-increasing-got-26615520-then-26539470)
* [Out of disk space](#out-of-disk-space)
* [Database or filesystem corruption errors](#database-or-filesystem-corruption-errors)
Expand Down Expand Up @@ -217,7 +218,7 @@ If Docker produces this error, look at this section of the docker compose setup:
user: UID:GID
```

#### `clock_gettime failed: EPERM: Operation not permitted`
#### `clock_gettime(CLOCK_MONOTONIC) failed: EPERM: Operation not permitted`

If commands fail with an error like the following, you're likely running
Docker with an overly restrictive `seccomp` setup. [This stackoverflow
Expand All @@ -227,7 +228,7 @@ the `- seccomp: unconfined` line in your Docker compose file.

```console
$ sudo docker compose run --rm moonfire-nvr --version
clock_gettime failed: EPERM: Operation not permitted
clock_gettime(CLOCK_MONOTONIC) failed: EPERM: Operation not permitted

This indicates a broken environment. See the troubleshooting guide.
```
Expand All @@ -250,6 +251,12 @@ container in your Docker compose file.

### Server errors

#### `unable to get IANA time zone name; check your $TZ and /etc/localtime`

Moonfire NVR loads the system time zone via the logic described at
[`jiff::tz::TimeZone::system`](https://docs.rs/jiff/0.1.8/jiff/tz/struct.TimeZone.html#method.system)
and expects to be able to get the IANA zone name.

#### `Error: pts not monotonically increasing; got 26615520 then 26539470`

If your streams cut out and you see error messages like this one in Moonfire
Expand Down
121 changes: 33 additions & 88 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ members = ["base", "db"]
base64 = "0.21.0"
h264-reader = "0.7.0"
itertools = "0.12.0"
jiff = "0.1.8"
nix = "0.27.0"
pretty-hex = "0.4.0"
ring = "0.17.0"
Expand All @@ -51,6 +52,7 @@ http = "0.2.3"
http-serve = { version = "0.3.1", features = ["dir"] }
hyper = { version = "0.14.2", features = ["http1", "server", "stream", "tcp"] }
itertools = { workspace = true }
jiff = { workspace = true, features = ["tz-system"] }
libc = "0.2"
log = { version = "0.4" }
memchr = "2.0.2"
Expand All @@ -60,14 +62,14 @@ password-hash = "0.5.0"
pretty-hex = { workspace = true }
protobuf = "3.0"
reffers = "0.7.0"
retina = "0.4.9"
#retina = "0.4.9"
retina = { git = "https://github.com/scottlamb/retina.git", rev = "6d5ccd156a503b7f83427e4871f1ada887e485f1" }
ring = { workspace = true }
rusqlite = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
smallvec = { version = "1.7", features = ["union"] }
sync_wrapper = "0.1.0"
time = "0.1"
tokio = { version = "1.24", features = ["macros", "rt-multi-thread", "signal", "sync", "time"] }
tokio-tungstenite = "0.20.0"
toml = "0.8"
Expand Down Expand Up @@ -122,4 +124,4 @@ debug = 1
tracing = { git = "https://github.com/scottlamb/tracing", rev = "861b443d7b2da400ca7b09111957f33c80135908" }
tracing-core = { git = "https://github.com/scottlamb/tracing", rev = "861b443d7b2da400ca7b09111957f33c80135908" }
tracing-log = { git = "https://github.com/scottlamb/tracing", rev = "861b443d7b2da400ca7b09111957f33c80135908" }
tracing-subscriber = { git = "https://github.com/scottlamb/tracing", rev = "861b443d7b2da400ca7b09111957f33c80135908" }
tracing-subscriber = { git = "https://github.com/scottlamb/tracing", rev = "861b443d7b2da400ca7b09111957f33c80135908" }
5 changes: 2 additions & 3 deletions server/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ path = "lib.rs"

[dependencies]
ahash = "0.8"
chrono = "0.4.23"
coded = { git = "https://github.com/scottlamb/coded", rev = "2c97994974a73243d5dd12134831814f42cdb0e8"}
futures = "0.3"
jiff = { workspace = true }
libc = "0.2"
nix = { workspace = true }
nix = { workspace = true, features = ["time"] }
nom = "7.0.0"
rusqlite = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
slab = "0.4"
time = "0.1"
tracing = { workspace = true }
tracing-core = { workspace = true }
tracing-log = { workspace = true }
Expand Down
Loading

0 comments on commit bee5b38

Please sign in to comment.