all-in-one backend using docker
This commit is contained in:
83
README.md
83
README.md
@ -1,8 +1,79 @@
|
||||
# msv-webcam-backend
|
||||
|
||||
- `mkdir /opt/msv-webcam-backend/`
|
||||
- `cd /opt/msv-webcam-backend/`
|
||||
- import `msv_webcam_backend.py`
|
||||
- `chmod +x /opt/msv-webcam-backend/msv_webcam_backend.py`
|
||||
- `nano /etc/systemd/system/msv-webcam-backend.service`
|
||||
- `systemctl daemon-reload && systemctl enable --now msv-webcam-backend.service`
|
||||
A lightweight FTPS-based backend that automatically watches camera upload folders, converts the latest image from each camera to AVIF format, and stores them in a `current/` directory for easy access (e.g., via Nginx).
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
- FTPS server for receiving image uploads
|
||||
- Automatic detection of the newest image per camera folder
|
||||
- Conversion to AVIF format using `avifenc`
|
||||
- Persistent storage of converted images in a shared `current/` directory
|
||||
- Designed for integration with a frontend or Nginx for live webcam feeds
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
### 0) Import project files
|
||||
Make sure the following files are present in your repository:
|
||||
```
|
||||
docker-compose.yml
|
||||
Dockerfile
|
||||
post_upload.sh
|
||||
```
|
||||
|
||||
### 1) Configure user credentials
|
||||
Edit `docker-compose.yml` and set your FTPS username and password:
|
||||
```yaml
|
||||
environment:
|
||||
- BF_FTPS_VSFTPD_USER=username
|
||||
- BF_FTPS_VSFTPD_PASS=userpw
|
||||
```
|
||||
|
||||
### 2) Make the post-upload script executable
|
||||
```bash
|
||||
chmod +x post_upload.sh
|
||||
```
|
||||
|
||||
### 3) Build the Docker image
|
||||
```bash
|
||||
docker-compose build
|
||||
```
|
||||
|
||||
### 4) Start the service
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
```
|
||||
├── docker-compose.yml
|
||||
├── Dockerfile
|
||||
├── post_upload.sh
|
||||
└── files/
|
||||
├── msvcam1/ # uploads from camera 1
|
||||
├── msvcam2/ # uploads from camera 2
|
||||
└── current/ # latest .avif images (msvcam1.avif, msvcam2.avif, ...)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## How It Works
|
||||
1. Cameras upload images via FTPS into `files/msvcamN/` folders.
|
||||
2. `post_upload.sh` periodically checks for the newest image in each folder.
|
||||
3. If the newest image has changed (SHA256 hash comparison), it is converted to `.avif` format and saved to `files/current/` as `msvcamN.avif`.
|
||||
4. The `current/` directory can be served directly by a web server (e.g., Nginx) for live display.
|
||||
|
||||
---
|
||||
|
||||
## Example Nginx Integration
|
||||
See [MSV Webcam Frontend](https://git.mosad.xyz/localhorst/msv-webcam-frontend)
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
Reference in New Issue
Block a user