Shinobi/Docker
Moe 7ede7ef208 Emperor Claudius
### Changelog

#### May 2025

- Update Drop In Events (FTP)
  - Allow API Key ending only in @
  - Clean up file and folder processing for trigger
  - Better Uploaded content cleanup
- Fix memory leak possibility in camera thread
- Add extender for onOnvifEventTrigger (not enabled)
- Fix timelapse frame path builder in cron
- Fix too long column insertion on Videos table objects column
- Remove fps changer in simple mode changer api endpoint
- Update actCheck.js

#### April 2025

- Fix default object detection dimensions at 1280x720
- Merge branch 'dev' into 'dev'
  - Added pl language (translated by an LLM)
- Clean up central connector, prevents connecting multiple times at start
- Added pl language (translated by an LLM)
- Fix some npm vulnerabilities
- Fix event filters getting broken in cleanStringsInObject
  - Make Event Filters disable submit on save
  - Change region editor to use configureMonitor function
- Add some debugging code to createEventBasedRecording
- Fix refactored Central Connector when lost connection
- General fixes on monitor startup
- Add missing Custom Settings table creation
- Make central connector only get IPv4 and ignore internal
- Cleanup some logging and spacing
- Add bad cseq log drop to prevent browser log flooding
- Fix failing input_map parse on some monitors, modernize some details
- Update pairServer.js
- Allow Central Connection without SSH
- Refactor central management connector
- Make Max Storage Amount a human inputable/readable value
- Fix broken monitor utils
- Allow Commas in cleanStringsInObject function
- Add "Alarms" logging/actions and PTZ Updates
  - Fix Alarms tab preview video link
  - Update alarmPopup.ejs
  - Make form dark on Alarm Popup
  - Clean up Alarm gamepad
  - Add height to Alarm popup
  - Add download button to Alarm Popup video
  - Add details from first event to alarm
  - Use normal form instead of save on change in alarm popup
  - Remove console.log from getEventBasedRecordingUponCompletion
  - Make Alarms use normal Videos instead of Notification video + Gamepad PTZ
  - Add multiple monitors logged to Alarm and updating Alarm
  - Fix timezone in alarm popup, add limit query option to Alarms listing
  - Alarms and Event-Based PTZ (Working 80%)
  - Alarms (Framework only) and Event-Based PTZ and Utility updates
- Add Max Days for Cloud Video Uploaders
- Make fetch ptz command provide response data
- Change color of status progress bar
- Central SSH reconnect with delay
- Add SSH Proxy Capability to Central Management

#### March 2025

- Fix libs/ffmpeg in gitignore
- Add option to periodically reset management connection
- Add offline activator
- Remove language loaded from account settings
- Add WireGuard VPN scripts (server uses docker)
- Key manages camera count
- Allow "&" in monitor config strings
- Allow "?" in monitor config strings
- Add server ip parse for Central Connect
- Fix Branding by removing User-Level language selection
- Reverse Videos list when merging to ensure proper order
- Save Frame from FTP Trigger in Timelapse
- Reapply "Fix Cross-site scripting vulnerability in Monitor Edit" (Fixed)
- Revert "Fix Cross-site scripting vulnerability in Monitor Edit"
- Update getVideoSearchRequestQueries to have operators
- Clean up Videos Table Search Execution
- Fix Cross-site scripting vulnerability in Monitor Edit
- Remove DB_DISABLE_INCLUDED from Docker image

#### February 2025

- Make Monitor Settings post with websocket instead of ajax
- Clean up websocket callback on complete
- Ignore ffmpeg folder within Shinobi folder (ffbinaries download)
- Add a cmd tool to mass modify monitor configs with a template
- Update removeSenstiveInfoFromMonitorConfig
- Allow Connecting Multiple Central Servers
- API Key Management Upgrades
  - Add API Endpoint for getting a single row
  - Update Central API Key Creation
  - Fix Central API Key acquisition
  - Upgrade API Key Management: Edit User Settings and Permission Sets
  - Upgrade API Key Management: Permission to allow managing API
  - Upgrade API Key Management: Permissions and Editing
- Add Custom Settings API
- Clean up getMonitors API and add websocket method
- Permission Groups + Websocket API for Editing Monitor
  - Add or Edit Monitor over Websocket with callback
  - Add method to add/edit Monitors with websocket
  - Fix applyPermissionsToUser in createSession for API Keys
  - Void failed proc.stdin.write("q\\r\\n")
  - Allow API Key Management of Sub-Accounts by Admin
  - Clean up selecting Monitors in Permission Groups
  - Add User Permission Management by Group
  - Fix permissions to view and edit Permission Groups
  - Change Sub-Account Monitor select to Table
- Load Recent Videos once on Dashboard Ready
2025-06-03 13:19:41 +06:00
..
README.md Emperor Claudius 2025-06-03 13:19:41 +06:00
init.sh Emperor Claudius 2025-06-03 13:19:41 +06:00
install_ffmpeg.sh update some docker pre-run scripts 2023-11-01 08:57:14 -07:00
install_mariadb.sh remove non-default dockerfile and injection of base image as part of the build process, adjust CI/CD process, clean up 2023-09-28 15:51:18 +03:00
install_nodejs.sh Set maxsockets for npm install during build to avoid network errors 2024-08-22 17:20:20 +00:00
pm2.yml Update SQL Queries on Startup 2022-12-17 00:07:23 +00:00

README.md

This Docker method is only for integrated Database and simple volume mounts. For separate database and more elaborate installation please use this registry instead :

https://gitlab.com/Shinobi-Systems/ShinobiDocker

Install Shinobi with Docker

Warning : It is recommended that you have a dedicated machine for Shinobi even if you intend to use Docker. If you are willing to install directly on the operating system please consider installing Ubuntu 22.04 and using the Ninja Way.

We recommend that your Host OS is one of the following :

  • Ubuntu 22.04
  • CentOS 8
  • MacOS 10.7

Docker Image Used : registry.gitlab.com/shinobi-systems/shinobi:dev

Ninja Way - Docker Edition

This method uses docker-compose. This will build your container from the images hosted on Gitlab. We no longer use Docker Hub and will not in the foreseeable future.

bash <(curl -s https://gitlab.com/Shinobi-Systems/Shinobi-Installer/raw/master/shinobi-docker.sh)

Once complete open port 8080 of your Docker host in a web browser.

"Run" Way

Installing Shinobi

Please remember to check out the Environment Variables table further down this README.

docker run -d --name='Shinobi' --memory=2g -p '8080:8080/tcp' -p '21:21/tcp' -v "$HOME/ShinobiDatabase":'/var/lib/mysql':'rw' -v "$HOME/Shinobi":'/home/Shinobi':'rw' registry.gitlab.com/shinobi-systems/shinobi:dev

From Source

Image is based on Ubuntu Bionic (20.04). Node.js 12 is used. MariaDB and FFmpeg are included.

  1. Download Repo
git clone -b dev https://gitlab.com/Shinobi-Systems/Shinobi.git ShinobiSource
  1. Enter repository.
cd ShinobiSource
  1. Build Image.
docker build --tag shinobi-image:1.0 .

Running on ARM32v7? Run this instead.

docker build -f Dockerfile.arm32v7 --tag shinobi-image:1.0 .
  1. Create a container with the image.

This command only works on Linux because of the temporary directory used. This location must exist in RAM. -v "/dev/shm/shinobiStreams":'/dev/shm/streams':'rw'. The timezone is also acquired from the host by the volume declaration of -v '/etc/localtime':'/etc/localtime':'ro'.

docker run -d --name='Shinobi' --memory=2g -p '8080:8080/tcp' -p '21:21/tcp' -v "$HOME/ShinobiDatabase":'/var/lib/mysql':'rw' -v "$HOME/Shinobi":'/home/Shinobi':'rw' shinobi-image:1.0

Host mount paths have been updated in this document.

Volumes

Volumes Description
$HOME/Shinobi Maps to the /home/Shinobi folder for the customAutoLoad, plugins, and videos folders inside and other files. Additionally you can edit the conf.json and super.json here.
$HOME/ShinobiDatabase A map to /var/lib/mysql in the container. This is the database's core files.

Environment Variables

Environment Variables have been disabled. You must now make changes in the conf.json itself when it is mounted on the host. If conf.json does not exist inside the mounted folder then you may create it and Shinobi will use that on next container start.

You must add (to the docker container) /config/ssl/server.key and /config/ssl/server.cert. The /config folder is mapped to $HOME/Shinobi/config on the host by default with the quick run methods. Place key and cert in $HOME/Shinobi/config/ssl. If SSL_ENABLED=true and these files don't exist they will be generated with openssl.

The Docker image will create the DB_DATABASE under the specified connection information.

Power Video Viewer Blank or Not working

This seems to be an issue with using Docker on some linux OS' like Arch Linux. It is uncertain what the specific issue is but for now please use Docker on a consumer or enterprise supported distribution of linux, like Ubuntu 20.04.

Tips

Modifying conf.json or Superuser credentials.

Please read Volumes table in this README. conf.json is for general configuration. super.json is for Superuser credential management.

Get Docker Containers

docker ps -a

Get Images

docker images

Container Logs

docker logs /Shinobi

Enter the Command Line of the Container

docker exec -it /Shinobi /bin/bash

Stop and Remove

docker stop /Shinobi
docker rm /Shinobi

WARNING - DEVELOPMENT ONLY!!! Kill all Containers and Images

These commands will completely erase all of your docker containers and images. You have been warned!

docker stop /Shinobi
docker rm $(docker ps -a -f status=exited -q)
docker rmi $(docker images -a -q)