Skip to content

Commit

Permalink
make go2rtc always rebuild config at startup (blakeblackshear#8664)
Browse files Browse the repository at this point in the history
* make go2rtc always rebuild config at startup

/dev/shm can be left mounted (in fact im pretty sure it's always left mounted) on the docker host after shutting down the frigate container.
If we only check that the file doesn't exist, stale data gets re-read every startup 
This will make troubleshooting a nightmare for the average user.

I had given up troubleshooting go2rtc several times because of this.

* generate config after supervisor data is loaded

* Fix fi

* fix fi

---------

Co-authored-by: Nicolas Mowen <[email protected]>
  • Loading branch information
trademark789 and NickM-27 committed Nov 19, 2023
1 parent fc186e4 commit 934b167
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,21 @@ function get_ip_and_port_from_supervisor() {

export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+')

if [[ -f "/dev/shm/go2rtc.yaml" ]]; then
echo "[INFO] Removing stale config from last run..."
rm /dev/shm/go2rtc.yaml

if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
echo "[INFO] Preparing go2rtc config..."
echo "[INFO] Preparing new go2rtc config..."

if [[ -n "${SUPERVISOR_TOKEN:-}" ]]; then
# Running as a Home Assistant add-on, infer the IP address and port
get_ip_and_port_from_supervisor
fi

python3 /usr/local/go2rtc/create_config.py
else
echo "[WARNING] Unable to remove existing go2rtc config. Changes made to your frigate config file may not be recognized. Please remove the /dev/shm/go2rtc.yaml from your docker host manually."
fi

readonly config_path="/config"
Expand Down

0 comments on commit 934b167

Please sign in to comment.