mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 17:55:21 +03:00
Log all services to RAM
This commit is contained in:
parent
007fa75294
commit
55294b9605
15
Dockerfile
15
Dockerfile
@ -155,7 +155,14 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
|
|||||||
|
|
||||||
ENV PATH="/usr/lib/btbn-ffmpeg/bin:/usr/local/go2rtc/bin:/usr/local/nginx/sbin:${PATH}"
|
ENV PATH="/usr/lib/btbn-ffmpeg/bin:/usr/local/go2rtc/bin:/usr/local/nginx/sbin:${PATH}"
|
||||||
|
|
||||||
# TODO: remove after a new verion of s6-overlay is released. See:
|
# Fails if cont-init.d fails
|
||||||
|
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2
|
||||||
|
# Wait indefinitely for cont-init.d to finish before starting services
|
||||||
|
ENV S6_CMD_WAIT_FOR_SERVICES=1
|
||||||
|
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
||||||
|
# Configure logging to log to stdout and prepend timestamps
|
||||||
|
ENV S6_LOGGING_SCRIPT="T 1 n20 s1000000 T"
|
||||||
|
# TODO: remove after a new version of s6-overlay is released. See:
|
||||||
# https://github.com/just-containers/s6-overlay/issues/460#issuecomment-1327127006
|
# https://github.com/just-containers/s6-overlay/issues/460#issuecomment-1327127006
|
||||||
ENV S6_SERVICES_READYTIME=50
|
ENV S6_SERVICES_READYTIME=50
|
||||||
|
|
||||||
@ -176,10 +183,14 @@ EXPOSE 8554
|
|||||||
EXPOSE 8555
|
EXPOSE 8555
|
||||||
|
|
||||||
ENTRYPOINT ["/init"]
|
ENTRYPOINT ["/init"]
|
||||||
|
CMD []
|
||||||
|
|
||||||
# Frigate deps with Node.js and NPM for devcontainer
|
# Frigate deps with Node.js and NPM for devcontainer
|
||||||
FROM deps AS devcontainer
|
FROM deps AS devcontainer
|
||||||
|
|
||||||
|
# Do not start frigate on devcontainer
|
||||||
|
RUN rm -rf /etc/services.d/frigate
|
||||||
|
|
||||||
# Install Node 16
|
# Install Node 16
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install wget -y \
|
&& apt-get install wget -y \
|
||||||
@ -224,5 +235,3 @@ FROM deps
|
|||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
COPY --from=rootfs / /
|
COPY --from=rootfs / /
|
||||||
|
|
||||||
CMD ["with-contenv", "python3", "-u", "-m", "frigate"]
|
|
||||||
|
|||||||
3
Makefile
3
Makefile
@ -30,6 +30,9 @@ build: version amd64 arm64 armv7
|
|||||||
push: build
|
push: build
|
||||||
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) .
|
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) .
|
||||||
|
|
||||||
|
run: local
|
||||||
|
docker run --rm --volume=${PWD}/config/config.yml:/config/config.yml frigate:latest
|
||||||
|
|
||||||
run_tests: local
|
run_tests: local
|
||||||
docker run --rm --entrypoint=python3 frigate:latest -u -m unittest
|
docker run --rm --entrypoint=python3 frigate:latest -u -m unittest
|
||||||
docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate
|
docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate
|
||||||
|
|||||||
8
docker/rootfs/etc/cont-init.d/prepare-logs.sh
Executable file
8
docker/rootfs/etc/cont-init.d/prepare-logs.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
mkdir -p /dev/shm/logs
|
||||||
|
chown nobody:nogroup /dev/shm/logs
|
||||||
|
chmod 02755 /dev/shm/logs
|
||||||
7
docker/rootfs/etc/services.d/frigate/finish
Executable file
7
docker/rootfs/etc/services.d/frigate/finish
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# Take down the S6 supervision tree when the process fails
|
||||||
|
|
||||||
|
if [[ "${1}" -ne 0 && "${1}" -ne 256 ]]; then
|
||||||
|
exec /run/s6/basedir/bin/halt
|
||||||
|
fi
|
||||||
4
docker/rootfs/etc/services.d/frigate/log/run
Executable file
4
docker/rootfs/etc/services.d/frigate/log/run
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
exec logutil-service /dev/shm/logs/frigate
|
||||||
9
docker/rootfs/etc/services.d/frigate/run
Executable file
9
docker/rootfs/etc/services.d/frigate/run
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd /opt/frigate
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
|
exec python3 -u -m frigate
|
||||||
4
docker/rootfs/etc/services.d/go2rtc/log/run
Executable file
4
docker/rootfs/etc/services.d/go2rtc/log/run
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
exec logutil-service /dev/shm/logs/go2rtc
|
||||||
@ -10,4 +10,5 @@ else
|
|||||||
config_path="/usr/local/go2rtc/go2rtc.yaml"
|
config_path="/usr/local/go2rtc/go2rtc.yaml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
exec go2rtc -config="${config_path}"
|
exec go2rtc -config="${config_path}"
|
||||||
|
|||||||
4
docker/rootfs/etc/services.d/nginx/log/run
Executable file
4
docker/rootfs/etc/services.d/nginx/log/run
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
exec logutil-service /dev/shm/logs/nginx
|
||||||
@ -1,4 +1,5 @@
|
|||||||
#!/command/with-contenv bash
|
#!/command/with-contenv bash
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
exec nginx
|
exec nginx
|
||||||
|
|||||||
5
docker/rootfs/usr/local/bin/frigate
Normal file
5
docker/rootfs/usr/local/bin/frigate
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
|
exec python3 -u -m frigate "${@}"
|
||||||
@ -2,7 +2,7 @@ daemon off;
|
|||||||
user root;
|
user root;
|
||||||
worker_processes 1;
|
worker_processes 1;
|
||||||
|
|
||||||
error_log /usr/local/nginx/logs/error.log warn;
|
error_log /dev/stdout warn;
|
||||||
pid /var/run/nginx.pid;
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
events {
|
events {
|
||||||
@ -17,7 +17,7 @@ http {
|
|||||||
'$status $body_bytes_sent "$http_referer" '
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
access_log /usr/local/nginx/logs/access.log main;
|
access_log /dev/stdout main;
|
||||||
|
|
||||||
sendfile on;
|
sendfile on;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user