Skip to content

Commit

Permalink
More work on shinobi - copy in their arm32v7 Dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Sep 27, 2022
1 parent 447f261 commit 6041be6
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Here are my notes on different options for DVR/NVR/CCTV solutions that could run
- ZoneMinder (https://zoneminder.com)
- Pi guide: https://wiki.zoneminder.com/Raspberry_Pi_4_-_Raspbian
- Old and trusted... but also harder to configure
- No official Docker images for arm64v8, but [this one](https://registry.hub.docker.com/r/nardo86/zoneminder) seems okay.
- MotionEyeOS (https://github.com/motioneye-project/motioneyeos)
- Latest release from October 2020... which is kinda old. Dev work to get on Python 3...
- Orchid Core from IPConfigure (https://www.ipconfigure.com/download)
Expand Down
109 changes: 109 additions & 0 deletions shinobi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
FROM arm32v7/node:12.18.3-buster-slim

ENV DB_USER=majesticflame \
DB_PASSWORD='' \
DB_HOST='localhost' \
DB_DATABASE=ccio \
DB_PORT=3306 \
SUBSCRIPTION_ID=sub_XXXXXXXXXXXX \
PLUGIN_KEYS='{}' \
SSL_ENABLED='false' \
SSL_COUNTRY='CA' \
SSL_STATE='BC' \
SSL_LOCATION='Vancouver' \
SSL_ORGANIZATION='Shinobi Systems' \
SSL_ORGANIZATION_UNIT='IT Department' \
SSL_COMMON_NAME='nvr.ninja' \
DB_DISABLE_INCLUDED=false
ARG DEBIAN_FRONTEND=noninteractive

RUN mkdir -p /home/Shinobi /config /var/lib/mysql

RUN apt update -y
RUN apt install wget curl net-tools -y

# Install MariaDB server... the debian way
RUN if [ "$DB_DISABLE_INCLUDED" = "false" ] ; then set -ex; \
{ \
echo "mariadb-server" mysql-server/root_password password '${DB_ROOT_PASSWORD}'; \
echo "mariadb-server" mysql-server/root_password_again password '${DB_ROOT_PASSWORD}'; \
} | debconf-set-selections; \
apt-get update; \
apt-get install -y \
"mariadb-server" \
socat \
; \
find /etc/mysql/ -name '*.cnf' -print0 \
| xargs -0 grep -lZE '^(bind-address|log)' \
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; fi

RUN if [ "$DB_DISABLE_INCLUDED" = "false" ] ; then sed -ie "s/^bind-address\s*=\s*127\.0\.0\.1$/#bind-address = 0.0.0.0/" /etc/mysql/my.cnf; fi

# Install FFmpeg

RUN apt install -y software-properties-common \
libfreetype6-dev \
libgnutls28-dev \
libmp3lame-dev \
libass-dev \
libogg-dev \
libtheora-dev \
libvorbis-dev \
libvpx-dev \
libwebp-dev \
libssh2-1-dev \
libopus-dev \
librtmp-dev \
libx264-dev \
libx265-dev \
yasm && \
apt install -y \
build-essential \
bzip2 \
coreutils \
gnutls-bin \
nasm \
tar \
x264

RUN apt install -y zip

RUN apt install -y \
ffmpeg \
git \
make \
g++ \
gcc \
pkg-config \
python3 \
wget \
tar \
sudo \
xz-utils


WORKDIR /home/Shinobi
COPY . .
#RUN rm -rf /home/Shinobi/plugins
COPY ./plugins /home/Shinobi/plugins
RUN chmod -R 777 /home/Shinobi/plugins
RUN npm i npm@latest -g && \
npm install pm2 -g && \
npm install --unsafe-perm
COPY ./Docker/pm2.yml ./

# Copy default configuration files
# COPY ./config/conf.json ./config/super.json /home/Shinobi/
RUN chmod -f +x /home/Shinobi/Docker/init.sh

VOLUME ["/home/Shinobi/videos"]
VOLUME ["/home/Shinobi/plugins"]
VOLUME ["/home/Shinobi/libs/customAutoLoad"]
VOLUME ["/config"]
VOLUME ["/var/lib/mysql"]

EXPOSE 8080

ENTRYPOINT ["/home/Shinobi/Docker/init.sh"]

CMD [ "pm2-docker", "pm2.yml" ]
6 changes: 3 additions & 3 deletions shinobi/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: "3"
services:
shinobi:
# TODO: There only seems to be an arm32v7 image available right now.
# See: https://github.com/geerlingguy/pi-nvr/issues/1
image: registry.gitlab.com/shinobi-systems/shinobi:dev
container_name: Shinobi
# image: registry.gitlab.com/shinobi-systems/shinobi:dev
build: .
container_name: shinobi
environment:
- PLUGIN_KEYS=''
- SSL_ENABLED='false'
Expand Down
2 changes: 1 addition & 1 deletion shinobi/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
mode: '0755'
become: false

- name: Copy Pi-hole docker-compose template to Pi.
- name: Copy Shinobi docker-compose template to Pi.
ansible.builtin.template:
src: docker-compose.yml
dest: "~/shinobi/docker-compose.yml"
Expand Down
16 changes: 16 additions & 0 deletions zoneminder/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"
services:
zoneminder:
image: nardo86/zoneminder:1.36
container_name: zoneminder
environment:
- TZ=America/Chicago
- SELFSIGNED=1
- FQDN=nvr.local
shm_size: "256mb"
volumes:
- $HOME/zoneminder/config:/config
- $HOME/zoneminder/zmcache:/var/cache/zoneminder
ports:
- 443:443
restart: unless-stopped
49 changes: 49 additions & 0 deletions zoneminder/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
- hosts: dvr
become: true

handlers:
- name: Restart zoneminder
community.docker.docker_compose:
project_src: "~/zoneminder/"
build: false
restarted: true
become: false

pre_tasks:
- name: Update apt cache.
ansible.builtin.apt: update_cache=yes cache_valid_time=600

tasks:
- name: Ensure pip is installed.
ansible.builtin.apt:
name: python3-pip
state: present

- name: Install required python libraries.
ansible.builtin.pip:
name:
- docker
- docker-compose
state: present

- name: Create ZoneMinder folder on Pi.
ansible.builtin.file:
path: "~/zoneminder"
state: directory
mode: '0755'
become: false

- name: Copy ZoneMinder docker-compose template to Pi.
ansible.builtin.template:
src: docker-compose.yml
dest: "~/zoneminder/docker-compose.yml"
mode: '0640'
become: false
notify: Restart zoneminder

- name: Ensure ZoneMinder is running.
community.docker.docker_compose:
project_src: "~/zoneminder/"
build: false
become: false

0 comments on commit 6041be6

Please sign in to comment.