mcguirepr89 / BirdNET-Pi

A realtime acoustic bird classification system for the Raspberry Pi 4B, 3B+, and 0W2 built on the TFLite version of BirdNET.
Other
1.31k stars 139 forks source link

Caddy not serving webpage #333

Closed ghost closed 2 years ago

ghost commented 2 years ago

First - this is an amazing creation and I have already enjoyed the fruits of it working! Thanks to everyone contributing.

I had BirdNET-Pi working properly until a recent complete re-install. It is clear that audio is being analyzed and MP3 and PNG files are being created. But nothing is being served up by caddy. I can reach port 80 by telnet and browser on my LAN but nothing is being returned.

Thanks in advance!!! Doug

/etc/caddy/Caddyfile:

http://localhost http://birdnetpi.local {
  root * /home/hambirder/BirdSongs/Extracted
  file_server browse
  handle /By_Date/* {
    file_server browse
  }
  handle /Charts/* {
    file_server browse
  }
  reverse_proxy /stream localhost:8000
  php_fastcgi unix//run/php/php7.4-fpm.sock
  reverse_proxy /log* localhost:8080
  reverse_proxy /stats* localhost:8501
  reverse_proxy /terminal* localhost:8888
}

journalctl --no-hostname --no-pager -n100 -ucaddy:

birdnetpi:~/BirdNET-Pi$ journalctl --no-hostname --no-pager -n100 -ucaddy
-- Journal begins at Mon 2022-04-04 10:41:41 EDT, ends at Sun 2022-05-29 09:08:41 EDT. --
May 28 17:03:54 caddy[6799]: runtime.NumCPU=4
May 28 17:03:54 caddy[6799]: runtime.GOMAXPROCS=4
May 28 17:03:54 caddy[6799]: runtime.Version=go1.18.1
May 28 17:03:54 caddy[6799]: os.Getwd=/
May 28 17:03:54 caddy[6799]: LANG=en_GB.UTF-8
May 28 17:03:54 caddy[6799]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
May 28 17:03:54 caddy[6799]: NOTIFY_SOCKET=/run/systemd/notify
May 28 17:03:54 caddy[6799]: HOME=/var/lib/caddy
May 28 17:03:54 caddy[6799]: LOGNAME=caddy
May 28 17:03:54 caddy[6799]: USER=caddy
May 28 17:03:54 caddy[6799]: INVOCATION_ID=51e7f4ef13da495a8664ce0a6402e751
May 28 17:03:54 caddy[6799]: JOURNAL_STREAM=8:39259
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.0780385,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
May 28 17:03:54 caddy[6799]: {"level":"warn","ts":1653771834.0822742,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.084975,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
May 28 17:03:54 caddy[6799]: {"level":"warn","ts":1653771834.0854454,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.0862844,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x4000311180"}
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.0880654,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.088147,"logger":"tls","msg":"finished cleaning storage units"}
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.0884244,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
May 28 17:03:54 caddy[6799]: {"level":"info","ts":1653771834.0885873,"msg":"serving initial configuration"}
May 28 17:03:54 systemd[1]: Started Caddy.
May 28 17:58:13 caddy[6799]: {"level":"info","ts":1653775093.276996,"msg":"shutting down apps, then terminating","signal":"SIGTERM"}
May 28 17:58:13 caddy[6799]: {"level":"warn","ts":1653775093.277129,"msg":"exiting; byeee!! 👋","signal":"SIGTERM"}
May 28 17:58:13 caddy[6799]: {"level":"info","ts":1653775093.278924,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0x4000311180"}
May 28 17:58:13 caddy[6799]: {"level":"info","ts":1653775093.2814817,"logger":"admin","msg":"stopped previous server","address":"tcp/localhost:2019"}
May 28 17:58:13 caddy[6799]: {"level":"info","ts":1653775093.2815666,"msg":"shutdown complete","signal":"SIGTERM","exit_code":0}
May 28 17:58:13 systemd[1]: Stopping Caddy...
May 28 17:58:13 systemd[1]: caddy.service: Succeeded.
May 28 17:58:13 systemd[1]: Stopped Caddy.
-- Boot 2d5c1eeac61e4e8d9ee38f6c12fc0359 --
May 29 08:56:21 systemd[1]: Starting Caddy...
May 29 08:56:23 caddy[810]: caddy.HomeDir=/var/lib/caddy
May 29 08:56:23 caddy[810]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
May 29 08:56:23 caddy[810]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
May 29 08:56:23 caddy[810]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
May 29 08:56:23 caddy[810]: caddy.Version=v2.5.1 h1:bAWwslD1jNeCzDa+jDCNwb8M3UJ2tPa8UZFFzPVmGKs=
May 29 08:56:23 caddy[810]: runtime.GOOS=linux
May 29 08:56:23 caddy[810]: runtime.GOARCH=arm64
May 29 08:56:23 caddy[810]: runtime.Compiler=gc
May 29 08:56:23 caddy[810]: runtime.NumCPU=4
May 29 08:56:23 caddy[810]: runtime.GOMAXPROCS=4
May 29 08:56:23 caddy[810]: runtime.Version=go1.18.1
May 29 08:56:23 caddy[810]: os.Getwd=/
May 29 08:56:23 caddy[810]: LANG=en_GB.UTF-8
May 29 08:56:23 caddy[810]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
May 29 08:56:23 caddy[810]: NOTIFY_SOCKET=/run/systemd/notify
May 29 08:56:23 caddy[810]: HOME=/var/lib/caddy
May 29 08:56:23 caddy[810]: LOGNAME=caddy
May 29 08:56:23 caddy[810]: USER=caddy
May 29 08:56:23 caddy[810]: INVOCATION_ID=72f62ddc661a42afb027e0d79cdad3d9
May 29 08:56:23 caddy[810]: JOURNAL_STREAM=8:13121
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.7986052,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
May 29 08:56:23 caddy[810]: {"level":"warn","ts":1653828983.803512,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.8558834,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}
May 29 08:56:23 caddy[810]: {"level":"warn","ts":1653828983.8563428,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.8566117,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x40003c6380"}
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.885741,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.8858614,"logger":"tls","msg":"finished cleaning storage units"}
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.9044635,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
May 29 08:56:23 caddy[810]: {"level":"info","ts":1653828983.9046814,"msg":"serving initial configuration"}
May 29 08:56:23 systemd[1]: Started Caddy.
May 29 09:01:27 caddy[810]: {"level":"info","ts":1653829287.7964952,"msg":"shutting down apps, then terminating","signal":"SIGTERM"}
May 29 09:01:27 caddy[810]: {"level":"warn","ts":1653829287.796605,"msg":"exiting; byeee!! 👋","signal":"SIGTERM"}
May 29 09:01:27 caddy[810]: {"level":"info","ts":1653829287.7981486,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0x40003c6380"}
May 29 09:01:27 caddy[810]: {"level":"info","ts":1653829287.799959,"logger":"admin","msg":"stopped previous server","address":"tcp/localhost:2019"}
May 29 09:01:27 caddy[810]: {"level":"info","ts":1653829287.8000429,"msg":"shutdown complete","signal":"SIGTERM","exit_code":0}
May 29 09:01:27 systemd[1]: Stopping Caddy...
May 29 09:01:27 systemd[1]: caddy.service: Succeeded.
May 29 09:01:27 systemd[1]: Stopped Caddy.
-- Boot 0159f318c3654466bcfa6c08708b9032 --
May 29 09:01:44 systemd[1]: Starting Caddy...
May 29 09:02:00 caddy[823]: caddy.HomeDir=/var/lib/caddy
May 29 09:02:00 caddy[823]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
May 29 09:02:00 caddy[823]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
May 29 09:02:00 caddy[823]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
May 29 09:02:00 caddy[823]: caddy.Version=v2.5.1 h1:bAWwslD1jNeCzDa+jDCNwb8M3UJ2tPa8UZFFzPVmGKs=
May 29 09:02:00 caddy[823]: runtime.GOOS=linux
May 29 09:02:00 caddy[823]: runtime.GOARCH=arm64
May 29 09:02:00 caddy[823]: runtime.Compiler=gc
May 29 09:02:00 caddy[823]: runtime.NumCPU=4
May 29 09:02:00 caddy[823]: runtime.GOMAXPROCS=4
May 29 09:02:00 caddy[823]: runtime.Version=go1.18.1
May 29 09:02:00 caddy[823]: os.Getwd=/
May 29 09:02:00 caddy[823]: LANG=en_GB.UTF-8
May 29 09:02:00 caddy[823]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
May 29 09:02:00 caddy[823]: NOTIFY_SOCKET=/run/systemd/notify
May 29 09:02:00 caddy[823]: HOME=/var/lib/caddy
May 29 09:02:00 caddy[823]: LOGNAME=caddy
May 29 09:02:00 caddy[823]: USER=caddy
May 29 09:02:00 caddy[823]: INVOCATION_ID=46ba94cff00a4646b56ae3c6bb59b383
May 29 09:02:00 caddy[823]: JOURNAL_STREAM=8:16483
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.025634,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
May 29 09:02:00 caddy[823]: {"level":"warn","ts":1653829320.036748,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.0597935,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
May 29 09:02:00 caddy[823]: {"level":"warn","ts":1653829320.0618236,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.0732257,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x4000361110"}
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.0898805,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.0901144,"logger":"tls","msg":"finished cleaning storage units"}
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.1048357,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
May 29 09:02:00 systemd[1]: Started Caddy.
May 29 09:02:00 caddy[823]: {"level":"info","ts":1653829320.110563,"msg":"serving initial configuration"}

systemctl status caddy.service:

● caddy.service - Caddy
     Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-05-29 09:02:00 EDT; 8min ago
       Docs: https://caddyserver.com/docs/
   Main PID: 823 (caddy)
      Tasks: 9 (limit: 4164)
        CPU: 206ms
     CGroup: /system.slice/caddy.service
             └─823 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.025634,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"warn","ts":1653829320.036748,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.0597935,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"warn","ts":1653829320.0618236,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.0732257,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x4000361110"}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.0898805,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.0901144,"logger":"tls","msg":"finished cleaning storage units"}
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.1048357,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
May 29 09:02:00 birdnetpi systemd[1]: Started Caddy.
May 29 09:02:00 birdnetpi caddy[823]: {"level":"info","ts":1653829320.110563,"msg":"serving initial configuration"}

journalctl -xe:

░░ The unit spectrogram_viewer.service has successfully entered the 'dead' state.
May 29 09:11:24 birdnetpi systemd[1]: birdnet_analysis.service: Scheduled restart job, restart counter is at 37.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ Automatic restarting of the unit birdnet_analysis.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
May 29 09:11:24 birdnetpi systemd[1]: Stopped BirdNET Analysis.
░░ Subject: A stop job for unit birdnet_analysis.service has finished
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ A stop job for unit birdnet_analysis.service has finished.
░░ 
░░ The job identifier is 7463 and the job result is done.
May 29 09:11:24 birdnetpi systemd[1]: Started BirdNET Analysis.
░░ Subject: A start job for unit birdnet_analysis.service has finished successfully
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░ 
░░ A start job for unit birdnet_analysis.service has finished successfully.
░░ 
░░ The job identifier is 7463.
May 29 09:11:25 birdnetpi birdnet_analysis.sh[7572]: Files loaded
May 29 09:11:26 birdnetpi birdnet_analysis.sh[7572]: RECORDING_LENGTH set to 15
May 29 09:11:26 birdnetpi env[7619]: Line = 2022-05-29-birdnet-09:11:04.wav.csv
mcguirepr89 commented 2 years ago

Hello, @drdougwelch -- thanks for you kind words about BirdNET-Pi and for the great troubleshooting information you've provided! I'm sorry your new installation is giving you trouble. Here are a few things to try out to get a better idea of what might be going on.

  1. When you do go to http://birdnetpi.local, what do you see? A white page? A message from your web browser? Whatever you see will help me know whether you reached the webserver or not
  2. Is anything served when you go to http://birdnetpi.local/log?
  3. When you ping birdnetpi.local from your host machine (Windows via the Command Prompt, or Linux/macOS from the Terminal), does it return the IP address that you know the installation to be using?

Those things are a good starting point for me to know best where to look next.

My best regards, Patrick

ghost commented 2 years ago

Hi Patrick,

Thanks for your quick reply!

1) Yes - http://birdnetpi.local does return the hoped-for page! (The LAN address used to do this, but does not anymore, despite being the correct interface from ifconfig -a.)

2) Yes - that does provide the expected log output.

3) Yes - ping does produce good turnaround replies and the "from" is from the correct LAN address.

So it looks like my problem was only that I was browsing with the LAN IP address! I'm not sure why that should fail but as long as I know not to do that, I'm good!!!

Best regards, Doug

On 5/29/22 09:35, Patrick McGuire wrote:

Hello, @drdougwelch https://github.com/drdougwelch -- thanks for you kind words about BirdNET-Pi and for the great troubleshooting information you've provided! I'm sorry your new installation is giving you trouble. Here's a few things to try out to get a better idea of what might be going on.

  1. When you do go to http://birdnetpi.local, what do you see? A white page? A message from your web browser? Whatever you see will help me know whether you reached the webserver or not
  2. Is anything served when you go to http://birdnetpi.local/log?
  3. When you |ping| |birdnetpi.local| from your host machine (Windows via the Command Prompt, or Linux/macOS from the Terminal), does it return the IP address that you know the installation to be using?

Those things are a good starting point for me to know best where to look next.

My best regards, Patrick

— Reply to this email directly, view it on GitHub https://github.com/mcguirepr89/BirdNET-Pi/issues/333#issuecomment-1140451065, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIZZ3VGSJTSIIUK3AN44Z3VMNXC7ANCNFSM5XIEY7PQ. You are receiving this because you were mentioned.Message ID: @.***>

mcguirepr89 commented 2 years ago

1) Yes - http://birdnetpi.local/ does return the hoped-for page! (The LAN address used to do this, but does not anymore, despite being the correct interface from ifconfig -a.)

Great, so to confirm, your installation is reachable at http://birdnetpi.local now?

If you'd like to make the installation respond to its IP address, you can go to "Tools" > "Settings" > "Advanced Settings" and input the installation's IP address as the "Custom URL" (along with the http:// protocol) and "Update Settings" to have the installation also be reachable via its LAN IP address. There is an example IP address URL near those settings on the "Advanced Settings" page that you should be able to use as reference.

DougWelch commented 2 years ago

Hi Patrick,

Yes it is reachable now. When I first started working with the package, I thought that you had to put the IP in the birdnet.conf to access the webpage, so that is how I got used to that incorrect assumption, FWIW!!!

So please go ahead and close this issue!

Thanks, Doug

On 5/29/22 09:50, Patrick McGuire wrote:

 1. Yes - http://birdnetpi.local/ does return the hoped-for page!
    (The LAN
    address used to do this, but does not anymore, despite being
    the correct
    interface from ifconfig -a.)

Great, so to confirm, your installation is reachable at http://birdnetpi.local now?

If you'd like to make the installation respond to its IP address, you can go to "Tools" > "Settings" > "Advanced Settings" and input the installation's IP address (along with the http:// protocol) and "Update Settings" to have the installation also be reachable via its LAN IP address. There is an example IP address URL near those settings on the "Advanced Settings" page that you should be able to use as reference.

— Reply to this email directly, view it on GitHub https://github.com/mcguirepr89/BirdNET-Pi/issues/333#issuecomment-1140453876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYGKVUSRFFYSOJRYJNJNKTVMNY33ANCNFSM5XIEY7PQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>