Deploying Bluecherry
Bluecherry is a sophisticated, open-source Linux video surveillance system designed for network (IP) cameras with a minimal resource footprint. Built with efficiency in mind, Bluecherry delivers professional-grade video surveillance capabilities while maintaining low memory usage and CPU overhead, making it ideal for deployment on cloud infrastructure. Whether you’re securing a single property, managing multiple locations, or building an enterprise surveillance network, Bluecherry provides a powerful, flexible, and free solution with complete control over your security infrastructure.
Why Bluecherry?
Bluecherry stands out as the premier choice for professional video surveillance with exceptional features:
- Completely Open Source: Free and donation-supported under GPL license with no licensing restrictions
- Unlimited Cameras: Add unlimited network cameras to your surveillance system
- ONVIF Support: Full compatibility with ONVIF standard cameras with automatic detection
- Web-Based Interface: User-friendly web interface for configuration and live viewing
- Low Resource Usage: Minimal memory footprint and efficient CPU usage for cost-effective deployment
- Live Streaming: Real-time video streaming with multiple quality options
- Cross-Platform Clients: Desktop clients available for Linux, Windows, and macOS
- Mobile Apps: Native iOS and Android applications for mobile surveillance
- User Roles and Access: Granular role-based access control for multiple users
- Email Notifications: Automated email alerts for motion detection and events
- Webhook Support: Integration with external systems via webhooks
- Event Recording: Automated video recording with motion detection
- Video Playback: Search and review recorded video with timeline navigation
- Multi-Site Management: Manage multiple surveillance systems from one interface
- Cloud Connectivity: Connect to your surveillance system securely from anywhere
- Database Support: Integrated database for events and metadata
- Easy Installation: Docker-based installation for quick deployment
- Seamless Upgrades: Simple upgrade process without complex dependencies
- Virtual Machine Ready: Works perfectly in virtualized environments
- Active Community: Vibrant community support via forums and Discord
Bluecherry is ideal for small businesses needing professional surveillance, property managers monitoring multiple locations, security professionals deploying enterprise systems, home users requiring local surveillance control, and organizations prioritizing open-source security solutions. With persistent storage on Klutch.sh, your surveillance system is always available and secure.
Prerequisites
Before deploying Bluecherry, ensure you have:
- A Klutch.sh account
- A GitHub repository with your Bluecherry deployment configuration
- Basic familiarity with Docker and Git
- IP cameras with ONVIF support (or compatible network cameras)
- Sufficient storage for video recordings (typically 100GB-1TB+ depending on retention policy)
- Stable internet connection with adequate bandwidth for video streams
- Understanding of network configuration and port management
Important Considerations
Deploying Bluecherry
Create a New Project
Log in to your Klutch.sh dashboard and create a new project for your Bluecherry surveillance system.
Prepare Your Repository
Create a GitHub repository with the following structure for your Bluecherry deployment:
bluecherry-deploy/├─ Dockerfile├─ .env.example├─ docker-entrypoint.sh├─ .gitignore└─ README.mdHere’s a Dockerfile for Bluecherry:
FROM ubuntu:22.04ENV DEBIAN_FRONTEND=noninteractive# Install system dependenciesRUN apt-get update && apt-get install -y \curl \wget \git \build-essential \autoconf \automake \libtool \pkg-config \php-fpm \php-cli \php-common \php-json \php-xml \php-curl \php-mysql \php-sqlite3 \nginx \mysql-server \sqlite3 \ffmpeg \libav-tools \vlc \vlc-plugin-base \vlc-plugin-core \libvlc-dev \libx264-dev \libx265-dev \libfdk-aac-dev \libmp3lame-dev \libopus-dev \libvpx-dev \libfreetype6-dev \libwebp-dev \python3 \python3-pip \sudo \systemctl \&& rm -rf /var/lib/apt/lists/*# Install BluecherryRUN curl -fsSL https://install.bluecherrydvr.com/docker | bash# Create necessary directoriesRUN mkdir -p /var/bluecherry/data \/var/bluecherry/recordings \/var/bluecherry/logs \/var/bluecherry/database \&& chmod -R 755 /var/bluecherry# Copy entrypoint scriptCOPY docker-entrypoint.sh /RUN chmod +x /docker-entrypoint.sh# Expose portsEXPOSE 7001 7002 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \CMD curl -f http://localhost:7001/ || exit 1# Run entrypointENTRYPOINT ["/docker-entrypoint.sh"]CMD ["/bin/bash"]Create a
docker-entrypoint.shfile:#!/bin/bashset -e# Create necessary directoriesmkdir -p /var/bluecherry/data \/var/bluecherry/recordings \/var/bluecherry/logs \/var/bluecherry/database# Set proper permissionschmod -R 755 /var/bluecherrychown -R www-data:www-data /var/bluecherry# Initialize database if neededif [ ! -f /var/bluecherry/database/bluecherry.db ]; thenecho "Initializing Bluecherry database..."sqlite3 /var/bluecherry/database/bluecherry.db < /usr/share/bluecherry/sql/bluecherry.sql || truechmod 755 /var/bluecherry/database/bluecherry.dbchown www-data:www-data /var/bluecherry/database/bluecherry.dbfi# Start PHP-FPMecho "Starting PHP-FPM..."service php-fpm start# Start Nginxecho "Starting Nginx..."service nginx start# Start Bluecherry servicesecho "Starting Bluecherry services..."service bluecherry start || true# Keep container runningecho "Bluecherry surveillance system is running..."tail -f /var/log/bluecherry/*.log &waitCreate a
.env.examplefile:Terminal window # Bluecherry ConfigurationBLUECHERRY_HOST=0.0.0.0BLUECHERRY_PORT=7001BLUECHERRY_SECURE_PORT=7002# Admin UserADMIN_USER=adminADMIN_PASSWORD=bluecherryADMIN_EMAIL=admin@yourdomain.com# Database ConfigurationDB_TYPE=sqliteDB_PATH=/var/bluecherry/database/bluecherry.db# For MySQL:# DB_TYPE=mysql# DB_HOST=localhost# DB_NAME=bluecherry# DB_USER=bluecherry# DB_PASSWORD=secure_password# Storage ConfigurationRECORDINGS_PATH=/var/bluecherry/recordingsDATA_PATH=/var/bluecherry/dataLOG_PATH=/var/bluecherry/logs# Surveillance SettingsENABLE_EMAIL_ALERTS=trueALERT_EMAIL=admin@yourdomain.comRETENTION_DAYS=30# Network ConfigurationALLOW_REMOTE_ACCESS=trueENABLE_HTTPS=trueENABLE_WEBHOOKS=true# Performance TuningMAX_RECORDING_THREADS=4STREAMING_BUFFER_SIZE=2048DATABASE_CACHE_SIZE=512# LoggingLOG_LEVEL=infoCreate a
.gitignorefile:.envrecordings/database/logs/*.db*.lognode_modules/.DS_StoreCommit and push to your GitHub repository:
Terminal window git initgit add .git commit -m "Initial Bluecherry deployment"git remote add origin https://github.com/yourusername/bluecherry-deploy.gitgit push -u origin mainCreate a New App
In the Klutch.sh dashboard:
- Click “Create New App”
- Select your GitHub repository containing the Dockerfile
- Choose the branch (typically
mainormaster) - Klutch.sh will automatically detect the Dockerfile in the root directory
Configure Environment Variables
Set up these essential environment variables in your Klutch.sh dashboard:
Variable Description Example BLUECHERRY_HOSTServer bind address 0.0.0.0BLUECHERRY_PORTHTTP port 7001BLUECHERRY_SECURE_PORTHTTPS port 7002ADMIN_USERAdmin username adminADMIN_PASSWORDAdmin password bluecherryADMIN_EMAILAdmin email address admin@yourdomain.comDB_TYPEDatabase type (sqlite/mysql) sqliteDB_PATHSQLite database path /var/bluecherry/database/bluecherry.dbRECORDINGS_PATHVideo recordings directory /var/bluecherry/recordingsDATA_PATHApplication data directory /var/bluecherry/dataLOG_PATHLog files directory /var/bluecherry/logsENABLE_EMAIL_ALERTSEnable motion detection alerts trueALERT_EMAILAlert destination email admin@yourdomain.comRETENTION_DAYSVideo retention period 30ALLOW_REMOTE_ACCESSEnable remote connections trueENABLE_HTTPSEnable HTTPS access trueMAX_RECORDING_THREADSRecording threads 4LOG_LEVELLogging verbosity infoConfigure Persistent Storage
Bluecherry requires persistent storage for video recordings and database files. Add persistent volumes:
Mount Path Description Recommended Size /var/bluecherry/recordingsVideo recordings 500GB-2TB /var/bluecherry/databaseDatabase files 10GB /var/bluecherry/dataApplication data 50GB /var/bluecherry/logsLog files 20GB In the Klutch.sh dashboard:
- Navigate to your app settings
- Go to the “Volumes” section
- Click “Add Volume” for each mount path
- Set mount paths and sizes as specified above
- Ensure recordings volume is sized for your retention policy and camera count
Set Network Configuration
Configure your app’s network settings:
- Select traffic type: HTTP
- Recommended internal port: 7001 (Bluecherry default web interface port)
- Klutch.sh will handle HTTPS termination via reverse proxy
- Additional ports (7002, 5000-5010) used for streaming and protocols
Configure Custom Domain
Bluecherry benefits from a custom domain for professional surveillance access:
- Navigate to your app’s “Domains” section in Klutch.sh
- Click “Add Custom Domain”
- Enter your domain (e.g.,
surveillance.yourdomain.comorcctv.yourdomain.com) - Configure DNS with a CNAME record pointing to your Klutch.sh app
- Update
BLUECHERRY_HOSTenvironment variable if needed - Klutch.sh will automatically provision SSL certificates
- Access your surveillance system at
https://surveillance.yourdomain.com
Deploy Your App
- Review all settings and environment variables
- Verify all persistent volumes are properly configured with adequate sizes
- Verify recordings volume is sized appropriately for your cameras and retention policy
- Click “Deploy”
- Klutch.sh will build the Docker image and start your Bluecherry instance
- Wait for the deployment to complete (typically 10-15 minutes)
- Access your Bluecherry instance at your configured domain
- Log in with admin credentials to begin adding cameras
Initial Setup and Configuration
After deployment completes, access your Bluecherry instance to complete surveillance system setup.
Accessing Bluecherry
Navigate to your domain: https://surveillance.yourdomain.com
Log in to the admin panel using admin credentials you configured.
Admin Panel Access
Access administration features:
- Open
https://surveillance.yourdomain.comin web browser - Enter admin username and password (default: admin/bluecherry)
- You’re now in the Bluecherry admin dashboard
- Change default admin password immediately
- Configure system settings and add cameras
Adding IP Cameras
Set up your network cameras for surveillance:
Automatic Camera Discovery
- Ensure cameras are on the same network as Bluecherry
- Go to “Cameras” → “Add Cameras”
- Click “Network Scan” or “Auto-Discover”
- Bluecherry scans for ONVIF-compatible cameras
- Select cameras to add from discovery results
- Click “Add Selected Cameras”
- Enter camera credentials if required
Manual Camera Addition
- Navigate to “Cameras” → “Add Camera”
- Enter camera details:
- Camera name/location
- IP address or hostname
- RTSP stream URL (if known)
- Username and password
- Stream resolution and codec
- Click “Test Connection” to verify
- Save camera configuration
- Monitor live stream to confirm connection
Configuring Camera Settings
Customize individual camera parameters:
- Select camera from camera list
- Go to “Settings” for the camera
- Configure:
- Resolution and frame rate
- Bitrate and quality settings
- Recording settings (continuous/motion-triggered)
- Event triggers
- Retention policy
- Save settings and verify live stream
Setting Up Motion Detection
Enable automated recording based on motion:
- Navigate to “Cameras” → Select camera
- Go to “Motion Detection” settings
- Configure:
- Enable/disable motion detection
- Sensitivity level (adjust for false positives)
- Detection areas (draw zones on preview)
- Pre-recording buffer (seconds before motion)
- Post-recording buffer (seconds after motion)
- Save configuration
- Test motion detection with camera movement
Configuring Recording Options
Set up video recording for your cameras:
- Go to “Cameras” → Select camera → “Recording”
- Configure:
- Recording schedule (24/7, business hours, etc.)
- Recording type (continuous/motion/manual)
- Video quality and bitrate
- Retention period (days to keep recordings)
- Adjust for your storage capacity
- Enable scheduled cleanup of old recordings
- Monitor storage usage in dashboard
Creating User Accounts and Roles
Set up multiple users with different access levels:
- Navigate to “Users” → “Add User”
- Enter user information:
- Username and password
- Email address
- Display name
- Assign user role:
- Admin: Full system access
- Manager: Camera management and viewing
- Viewer: View-only access to cameras
- Select cameras user can access
- Set user permissions
- Save user account
- User can log in and view assigned cameras
Setting Up Email Alerts
Configure notifications for motion detection and events:
- Go to “Settings” → “Email Notifications”
- Configure email server:
- SMTP server address
- SMTP port
- Username and password
- From email address
- Set alert rules:
- Select cameras for alerts
- Choose trigger events (motion, disconnect, etc.)
- Set notification recipients
- Configure alert frequency to prevent spam
- Send test email to verify configuration
Viewing Live Streams
Access real-time camera feeds:
- Log in to Bluecherry web interface
- Click “Live View” or camera thumbnail
- Select camera from list
- View live stream (multiple stream quality options)
- Use playback controls for live stream
- Switch between cameras seamlessly
- Multi-camera view available in dashboard
Reviewing Recorded Video
Search and playback recorded surveillance footage:
- Navigate to “Playback” or “History”
- Select camera from dropdown
- Use calendar to select date
- Choose time range for viewing
- Click “Play” to start playback
- Use playback controls:
- Play/Pause
- Speed adjustment (1x, 2x, 4x)
- Frame-by-frame navigation
- Download video clip
- Search by motion detection events
Environment Variable Examples
Basic Configuration
BLUECHERRY_HOST=0.0.0.0BLUECHERRY_PORT=7001ADMIN_USER=adminADMIN_PASSWORD=securepasswordADMIN_EMAIL=admin@yourdomain.comDB_TYPE=sqliteDB_PATH=/var/bluecherry/database/bluecherry.dbRECORDINGS_PATH=/var/bluecherry/recordingsComplete Production Configuration
# Server ConfigurationBLUECHERRY_HOST=0.0.0.0BLUECHERRY_PORT=7001BLUECHERRY_SECURE_PORT=7002
# Admin AccountADMIN_USER=adminADMIN_PASSWORD=very_secure_password_32_charactersADMIN_EMAIL=admin@yourdomain.com
# Database ConfigurationDB_TYPE=sqliteDB_PATH=/var/bluecherry/database/bluecherry.db# For MySQL:# DB_TYPE=mysql# DB_HOST=db.internal# DB_NAME=bluecherry# DB_USER=bluecherry# DB_PASSWORD=secure_db_password
# Storage ConfigurationRECORDINGS_PATH=/var/bluecherry/recordingsDATA_PATH=/var/bluecherry/dataLOG_PATH=/var/bluecherry/logs
# Surveillance SettingsENABLE_EMAIL_ALERTS=trueALERT_EMAIL=alerts@yourdomain.comRETENTION_DAYS=30AUTO_DELETE_OLD_RECORDINGS=true
# Network ConfigurationALLOW_REMOTE_ACCESS=trueENABLE_HTTPS=trueENABLE_WEBHOOKS=trueWEBHOOK_URL=https://webhook.yourdomain.com/bluecherry
# Performance TuningMAX_RECORDING_THREADS=8STREAMING_BUFFER_SIZE=4096DATABASE_CACHE_SIZE=1024MAX_CONCURRENT_STREAMS=32
# Email ConfigurationSMTP_SERVER=smtp.gmail.comSMTP_PORT=587SMTP_USERNAME=alerts@yourdomain.comSMTP_PASSWORD=smtp_app_passwordSMTP_FROM=Bluecherry Alerts <alerts@yourdomain.com>SMTP_USE_TLS=true
# LoggingLOG_LEVEL=infoLOG_TO_FILE=trueLOG_ROTATION_ENABLED=trueLOG_RETENTION_DAYS=7Sample Code and Getting Started
PHP - Camera Management Integration
<?php// Bluecherry Camera Management Integration
class BluecherryManager { private $apiUrl; private $apiKey; private $sessionId;
public function __construct($apiUrl, $username, $password) { $this->apiUrl = $apiUrl; $this->authenticate($username, $password); }
private function authenticate($username, $password) { // Authenticate with Bluecherry API $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->apiUrl . '/api/v1/auth/login'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'username' => $username, 'password' => $password ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = json_decode(curl_exec($ch), true); curl_close($ch);
if ($response && isset($response['sessionId'])) { $this->sessionId = $response['sessionId']; } }
public function getCameras() { // Get list of all cameras $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->apiUrl . '/api/v1/cameras'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $this->sessionId, 'Content-Type: application/json' ]);
$response = json_decode(curl_exec($ch), true); curl_close($ch);
return $response['cameras'] ?? []; }
public function addCamera($name, $rtspUrl, $username, $password) { // Add new camera to system $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->apiUrl . '/api/v1/cameras'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'name' => $name, 'url' => $rtspUrl, 'username' => $username, 'password' => $password ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $this->sessionId, 'Content-Type: application/json' ]);
$response = json_decode(curl_exec($ch), true); curl_close($ch);
return $response; }
public function enableMotionDetection($cameraId, $sensitivity) { // Enable motion detection for camera $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->apiUrl . '/api/v1/cameras/' . $cameraId . '/motion'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ 'enabled' => true, 'sensitivity' => $sensitivity ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $this->sessionId, 'Content-Type: application/json' ]);
$response = json_decode(curl_exec($ch), true); curl_close($ch);
return $response; }
public function getRecordings($cameraId, $startTime, $endTime) { // Get recordings for camera in time range $ch = curl_init(); $query = http_build_query([ 'start' => $startTime, 'end' => $endTime ]); curl_setopt($ch, CURLOPT_URL, $this->apiUrl . '/api/v1/cameras/' . $cameraId . '/recordings?' . $query); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $this->sessionId, 'Content-Type: application/json' ]);
$response = json_decode(curl_exec($ch), true); curl_close($ch);
return $response['recordings'] ?? []; }
public function setRecordingSchedule($cameraId, $schedule) { // Set recording schedule for camera $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->apiUrl . '/api/v1/cameras/' . $cameraId . '/recording'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($schedule)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $this->sessionId, 'Content-Type: application/json' ]);
$response = json_decode(curl_exec($ch), true); curl_close($ch);
return $response; }}
// Usage example$bluecherry = new BluecherryManager( 'https://surveillance.yourdomain.com', 'admin', 'password');
$cameras = $bluecherry->getCameras();foreach ($cameras as $camera) { echo "Camera: " . $camera['name'] . " - " . $camera['status'] . "\n";}JavaScript - Live Stream Viewer
// Bluecherry Live Stream Viewer
class BluecherryViewer { constructor(containerId, apiUrl, sessionToken) { this.container = document.getElementById(containerId); this.apiUrl = apiUrl; this.sessionToken = sessionToken; this.currentCamera = null; this.videoElement = null; this.init(); }
async init() { this.setupUI(); this.loadCameras(); }
setupUI() { // Create viewer HTML this.container.innerHTML = ` <div class="bluecherry-viewer"> <div class="camera-selector"> <select id="cameraSelect" class="camera-dropdown"> <option value="">Select a camera...</option> </select> </div> <div class="video-container"> <video id="liveStream" width="100%" height="auto" controls> Your browser does not support the video tag. </video> </div> <div class="camera-info"> <p id="cameraStatus">Disconnected</p> <p id="cameraFPS">FPS: --</p> <p id="cameraBitrate">Bitrate: -- Mbps</p> </div> <div class="controls"> <button id="snapshotBtn" class="btn">Snapshot</button> <button id="recordBtn" class="btn">Record</button> <button id="fullscreenBtn" class="btn">Fullscreen</button> </div> </div> `;
this.videoElement = document.getElementById('liveStream'); this.setupEventListeners(); }
async loadCameras() { try { const response = await fetch(this.apiUrl + '/api/v1/cameras', { headers: { 'Authorization': 'Bearer ' + this.sessionToken } });
const data = await response.json(); const select = document.getElementById('cameraSelect');
data.cameras.forEach(camera => { const option = document.createElement('option'); option.value = camera.id; option.textContent = camera.name; select.appendChild(option); }); } catch (error) { console.error('Failed to load cameras:', error); } }
setupEventListeners() { document.getElementById('cameraSelect').addEventListener('change', (e) => { this.selectCamera(e.target.value); });
document.getElementById('snapshotBtn').addEventListener('click', () => { this.takeSnapshot(); });
document.getElementById('recordBtn').addEventListener('click', () => { this.toggleRecording(); });
document.getElementById('fullscreenBtn').addEventListener('click', () => { this.enterFullscreen(); }); }
async selectCamera(cameraId) { if (!cameraId) return;
try { const response = await fetch( this.apiUrl + '/api/v1/cameras/' + cameraId + '/stream', { headers: { 'Authorization': 'Bearer ' + this.sessionToken } } );
const data = await response.json(); this.videoElement.src = data.streamUrl; this.currentCamera = cameraId; this.updateCameraStatus('Connected'); } catch (error) { console.error('Failed to select camera:', error); this.updateCameraStatus('Connection Failed'); } }
takeSnapshot() { if (!this.currentCamera) { alert('Please select a camera first'); return; }
// Create canvas from video frame const canvas = document.createElement('canvas'); canvas.width = this.videoElement.videoWidth; canvas.height = this.videoElement.videoHeight; canvas.getContext('2d').drawImage(this.videoElement, 0, 0);
// Download snapshot const link = document.createElement('a'); link.href = canvas.toDataURL('image/jpeg'); link.download = 'snapshot-' + new Date().getTime() + '.jpg'; link.click(); }
toggleRecording() { // Toggle local recording via MediaRecorder API if (!this.mediaRecorder) { const stream = this.videoElement.captureStream(30); this.mediaRecorder = new MediaRecorder(stream); this.recordedChunks = [];
this.mediaRecorder.ondataavailable = (e) => { this.recordedChunks.push(e.data); };
this.mediaRecorder.onstop = () => { const blob = new Blob(this.recordedChunks, { type: 'video/webm' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'recording-' + new Date().getTime() + '.webm'; a.click(); this.recordedChunks = []; };
this.mediaRecorder.start(); document.getElementById('recordBtn').textContent = 'Stop Recording'; } else { this.mediaRecorder.stop(); this.mediaRecorder = null; document.getElementById('recordBtn').textContent = 'Record'; } }
enterFullscreen() { if (this.videoElement.requestFullscreen) { this.videoElement.requestFullscreen(); } }
updateCameraStatus(status) { document.getElementById('cameraStatus').textContent = status; }}
// Initialize viewerdocument.addEventListener('DOMContentLoaded', () => { new BluecherryViewer('viewer', 'https://surveillance.yourdomain.com', 'SESSION_TOKEN');});Bash - Automated Backup Script
#!/bin/bash
# Bluecherry Backup ScriptBACKUP_DIR="/backups/bluecherry"TIMESTAMP=$(date +%Y%m%d_%H%M%S)RETENTION_DAYS=30
# Create backup directorymkdir -p $BACKUP_DIR
echo "Starting Bluecherry backup..."
# Backup databaseecho "Backing up Bluecherry database..."if [ -f /var/bluecherry/database/bluecherry.db ]; then tar -czf $BACKUP_DIR/bluecherry_db_$TIMESTAMP.tar.gz \ /var/bluecherry/database/bluecherry.dbfi
# Backup application dataecho "Backing up application data..."tar -czf $BACKUP_DIR/bluecherry_data_$TIMESTAMP.tar.gz \ /var/bluecherry/data \ --exclude='/var/bluecherry/data/recordings'
# Backup logsecho "Backing up logs..."tar -czf $BACKUP_DIR/bluecherry_logs_$TIMESTAMP.tar.gz \ /var/bluecherry/logs
# Backup configurationecho "Backing up configuration..."tar -czf $BACKUP_DIR/bluecherry_config_$TIMESTAMP.tar.gz \ /etc/bluecherry \ /etc/nginx/sites-enabled \ /etc/php-fpm.d
# Cleanup old backupsecho "Cleaning up old backups..."find $BACKUP_DIR -name "bluecherry_*" -mtime +$RETENTION_DAYS -delete
# Calculate backup sizeTOTAL_SIZE=$(du -sh $BACKUP_DIR | awk '{print $1}')
echo "Backup completed: $TIMESTAMP"echo "Total backup size: $TOTAL_SIZE"echo "Backup location: $BACKUP_DIR"
# List recent backupsecho ""echo "Recent backups:"ls -lh $BACKUP_DIR | tail -10
# Optional: Upload to cloud storage# aws s3 sync $BACKUP_DIR s3://your-bucket/bluecherry-backups/ --delete
# Optional: Send backup notification# curl -X POST https://hooks.slack.com/services/YOUR/WEBHOOK/URL \# -d "{\"text\":\"Bluecherry backup completed: $TIMESTAMP\"}"cURL - API Integration Examples
# Bluecherry API Examples
# Authenticate and get session tokencurl -X POST https://surveillance.yourdomain.com/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{ "username": "admin", "password": "password" }'
# Get all camerascurl -X GET https://surveillance.yourdomain.com/api/v1/cameras \ -H "Authorization: Bearer SESSION_TOKEN"
# Get specific camera detailscurl -X GET https://surveillance.yourdomain.com/api/v1/cameras/1 \ -H "Authorization: Bearer SESSION_TOKEN"
# Add new cameracurl -X POST https://surveillance.yourdomain.com/api/v1/cameras \ -H "Content-Type: application/json" \ -H "Authorization: Bearer SESSION_TOKEN" \ -d '{ "name": "Front Door", "url": "rtsp://192.168.1.100:554/stream", "username": "camera_user", "password": "camera_password", "resolution": "1920x1080", "fps": 30 }'
# Enable motion detection on cameracurl -X POST https://surveillance.yourdomain.com/api/v1/cameras/1/motion \ -H "Content-Type: application/json" \ -H "Authorization: Bearer SESSION_TOKEN" \ -d '{ "enabled": true, "sensitivity": 75, "threshold": 100 }'
# Get recordings for cameracurl -X GET "https://surveillance.yourdomain.com/api/v1/cameras/1/recordings?start=2024-01-01&end=2024-01-02" \ -H "Authorization: Bearer SESSION_TOKEN"
# Download recordingcurl -X GET "https://surveillance.yourdomain.com/api/v1/recordings/12345/download" \ -H "Authorization: Bearer SESSION_TOKEN" \ -o recording.mp4
# Get system statuscurl -X GET https://surveillance.yourdomain.com/api/v1/system/status \ -H "Authorization: Bearer SESSION_TOKEN"
# Get storage informationcurl -X GET https://surveillance.yourdomain.com/api/v1/system/storage \ -H "Authorization: Bearer SESSION_TOKEN"
# Update camera settingscurl -X PUT https://surveillance.yourdomain.com/api/v1/cameras/1 \ -H "Content-Type: application/json" \ -H "Authorization: Bearer SESSION_TOKEN" \ -d '{ "name": "Front Door - Updated", "resolution": "2560x1920", "fps": 30, "bitrate": 5000 }'
# Delete cameracurl -X DELETE https://surveillance.yourdomain.com/api/v1/cameras/1 \ -H "Authorization: Bearer SESSION_TOKEN"
# Create event alert rulecurl -X POST https://surveillance.yourdomain.com/api/v1/alerts \ -H "Content-Type: application/json" \ -H "Authorization: Bearer SESSION_TOKEN" \ -d '{ "name": "Motion Alert", "camera_id": 1, "trigger": "motion", "action": "email", "recipient": "admin@yourdomain.com" }'Surveillance System Management
Monitoring System Performance
Monitor your surveillance system health:
- Check CPU Usage: Monitor CPU load in dashboard
- Memory Monitoring: Verify RAM availability for streams
- Storage Monitoring: Track disk usage and retention
- Network Bandwidth: Monitor bandwidth utilization
- Recording Status: Verify cameras are recording
- Connection Status: Ensure cameras are connected
Managing Storage and Retention
Optimize storage usage:
- Set retention policy based on available storage
- Regular cleanup of old recordings
- Monitor disk space usage
- Implement tiered storage if needed
- Archive important recordings separately
- Adjust camera quality to reduce file sizes
User Access Management
Control who can access your surveillance system:
- Create appropriate user accounts
- Assign role-based permissions
- Restrict camera access by user
- Monitor user login activity
- Disable inactive accounts
- Require strong passwords
- Enable two-factor authentication if available
Event Logging and Alerts
Monitor system events:
- Review system logs for errors
- Monitor motion detection events
- Track camera connection changes
- Review user login/logout history
- Monitor failed authentication attempts
- Set up email alerts for critical events
- Archive important events
Troubleshooting
Common Issues and Solutions
Issue: Cameras not connecting
Solutions:
- Verify camera IP addresses and network accessibility
- Check camera credentials and RTSP URLs
- Ensure cameras support ONVIF or compatible protocols
- Verify network connectivity between Bluecherry and cameras
- Check firewall rules and port forwarding
- Review Bluecherry logs for connection errors
Issue: Recording not working
Troubleshooting:
- Verify recording is enabled for camera
- Check disk space availability
- Verify permissions on recordings directory
- Ensure motion detection is configured if using motion-triggered recording
- Check CPU and memory usage
- Review error logs for database issues
Issue: High CPU or memory usage
Solutions:
- Reduce number of concurrent streams
- Lower camera resolution and frame rates
- Reduce video quality settings
- Limit number of recording threads
- Close unused connections
- Monitor for stuck processes in logs
Issue: Cannot access web interface
Troubleshooting:
- Verify Klutch.sh app is running
- Check network connectivity
- Verify domain DNS resolution
- Clear browser cache and cookies
- Check firewall rules
- Review access logs for blocked connections
Issue: Email alerts not sending
Solutions:
- Verify SMTP server configuration
- Check SMTP credentials
- Verify from email address is valid
- Check firewall rules for SMTP port access
- Review mail logs for errors
- Test SMTP connection with telnet
Updating Bluecherry
To update Bluecherry to a newer version:
- Read the release notes and changelog
- Backup your database and recordings
- Update your Dockerfile:
RUN curl -fsSL https://install.bluecherrydvr.com/docker | bash
- Commit and push to GitHub
- Klutch.sh will automatically rebuild
- Test camera connections after upgrade
- Verify recording functionality
- Monitor logs for any issues
Use Cases
Small Business Security
- Monitor retail store or office
- Motion detection for break-ins
- Email alerts for suspicious activity
Property Management
- Monitor multiple properties
- Record activity for liability
- Multi-site centralized management
Home Security
- Protect residential property
- Monitor entry points
- Local storage and control
Event Venues
- Monitor public spaces
- Record events
- Real-time security monitoring
Vehicle Tracking
- Monitor parking areas
- License plate recognition
- Access control verification
Additional Resources
- Bluecherry GitHub Repository - Source code and community contributions
- Bluecherry Official Website - Project information and downloads
- Bluecherry Community Forums - Community support and discussions
- Bluecherry Discord Community - Real-time community chat
- Bluecherry Client Repository - Desktop and mobile client source code
- Klutch.sh Getting Started Guide
- Klutch.sh Volumes Documentation
- Klutch.sh Custom Domains Guide
Conclusion
Deploying Bluecherry on Klutch.sh provides you with a professional, open-source video surveillance system that maintains complete control over your security infrastructure. With unlimited camera support, ONVIF compatibility, efficient resource usage, comprehensive recording capabilities, granular access control, and powerful event management, Bluecherry enables you to build a surveillance system tailored to your specific needs. Klutch.sh’s managed infrastructure ensures your surveillance system is always available, secure, and performant, allowing you to focus on monitoring and protecting what matters most.
Start securing your property or business today by deploying Bluecherry on Klutch.sh and experience professional-grade surveillance with the freedom and flexibility of open-source software.