adding version endpoint

This commit is contained in:
Blake Blackshear 2020-12-19 06:51:10 -06:00
parent 3bc7cdaab6
commit e8009c2d26
4 changed files with 18 additions and 6 deletions

View File

@ -4,3 +4,4 @@ docs/
debug debug
config/ config/
*.pyc *.pyc
.git

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ config/config.yml
models models
*.mp4 *.mp4
*.db *.db
frigate/version.py

View File

@ -1,12 +1,17 @@
default_target: amd64_frigate default_target: amd64_frigate
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h")
version:
echo "VERSION='0.8.0-$(COMMIT_HASH)'" > frigate/version.py
amd64_wheels: amd64_wheels:
docker build --tag blakeblackshear/frigate-wheels:amd64 --file docker/Dockerfile.wheels . docker build --tag blakeblackshear/frigate-wheels:amd64 --file docker/Dockerfile.wheels .
amd64_ffmpeg: amd64_ffmpeg:
docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64 --file docker/Dockerfile.ffmpeg.amd64 . docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64 --file docker/Dockerfile.ffmpeg.amd64 .
amd64_frigate: amd64_frigate: version
docker build --tag frigate-base --build-arg ARCH=amd64 --file docker/Dockerfile.base . docker build --tag frigate-base --build-arg ARCH=amd64 --file docker/Dockerfile.base .
docker build --tag frigate --file docker/Dockerfile.amd64 . docker build --tag frigate --file docker/Dockerfile.amd64 .
@ -18,7 +23,7 @@ amd64nvidia_wheels:
amd64nvidia_ffmpeg: amd64nvidia_ffmpeg:
docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64nvidia --file docker/Dockerfile.ffmpeg.amd64nvidia . docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64nvidia --file docker/Dockerfile.ffmpeg.amd64nvidia .
amd64nvidia_frigate: amd64nvidia_frigate: version
docker build --tag frigate-base --build-arg ARCH=amd64nvidia --file docker/Dockerfile.base . docker build --tag frigate-base --build-arg ARCH=amd64nvidia --file docker/Dockerfile.base .
docker build --tag frigate --file docker/Dockerfile.amd64nvidia . docker build --tag frigate --file docker/Dockerfile.amd64nvidia .
@ -30,7 +35,7 @@ aarch64_wheels:
aarch64_ffmpeg: aarch64_ffmpeg:
docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-aarch64 --file docker/Dockerfile.ffmpeg.aarch64 . docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-aarch64 --file docker/Dockerfile.ffmpeg.aarch64 .
aarch64_frigate: aarch64_frigate: version
docker build --tag frigate-base --build-arg ARCH=aarch64 --file docker/Dockerfile.base . docker build --tag frigate-base --build-arg ARCH=aarch64 --file docker/Dockerfile.base .
docker build --tag frigate --file docker/Dockerfile.aarch64 . docker build --tag frigate --file docker/Dockerfile.aarch64 .
@ -42,7 +47,7 @@ armv7_wheels:
armv7_ffmpeg: armv7_ffmpeg:
docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-armv7 --file docker/Dockerfile.ffmpeg.armv7 . docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-armv7 --file docker/Dockerfile.ffmpeg.armv7 .
armv7_frigate: armv7_frigate: version
docker build --tag frigate-base --build-arg ARCH=armv7 --file docker/Dockerfile.base . docker build --tag frigate-base --build-arg ARCH=armv7 --file docker/Dockerfile.base .
docker build --tag frigate --file docker/Dockerfile.armv7 . docker build --tag frigate --file docker/Dockerfile.armv7 .

View File

@ -13,6 +13,7 @@ from peewee import SqliteDatabase, operator, fn, DoesNotExist
from playhouse.shortcuts import model_to_dict from playhouse.shortcuts import model_to_dict
from frigate.models import Event from frigate.models import Event
from frigate.version import VERSION
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -144,6 +145,10 @@ def events():
def config(): def config():
return jsonify(current_app.frigate_config.to_dict()) return jsonify(current_app.frigate_config.to_dict())
@bp.route('/version')
def version():
return VERSION
@bp.route('/stats') @bp.route('/stats')
def stats(): def stats():
camera_metrics = current_app.camera_metrics camera_metrics = current_app.camera_metrics