mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-31 16:12:19 +03:00
Run frigate & nginx inside of container as user 'frigate' and allow a way to set the uid and gid of this user to better facilitate network storage mounts.
This commit is contained in:
committed by
Ilya Rakhlin
parent
1f1a708388
commit
6b462e482c
@@ -0,0 +1,16 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [[ "$(ls /var/run/s6/container_environment/ | xargs)" == *"FILE__"* ]]; then
|
||||
for FILENAME in /var/run/s6/container_environment/*; do
|
||||
if [[ "${FILENAME##*/}" == "FILE__"* ]]; then
|
||||
SECRETFILE=$(cat ${FILENAME})
|
||||
if [[ -f ${SECRETFILE} ]]; then
|
||||
FILESTRIP=${FILENAME//FILE__/}
|
||||
cat ${SECRETFILE} > ${FILESTRIP}
|
||||
echo "[env-init] ${FILESTRIP##*/} set from ${FILENAME##*/}"
|
||||
else
|
||||
echo "[env-init] cannot find secret in ${FILENAME##*/}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
PUID=${PUID:-1000}
|
||||
PGID=${PGID:-1000}
|
||||
|
||||
groupmod -o -g "$PGID" frigate
|
||||
usermod -o -u "$PUID" frigate
|
||||
|
||||
chown -R frigate:frigate /opt/frigate/frigate
|
||||
chown -R frigate:frigate /opt/frigate/migrations
|
||||
chown -R frigate:frigate /opt/frigate/web
|
||||
chown -R frigate:frigate /usr/local/nginx
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#! /bin/bash
|
||||
if [[ -f /var/run/s6/container_environment/UMASK ]] && [[ "$(pwdx $$)" =~ "/run/s6/services/" ]]; then
|
||||
umask $(cat /var/run/s6/container_environment/UMASK)
|
||||
exec /usr/bin/with-contenvb "$@"
|
||||
else
|
||||
exec /usr/bin/with-contenvb "$@"
|
||||
fi
|
||||
@@ -1,8 +1,8 @@
|
||||
daemon off;
|
||||
worker_processes 1;
|
||||
|
||||
user frigate;
|
||||
error_log /usr/local/nginx/logs/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
pid /usr/local/nginx/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
@@ -71,9 +71,6 @@ http {
|
||||
location /vod/ {
|
||||
vod hls;
|
||||
|
||||
secure_token $args;
|
||||
secure_token_types application/vnd.apple.mpegurl;
|
||||
|
||||
add_header Access-Control-Allow-Headers '*';
|
||||
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
|
||||
@@ -125,11 +122,6 @@ http {
|
||||
root /media/frigate;
|
||||
}
|
||||
|
||||
location /cache/ {
|
||||
internal; # This tells nginx it's not accessible from the outside
|
||||
alias /tmp/cache/;
|
||||
}
|
||||
|
||||
location /recordings/ {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
|
||||
Reference in New Issue
Block a user