mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-19 19:06:16 +01:00
add nginx and change default file locations
This commit is contained in:
parent
eced06eea8
commit
b7c09a9b38
@ -179,10 +179,10 @@ save_clips:
|
||||
# will begin to expire and the resulting clip will be the last x seconds of the event.
|
||||
max_seconds: 300
|
||||
# Optional: Location to save event clips. (default: shown below)
|
||||
clips_dir: /clips
|
||||
clips_dir: /media/frigate/clips
|
||||
# Optional: Location to save cache files for creating clips. (default: shown below)
|
||||
# NOTE: To reduce wear on SSDs and SD cards, use a tmpfs volume.
|
||||
cache_dir: /cache
|
||||
cache_dir: /tmp/cache
|
||||
|
||||
# Optional: Global ffmpeg args
|
||||
# "ffmpeg" + global_args + input_args + "-i" + input + output_args
|
||||
|
@ -15,7 +15,7 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get -qq update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get -qq install --no-install-recommends -y \
|
||||
gnupg wget unzip tzdata \
|
||||
gnupg wget unzip tzdata nginx \
|
||||
&& apt-get -qq install --no-install-recommends -y \
|
||||
python3-pip \
|
||||
&& pip3 install -U /wheels/*.whl \
|
||||
@ -27,6 +27,12 @@ RUN apt-get -qq update \
|
||||
&& rm -rf /var/lib/apt/lists/* /wheels \
|
||||
&& (apt-get autoremove -y; apt-get autoclean -y)
|
||||
|
||||
RUN pip3 install \
|
||||
peewee \
|
||||
voluptuous
|
||||
|
||||
COPY nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# get model and labels
|
||||
ARG MODEL_REFS=7064b94dd5b996189242320359dbab8b52c94a84
|
||||
COPY labelmap.txt /labelmap.txt
|
||||
@ -38,4 +44,7 @@ RUN mkdir /cache /clips
|
||||
WORKDIR /opt/frigate/
|
||||
ADD frigate frigate/
|
||||
|
||||
CMD ["python3", "-u", "-m", "frigate"]
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod +x /run.sh
|
||||
|
||||
CMD ["/run.sh"]
|
||||
|
@ -32,9 +32,7 @@ RUN pip3 wheel --wheel-dir=/wheels \
|
||||
paho-mqtt \
|
||||
PyYAML \
|
||||
matplotlib \
|
||||
click \
|
||||
peewee \
|
||||
voluptuous
|
||||
click
|
||||
|
||||
FROM scratch
|
||||
|
||||
|
@ -42,9 +42,7 @@ RUN pip3 wheel --wheel-dir=/wheels \
|
||||
paho-mqtt \
|
||||
PyYAML \
|
||||
matplotlib \
|
||||
click \
|
||||
peewee \
|
||||
voluptuous
|
||||
click
|
||||
|
||||
FROM scratch
|
||||
|
||||
|
@ -36,7 +36,7 @@ class FrigateApp():
|
||||
raw_config = f.read()
|
||||
|
||||
if config_file.endswith(".yml"):
|
||||
config = yaml.load(raw_config)
|
||||
config = yaml.safe_load(raw_config)
|
||||
elif config_file.endswith(".json"):
|
||||
config = json.loads(raw_config)
|
||||
|
||||
|
@ -30,8 +30,8 @@ MQTT_SCHEMA = vol.Schema(
|
||||
SAVE_CLIPS_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Optional('max_seconds', default=300): int,
|
||||
vol.Optional('clips_dir', default='/clips'): str,
|
||||
vol.Optional('cache_dir', default='/cache'): str
|
||||
vol.Optional('clips_dir', default='/media/frigate/clips'): str,
|
||||
vol.Optional('cache_dir', default='/tmp/cache'): str
|
||||
}
|
||||
)
|
||||
|
||||
|
75
nginx/nginx.conf
Normal file
75
nginx/nginx.conf
Normal file
@ -0,0 +1,75 @@
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
client_max_body_size 50M;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location /stream/ {
|
||||
add_header 'Cache-Control' 'no-cache';
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
|
||||
types {
|
||||
application/dash+xml mpd;
|
||||
application/vnd.apple.mpegurl m3u8;
|
||||
video/mp2t ts;
|
||||
image/jpeg jpg;
|
||||
}
|
||||
|
||||
root /tmp;
|
||||
}
|
||||
|
||||
location /frigate/ {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
|
||||
types {
|
||||
video/mp4 mp4;
|
||||
image/jpeg jpg;
|
||||
}
|
||||
|
||||
autoindex on;
|
||||
root /media;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user