avoid clock problems on some Docker setups

In particular, this was happening out of the box on Raspberry Pi OS Lite
20210304, as reported by ironoxidizer@gmail.com here:
https://groups.google.com/g/moonfire-nvr-users/c/2j9LvfFl2u8/m/tJcNS2WfCQAJ

*   adjust main.rs to make the problem more obvious
*   mention it in the troubleshooting guide
*   sidestep it in the nvr docker wrapper script

also just use --networking=host rather than --publish (avoiding a proxy
process). I'm using Docker to simplify the build and deployment process,
not as a security boundary, so just do the simpler thing.
This commit is contained in:
Scott Lamb
2021-04-08 22:15:31 -07:00
parent 0c34ea8314
commit 7c0a634bed
3 changed files with 34 additions and 17 deletions

View File

@@ -137,6 +137,15 @@ fn panic_hook(p: &std::panic::PanicInfo) {
}
fn main() {
if let Err(e) = nix::time::clock_gettime(nix::time::ClockId::CLOCK_MONOTONIC) {
eprintln!(
"clock_gettime failed: {}\n\n\
This indicates a broken environment. See the troubleshooting guide.",
e
);
std::process::exit(1);
}
let args = Args::from_args();
let mut h = mylog::Builder::new()
.set_format(