some documentation

This commit is contained in:
Evgeny Zinoviev 2022-06-11 21:53:36 +03:00
parent 96145418dd
commit 4daaed02f5
5 changed files with 98 additions and 25 deletions

View File

@ -2,18 +2,25 @@
``` ```
[Unit] [Unit]
Description=ssh tunnel for localhost:22 Description=ssh tunnel
After=network.target After=network.target
StartLimitIntervalSec=0 StartLimitIntervalSec=0
[Service] [Service]
User=user User=user
Group=user Group=user
Restart=on-failure Restart=always
RestartSec=15 RestartSec=1
ExecStart=autossh -M 20001 -N -R 127.0.0.1:44223:127.0.0.1:22 -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes solarmon-tunnel@solarmon.ru ExecStart=autossh -M 0 -NC -R 127.0.0.1:44223:127.0.0.1:22 -o StrictHostKeyChecking=no -o LogLevel=ERROR -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -o ServerAliveCountMax=2 user@host
WorkingDirectory=/home/user WorkingDirectory=/home/user
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
```
On server:
```
ClientAliveInterval 15
ClientAliveCountMax 2
``` ```

View File

@ -0,0 +1,4 @@
Debian packages:
```
apt-get install git cmake build-essential python3-dev python3-wheel python3-pip python3-build python3-yaml python3-toml python3-psutil python3-aiohttp python3-requests python3-apscheduler
```

View File

@ -1,18 +1,8 @@
For event-based FTP storage: ## Dependencies
```
apt install vsftpd
```
`/etc/vsftpd.conf`: - `ffmpeg`
```
chroot_local_user=YES
allow_writeable_chroot=YES
write_enable=YES ## HLS
seccomp_sandbox=NO
```
### HLS
Let's assume IP cameras stream h264 via rtsp. Let's assume IP cameras stream h264 via rtsp.
@ -44,6 +34,32 @@ Let's assume IP cameras stream h264 via rtsp.
PASSWORD=password PASSWORD=password
IP=192.168.1.2 IP=192.168.1.2
PORT=554 PORT=554
ARGS= # uncomment if needed
# ARGS="--force-tcp"
``` ```
- run `systemctl enable ipcam_rtsp2hls@camname` and `systemctl start ipcam_rtsp2hls@camname` - run `systemctl enable ipcam_rtsp2hls@camname` and `systemctl start ipcam_rtsp2hls@camname`
## Recording
- Copy systemd unit file:
```
cp /home/user/homekit/systemd/ipcam_capture@.service /etc/systemd/system
```
- Create configuration directory:
```
mkdir /etc/ipcam_capture.conf.d
```
- Then for each `camname`:
- create `/etc/ipcam_capture.conf.d/camname.conf` with following content:
```
IP=192.168.1.2
PORT=554
CREDS="user:password"
OUTDIR=/path/to/files
# uncomment if needed
# ARGS="--force-tcp"
```
- run `systemctl enable ipcam_capture@camname` and `systemctl start ipcam_capture@camname`

View File

@ -1,12 +1,25 @@
local worker config example: # ipcam_motion_worker.sh
One worker per camera.
## Usage
```
ipcam_motion_worker.sh [-v] [--allow-multiple] -c ~/.config/ipcam_motion_worker/1.txt
```
## Configuration
Local worker config example:
``` ```
api_url=http://ip:port api_url=http://ip:port
camera=1 camera=1
threshold=1 threshold=1
``` ```
remote worker config example: Remote worker config example:
``` ```
remote=1
api_url=http://ip:port api_url=http://ip:port
camera=1 camera=1
threshold=1 threshold=1
@ -14,9 +27,33 @@ fs_root=/var/ipcam_motion_fs
fs_max_filesize=146800640 fs_max_filesize=146800640
``` ```
optional fields: Optional fields:
``` ```
roi_file=roi.txt roi_file=roi.txt
``` ```
`/var/ipcam_motion_fs` should be a tmpfs mountpoint `api_url` must point to `ipcam_server` instance.
`/var/ipcam_motion_fs` should be a tmpfs mountpoint. Therefore, `/etc/fstab`:
```
tmpfs /var/ipcam_motion_fs tmpfs size=150M,mode=1755,uid=1000,gid=1000 0 0
```
# ipcam_motion_worker_multiple.sh
This script just consequentially runs `ipcam_motion_worker.sh` with `-c ~/.config/ipcam_motion_worker/$NAME.txt` argument.
## Usage
```
ipcam_worker_worker_multiple.sh -v NAME NAME NAME ...
```
# Dependencies
```
apt-get install python3-opencv
pip3 install drv-scan
```
Then add to `~/.local/bin` to `$PATH`.

View File

@ -1,4 +1,8 @@
config example (yaml) # ipcam_server.py
## Configuration
Config example (`yaml`)
``` ```
server: server:
@ -20,5 +24,10 @@ motion:
logging: logging:
verbose: true verbose: true
motion_threshold: 1
```
``` ## Usage
Use provided systemd unit file.