kube/camtiler/README.md

88 lines
2.8 KiB
Markdown
Raw Normal View History

2024-07-30 03:13:16 +00:00
# Cameras
Camtiler is the umbrella name for our homegrown camera surveilance system.
2022-08-16 09:40:54 +00:00
2024-07-30 03:13:16 +00:00
Everything besides [Camera](#camera)s is deployed with Kubernetes.
## Components
2024-08-03 02:02:29 +00:00
![cameras.graphviz.svg](cameras.graphviz.svg)
2024-07-30 03:13:16 +00:00
<!-- Manually rendered with https://dreampuf.github.io/GraphvizOnline
digraph G {
"camera-operator" -> "camera-motion-detect" [label="deploys"]
"camera-tiler" -> "cam.k-space.ee/tiled"
camera -> "camera-tiler"
camera -> "camera-motion-detect" -> mongo
"camera-motion-detect" -> "Minio S3"
"cam.k-space.ee" -> mongo [label="queries events", decorate=true]
mongo -> "camtiler-event-broker" [label="transforms object to add (signed) URL to S3", ]
"camtiler-event-broker" -> "cam.k-space.ee"
"Minio S3" -> "cam.k-space.ee" [label="using signed URL from camtiler-event-broker", decorate=true]
camera [label="📸 camera"]
}
-->
### 📸 Camera
Cameras are listed in [application.yml](application.yml) as `kind: Camera`.
Two types of camera hosts:
- GL-AR150 with [openwrt-camera-images](https://git.k-space.ee/k-space/openwrt-camera-image).
- [Doors](https://wiki.k-space.ee/e/en/hosting/doors) (Raspberry Pi) with mjpg-streamer.
### camera-tiler (cam.k-space.ee/tiled)
Out-of-bound, connects to cameras and streams to web browser.
One instance per every camera
#### camera-operator
Functionally the same as a kubernetes deployment for camera-tiler.
Operator/deployer for camera-tiler.
### camera-motion-detect
Connects to cameras, on motion writes events to Mongo and frames to S3.
### cam.k-space.ee (logmower)
Fetches motion-detect events from mongo. Fetches referenced images from S3 (minio).
#### camtiler-event-broker
MitM between motion-detect -> mongo. Appends S3 URLs to the response.
## Kubernetes commands
Apply changes:
2022-08-16 09:40:54 +00:00
```
2022-12-18 14:28:45 +00:00
kubectl apply -n camtiler \
-f application.yml \
2023-05-18 19:55:40 +00:00
-f minio.yml \
2022-12-18 14:28:45 +00:00
-f mongoexpress.yml \
-f mongodb-support.yml \
-f camera-tiler.yml \
-f logmower.yml \
-f ingress.yml \
-f network-policies.yml \
-f networkpolicy-base.yml
2022-08-16 09:40:54 +00:00
```
2024-07-30 03:13:16 +00:00
Deploy changes:
2022-08-16 09:40:54 +00:00
```
kubectl -n camtiler rollout restart deployment.apps/camtiler
```
2024-07-30 03:13:16 +00:00
Initialize secrets:
2022-08-16 09:40:54 +00:00
```
kubectl create secret generic -n camtiler mongodb-application-readwrite-password --from-literal="password=$(cat /dev/urandom | base64 | head -c 30)"
kubectl create secret generic -n camtiler mongodb-application-readonly-password --from-literal="password=$(cat /dev/urandom | base64 | head -c 30)"
2022-12-12 18:37:03 +00:00
kubectl create secret generic -n camtiler minio-secrets \
2022-08-16 09:40:54 +00:00
--from-literal="MINIO_ROOT_USER=root" \
2022-12-12 18:37:03 +00:00
--from-literal="MINIO_ROOT_PASSWORD=$(cat /dev/urandom | base64 | head -c 30)"
2022-08-16 09:40:54 +00:00
kubectl -n camtiler create secret generic camera-secrets \
--from-literal=username=... \
--from-literal=password=...
```
2022-12-18 14:28:45 +00:00
2024-07-30 03:13:16 +00:00
Restart all deployments:
2022-12-18 14:28:45 +00:00
```
for j in $(kubectl get deployments -n camtiler -o name); do kubectl rollout restart -n camtiler $j; done
```