diff --git a/ansible/doors.yml b/ansible/doors.yml index d089ca8..8dae5b9 100644 --- a/ansible/doors.yml +++ b/ansible/doors.yml @@ -1,5 +1,7 @@ # ansible doors -m shell -a "ctr image pull harbor.k-space.ee/k-space/mjpg-streamer:latest" # journalctl -u mjpg_streamer@video0.service -f + +# Referenced and documented by https://wiki.k-space.ee/en/hosting/doors - name: Setup doors hosts: doors tasks: @@ -8,7 +10,7 @@ name: containerd state: present - - name: Copy systemd service for Doorboy controller + - name: Copy systemd service for Doorboy controller # https://git.k-space.ee/k-space/godoor copy: dest: /etc/systemd/system/godoor.service content: | @@ -34,7 +36,7 @@ daemon_reload: yes name: godoor.service - - name: Copy systemd service for mjpg-streamer + - name: Copy systemd service for mjpg-streamer # https://git.k-space.ee/k-space/mjpg-steramer copy: dest: /etc/systemd/system/mjpg_streamer@.service content: | diff --git a/camtiler/README.md b/camtiler/README.md index ef18c22..0a58b22 100644 --- a/camtiler/README.md +++ b/camtiler/README.md @@ -1,5 +1,56 @@ -To apply changes: +# Cameras +Camtiler is the umbrella name for our homegrown camera surveilance system. +Everything besides [Camera](#camera)s is deployed with Kubernetes. + +## Components +![cams.graphviz.svg](cams.graphviz.svg) + + +### 📸 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: ``` kubectl apply -n camtiler \ -f application.yml \ @@ -13,14 +64,12 @@ kubectl apply -n camtiler \ -f networkpolicy-base.yml ``` -To deploy changes: - +Deploy changes: ``` kubectl -n camtiler rollout restart deployment.apps/camtiler ``` -To initialize secrets: - +Initialize secrets: ``` 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)" @@ -32,8 +81,7 @@ kubectl -n camtiler create secret generic camera-secrets \ --from-literal=password=... ``` -To restart all deployments: - +Restart all deployments: ``` for j in $(kubectl get deployments -n camtiler -o name); do kubectl rollout restart -n camtiler $j; done ``` diff --git a/camtiler/application.yml b/camtiler/application.yml index af3171d..d6edd49 100644 --- a/camtiler/application.yml +++ b/camtiler/application.yml @@ -268,6 +268,7 @@ spec: annotations: summary: CPU limits are bottleneck --- +# Referenced by README.md apiVersion: k-space.ee/v1alpha1 kind: Camera metadata: diff --git a/camtiler/cams.graphviz.svg b/camtiler/cams.graphviz.svg new file mode 100644 index 0000000..ce939e2 --- /dev/null +++ b/camtiler/cams.graphviz.svg @@ -0,0 +1,131 @@ + + + + + + +G + + + +camera-operator + +camera-operator + + + +camera-motion-detect + +camera-motion-detect + + + +camera-operator->camera-motion-detect + + +deploys + + + +mongo + +mongo + + + +camera-motion-detect->mongo + + + + + +Minio S3 + +Minio S3 + + + +camera-motion-detect->Minio S3 + + + + + +camera-tiler + +camera-tiler + + + +cam.k-space.ee/tiled + +cam.k-space.ee/tiled + + + +camera-tiler->cam.k-space.ee/tiled + + + + + +camera + +📸 camera + + + +camera->camera-motion-detect + + + + + +camera->camera-tiler + + + + + +camtiler-event-broker + +camtiler-event-broker + + + +mongo->camtiler-event-broker + + +transforms object to add (signed) URL to S3 + + + +cam.k-space.ee + +cam.k-space.ee + + + +Minio S3->cam.k-space.ee + + +using signed URL from camtiler-event-broker + + + + +cam.k-space.ee->mongo + + +queries events + + + + +camtiler-event-broker->cam.k-space.ee + + + + + \ No newline at end of file diff --git a/member-site/doorboy.yml b/member-site/doorboy.yml index a3a9e16..6e4163d 100644 --- a/member-site/doorboy.yml +++ b/member-site/doorboy.yml @@ -1,3 +1,4 @@ +# Referenced and documented by https://wiki.k-space.ee/en/hosting/doors --- apiVersion: apps/v1 kind: Deployment