Fix production config: use simple cache instead of Redis, fix Gunicorn to use production config
This commit is contained in:
284
old_code_documentation/DOCKER.md
Normal file
284
old_code_documentation/DOCKER.md
Normal file
@@ -0,0 +1,284 @@
|
||||
# Docker Deployment Guide
|
||||
|
||||
## Overview
|
||||
|
||||
DigiServer v2 Docker image features:
|
||||
- **Base image size**: ~400MB (optimized)
|
||||
- **Full HD media support**: Images, videos, PDFs
|
||||
- **Optional LibreOffice**: Install on-demand for PPTX support (+500MB)
|
||||
- **Auto-initialization**: Database and admin user created on first run
|
||||
- **Non-root user**: Runs as `appuser` (UID 1000) for security
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Build and Run with Docker Compose
|
||||
|
||||
```bash
|
||||
# Build the Docker image
|
||||
docker-compose build
|
||||
|
||||
# Start the container
|
||||
docker-compose up -d
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Stop the container
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
The application will be available at `http://localhost:5000`
|
||||
|
||||
Default credentials:
|
||||
- Username: `admin`
|
||||
- Password: `admin123`
|
||||
|
||||
### 2. Build Docker Image Only
|
||||
|
||||
```bash
|
||||
# Build the image
|
||||
docker build -t digiserver-v2:latest .
|
||||
|
||||
# Run the container
|
||||
docker run -d \
|
||||
-p 5000:5000 \
|
||||
-v $(pwd)/instance:/app/instance \
|
||||
-v $(pwd)/app/static/uploads:/app/app/static/uploads \
|
||||
--name digiserver \
|
||||
digiserver-v2:latest
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Create a `.env` file based on `.env.example`:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Edit the `.env` file to set your configuration:
|
||||
- `SECRET_KEY`: Change to a random secret key
|
||||
- `FLASK_ENV`: Set to `production` for production deployments
|
||||
|
||||
### Persistent Data
|
||||
|
||||
The following directories are mounted as volumes:
|
||||
- `./instance`: Database storage
|
||||
- `./app/static/uploads`: Uploaded media files
|
||||
|
||||
These persist even when containers are recreated.
|
||||
|
||||
## Production Deployment
|
||||
|
||||
### 1. Using Docker Compose (Recommended)
|
||||
|
||||
```bash
|
||||
# Create .env file with production settings
|
||||
cp .env.example .env
|
||||
nano .env # Edit with your settings
|
||||
|
||||
# Start in production mode
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 2. Behind a Reverse Proxy (Nginx/Traefik)
|
||||
|
||||
Example Nginx configuration:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name yourdomain.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:5000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# For large file uploads
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Enable Redis Caching (Optional)
|
||||
|
||||
Uncomment the Redis service in `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: digiserver-redis
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
|
||||
volumes:
|
||||
redis-data:
|
||||
```
|
||||
|
||||
Update `.env`:
|
||||
```
|
||||
REDIS_URL=redis://redis:6379/0
|
||||
```
|
||||
|
||||
## Backup
|
||||
|
||||
### Database Backup
|
||||
|
||||
```bash
|
||||
# Backup database
|
||||
docker exec digiserver tar -czf /tmp/backup.tar.gz /app/instance
|
||||
docker cp digiserver:/tmp/backup.tar.gz ./backup-$(date +%Y%m%d).tar.gz
|
||||
```
|
||||
|
||||
### Full Backup (Database + Uploads)
|
||||
|
||||
```bash
|
||||
# Backup everything
|
||||
tar -czf digiserver-backup-$(date +%Y%m%d).tar.gz instance/ app/static/uploads/
|
||||
```
|
||||
|
||||
## Maintenance
|
||||
|
||||
### View Logs
|
||||
|
||||
```bash
|
||||
# All logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Last 100 lines
|
||||
docker-compose logs --tail=100
|
||||
|
||||
# Specific service
|
||||
docker-compose logs -f digiserver
|
||||
```
|
||||
|
||||
### Update Application
|
||||
|
||||
```bash
|
||||
# Pull latest code
|
||||
git pull
|
||||
|
||||
# Rebuild and restart
|
||||
docker-compose down
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Shell Access
|
||||
|
||||
```bash
|
||||
# Access container shell
|
||||
docker-compose exec digiserver bash
|
||||
|
||||
# Or with docker directly
|
||||
docker exec -it digiserver bash
|
||||
```
|
||||
|
||||
### Installing Optional Dependencies
|
||||
|
||||
**LibreOffice for PowerPoint Support:**
|
||||
|
||||
```bash
|
||||
# Method 1: Via Web UI (Recommended)
|
||||
# Navigate to Admin Panel → System Dependencies
|
||||
# Click "Install LibreOffice" button
|
||||
|
||||
# Method 2: Via Docker exec
|
||||
docker exec -it digiserver bash
|
||||
sudo /app/install_libreoffice.sh
|
||||
exit
|
||||
|
||||
# Verify installation
|
||||
docker exec digiserver libreoffice --version
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Port Already in Use
|
||||
|
||||
Change the port mapping in `docker-compose.yml`:
|
||||
```yaml
|
||||
ports:
|
||||
- "8080:5000" # Change 8080 to your desired port
|
||||
```
|
||||
|
||||
### Permission Issues
|
||||
|
||||
Ensure the volumes have correct permissions:
|
||||
```bash
|
||||
sudo chown -R 1000:1000 instance/ app/static/uploads/
|
||||
```
|
||||
|
||||
### Container Won't Start
|
||||
|
||||
Check logs:
|
||||
```bash
|
||||
docker-compose logs digiserver
|
||||
```
|
||||
|
||||
### Reset Database
|
||||
|
||||
```bash
|
||||
# Stop containers
|
||||
docker-compose down
|
||||
|
||||
# Remove database
|
||||
rm instance/*.db
|
||||
|
||||
# Start fresh
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## System Requirements
|
||||
|
||||
### Base Image
|
||||
- Docker 20.10+
|
||||
- Docker Compose 2.0+
|
||||
- 1GB RAM minimum (2GB recommended)
|
||||
- 5GB disk space (base + uploads)
|
||||
|
||||
### With LibreOffice (Optional)
|
||||
- 2GB RAM recommended
|
||||
- 10GB disk space (includes LibreOffice + media)
|
||||
|
||||
## Security Recommendations
|
||||
|
||||
1. **Change default credentials** immediately after first login
|
||||
2. **Set a strong SECRET_KEY** in `.env`
|
||||
3. **Use HTTPS** with a reverse proxy in production
|
||||
4. **Regular backups** of database and uploads
|
||||
5. **Update regularly** to get security patches
|
||||
6. **Restrict network access** using firewall rules
|
||||
7. **Monitor logs** for suspicious activity
|
||||
|
||||
## Performance Tuning
|
||||
|
||||
### Adjust Workers
|
||||
|
||||
Edit `Dockerfile` CMD line:
|
||||
```dockerfile
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "8", "--timeout", "120", "app.app:create_app()"]
|
||||
```
|
||||
|
||||
### Resource Limits
|
||||
|
||||
Add to `docker-compose.yml`:
|
||||
```yaml
|
||||
services:
|
||||
digiserver:
|
||||
# ... existing config ...
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '1'
|
||||
memory: 1G
|
||||
```
|
||||
258
old_code_documentation/OPTIONAL_DEPENDENCIES.md
Normal file
258
old_code_documentation/OPTIONAL_DEPENDENCIES.md
Normal file
@@ -0,0 +1,258 @@
|
||||
# Optional Dependencies Guide
|
||||
|
||||
DigiServer v2 uses an optimized dependency installation strategy to minimize Docker image size while maintaining full functionality.
|
||||
|
||||
## Overview
|
||||
|
||||
The base Docker image (~400MB) includes only essential dependencies:
|
||||
- **Poppler Utils** - PDF to image conversion
|
||||
- **FFmpeg** - Video processing and validation
|
||||
- **Python 3.13** - Application runtime
|
||||
|
||||
Optional dependencies can be installed on-demand:
|
||||
- **LibreOffice** (~500MB) - PowerPoint (PPTX/PPT) to image conversion
|
||||
|
||||
## Why Optional Dependencies?
|
||||
|
||||
By excluding LibreOffice from the base image, we reduce:
|
||||
- **Initial image size**: From ~900MB to ~400MB (56% reduction)
|
||||
- **Download time**: Faster deployments
|
||||
- **Storage requirements**: Lower disk usage on hosts
|
||||
|
||||
Users who don't need PowerPoint conversion benefit from a smaller, faster image.
|
||||
|
||||
## Installation Methods
|
||||
|
||||
### 1. Web UI (Recommended)
|
||||
|
||||
The easiest way to install LibreOffice:
|
||||
|
||||
1. Log in to DigiServer admin panel
|
||||
2. Navigate to **Admin Panel** → **System Dependencies**
|
||||
3. Click **"Install LibreOffice"** button
|
||||
4. Wait 2-5 minutes for installation
|
||||
5. Refresh the page to verify installation
|
||||
|
||||
The web interface provides:
|
||||
- Real-time installation status
|
||||
- Version verification
|
||||
- Error reporting
|
||||
- No terminal access needed
|
||||
|
||||
### 2. Docker Exec (Manual)
|
||||
|
||||
For Docker deployments, use `docker exec`:
|
||||
|
||||
```bash
|
||||
# Enter the container
|
||||
docker exec -it digiserver bash
|
||||
|
||||
# Run the installation script
|
||||
sudo /app/install_libreoffice.sh
|
||||
|
||||
# Verify installation
|
||||
libreoffice --version
|
||||
```
|
||||
|
||||
### 3. Direct Installation (Non-Docker)
|
||||
|
||||
For bare-metal or VM deployments:
|
||||
|
||||
```bash
|
||||
# Make script executable (if not already)
|
||||
chmod +x /srv/digiserver-v2/install_libreoffice.sh
|
||||
|
||||
# Run the installation script
|
||||
sudo /srv/digiserver-v2/install_libreoffice.sh
|
||||
|
||||
# Verify installation
|
||||
libreoffice --version
|
||||
```
|
||||
|
||||
## Checking Dependency Status
|
||||
|
||||
### Web Interface
|
||||
|
||||
Navigate to **Admin Panel** → **System Dependencies** to see:
|
||||
- ✅ LibreOffice: Installed or ❌ Not installed
|
||||
- ✅ Poppler Utils: Installed (always present)
|
||||
- ✅ FFmpeg: Installed (always present)
|
||||
|
||||
### Command Line
|
||||
|
||||
Check individual dependencies:
|
||||
|
||||
```bash
|
||||
# LibreOffice
|
||||
libreoffice --version
|
||||
|
||||
# Poppler
|
||||
pdftoppm -v
|
||||
|
||||
# FFmpeg
|
||||
ffmpeg -version
|
||||
```
|
||||
|
||||
## File Type Support Matrix
|
||||
|
||||
| File Type | Required Dependency | Status |
|
||||
|-----------|-------------------|---------|
|
||||
| **Images** (JPG, PNG, GIF) | None | Always supported |
|
||||
| **PDF** | Poppler Utils | Always available |
|
||||
| **Videos** (MP4, AVI, MOV) | FFmpeg | Always available |
|
||||
| **PowerPoint** (PPTX, PPT) | LibreOffice | Optional install |
|
||||
|
||||
## Upload Behavior
|
||||
|
||||
### Without LibreOffice
|
||||
|
||||
When you try to upload a PowerPoint file without LibreOffice:
|
||||
- Upload will be **rejected**
|
||||
- Error message: *"LibreOffice is not installed. Please install it from the Admin Panel → System Dependencies to upload PowerPoint files."*
|
||||
- Other file types (PDF, images, videos) work normally
|
||||
|
||||
### With LibreOffice
|
||||
|
||||
After installation:
|
||||
- PowerPoint files are converted to high-quality PNG images
|
||||
- Each slide becomes a separate media item
|
||||
- Slides maintain aspect ratio and resolution
|
||||
- Original PPTX file is deleted after conversion
|
||||
|
||||
## Technical Details
|
||||
|
||||
### Installation Script
|
||||
|
||||
The `install_libreoffice.sh` script:
|
||||
1. Checks for root/sudo privileges
|
||||
2. Verifies if LibreOffice is already installed
|
||||
3. Updates apt package cache
|
||||
4. Installs `libreoffice` and `libreoffice-impress`
|
||||
5. Verifies successful installation
|
||||
6. Reports version and status
|
||||
|
||||
### Docker Implementation
|
||||
|
||||
The Dockerfile includes:
|
||||
- Sudo access for `appuser` to run installation script
|
||||
- Script permissions set during build
|
||||
- No LibreOffice in base layers (smaller image)
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- Installation requires sudo/root access
|
||||
- In Docker, `appuser` has limited sudo rights (only for installation script)
|
||||
- Installation script validates LibreOffice binary after install
|
||||
- No external downloads except from official apt repositories
|
||||
|
||||
## Installation Time
|
||||
|
||||
Typical installation times:
|
||||
- **Fast network** (100+ Mbps): 2-3 minutes
|
||||
- **Average network** (10-100 Mbps): 3-5 minutes
|
||||
- **Slow network** (<10 Mbps): 5-10 minutes
|
||||
|
||||
The installation downloads approximately 450-500MB of packages.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Installation Fails
|
||||
|
||||
**Error**: "Permission denied"
|
||||
- **Solution**: Ensure script has execute permissions (`chmod +x`)
|
||||
- **Docker**: Check sudoers configuration in Dockerfile
|
||||
|
||||
**Error**: "Unable to locate package"
|
||||
- **Solution**: Run `sudo apt-get update` first
|
||||
- **Docker**: Rebuild image with fresh apt cache
|
||||
|
||||
### Installation Hangs
|
||||
|
||||
- Check internet connectivity
|
||||
- Verify apt repositories are accessible
|
||||
- In Docker, check container has network access
|
||||
- Increase timeout if on slow connection
|
||||
|
||||
### Verification Fails
|
||||
|
||||
**Symptom**: Installation completes but LibreOffice not found
|
||||
- **Solution**: Check LibreOffice was installed to expected path
|
||||
- Run: `which libreoffice` to locate binary
|
||||
- Verify with: `libreoffice --version`
|
||||
|
||||
### Upload Still Fails After Installation
|
||||
|
||||
1. Verify installation: Admin Panel → System Dependencies
|
||||
2. Check server logs for conversion errors
|
||||
3. Restart application: `docker restart digiserver` (Docker) or restart Flask
|
||||
4. Try uploading a simple PPTX file to test
|
||||
|
||||
## Uninstallation
|
||||
|
||||
To remove LibreOffice and reclaim space:
|
||||
|
||||
```bash
|
||||
# In container or host
|
||||
sudo apt-get remove --purge libreoffice libreoffice-impress
|
||||
sudo apt-get autoremove
|
||||
sudo apt-get clean
|
||||
```
|
||||
|
||||
This frees approximately 500MB of disk space.
|
||||
|
||||
## Production Recommendations
|
||||
|
||||
### When to Install LibreOffice
|
||||
|
||||
Install LibreOffice if:
|
||||
- Users need to upload PowerPoint presentations
|
||||
- You have >1GB free disk space
|
||||
- Network bandwidth supports 500MB download
|
||||
|
||||
### When to Skip LibreOffice
|
||||
|
||||
Skip LibreOffice if:
|
||||
- Only using PDF, images, and videos
|
||||
- Disk space is constrained (<2GB)
|
||||
- Want minimal installation footprint
|
||||
- Can convert PPTX to PDF externally
|
||||
|
||||
### Multi-Container Deployments
|
||||
|
||||
For multiple instances:
|
||||
- **Option A**: Create custom image with LibreOffice pre-installed
|
||||
- **Option B**: Install on each container individually
|
||||
- **Option C**: Use shared volume for LibreOffice binaries
|
||||
|
||||
## FAQ
|
||||
|
||||
**Q: Will removing LibreOffice break existing media?**
|
||||
A: No, converted slides remain as PNG images after conversion.
|
||||
|
||||
**Q: Can I pre-install LibreOffice in the Docker image?**
|
||||
A: Yes, uncomment the `libreoffice` line in Dockerfile and rebuild.
|
||||
|
||||
**Q: How much space does LibreOffice use?**
|
||||
A: Approximately 450-500MB installed.
|
||||
|
||||
**Q: Does LibreOffice run during conversion?**
|
||||
A: Yes, in headless mode. It converts slides to PNG without GUI.
|
||||
|
||||
**Q: Can I use other presentation converters?**
|
||||
A: The code currently only supports LibreOffice. Custom converters require code changes.
|
||||
|
||||
**Q: Is LibreOffice safe for production?**
|
||||
A: Yes, LibreOffice is widely used in production environments for document conversion.
|
||||
|
||||
## Support
|
||||
|
||||
For issues with optional dependencies:
|
||||
1. Check the **System Dependencies** page in Admin Panel
|
||||
2. Review server logs: `docker logs digiserver`
|
||||
3. Verify system requirements (disk space, memory)
|
||||
4. Consult DOCKER.md for container-specific guidance
|
||||
|
||||
## Version History
|
||||
|
||||
- **v2.0**: Introduced optional LibreOffice installation
|
||||
- **v1.0**: LibreOffice included in base image (larger size)
|
||||
297
old_code_documentation/README.md
Normal file
297
old_code_documentation/README.md
Normal file
@@ -0,0 +1,297 @@
|
||||
# DigiServer v2
|
||||
|
||||
Digital Signage Management System - A modern Flask-based application for managing content playlists across multiple display screens.
|
||||
|
||||
## Features
|
||||
|
||||
- 📺 **Multi-Player Management** - Control multiple display screens from one interface
|
||||
- 🎬 **Playlist System** - Create and manage content playlists with drag-and-drop reordering
|
||||
- 📁 **Media Library** - Upload and organize images, videos, PDFs, and presentations
|
||||
- 📄 **PDF to Image Conversion** - Automatic conversion of PDF pages to Full HD images (300 DPI)
|
||||
- 📊 **PowerPoint Support** - Convert PPTX slides to images automatically (optional LibreOffice install)
|
||||
- 🖼️ **Live Preview** - Real-time content preview for each player
|
||||
- ⚡ **Real-time Updates** - Players automatically sync with playlist changes
|
||||
- 🌓 **Dark Mode** - Full dark mode support across all interfaces
|
||||
- 🗑️ **Media Management** - Clean up unused media files with leftover media manager
|
||||
- 🔧 **Optional Dependencies** - Install LibreOffice on-demand to reduce base image size by 56%
|
||||
- 🔒 **User Authentication** - Secure admin access with role-based permissions
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Option 1: Docker (Recommended)
|
||||
|
||||
```bash
|
||||
# Quick start with Docker
|
||||
./docker-start.sh
|
||||
```
|
||||
|
||||
Access at: `http://localhost:5000`
|
||||
|
||||
Default credentials: `admin` / `admin123`
|
||||
|
||||
See [DOCKER.md](DOCKER.md) for detailed Docker documentation.
|
||||
|
||||
### Option 2: Manual Installation
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- Python 3.13+
|
||||
- Poppler Utils (for PDF conversion) - **Required**
|
||||
- FFmpeg (for video processing) - **Required**
|
||||
- LibreOffice (for PPTX conversion) - **Optional** (can be installed via Admin Panel)
|
||||
|
||||
#### Installation
|
||||
|
||||
```bash
|
||||
# Install required system dependencies (Debian/Ubuntu)
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y poppler-utils ffmpeg libmagic1
|
||||
|
||||
# Optional: Install LibreOffice for PowerPoint conversion
|
||||
# OR install later via Admin Panel → System Dependencies
|
||||
sudo apt-get install -y libreoffice
|
||||
|
||||
# Create virtual environment
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate # On Windows: venv\Scripts\activate
|
||||
|
||||
# Install Python dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Initialize database
|
||||
python -c "
|
||||
from app.app import create_app
|
||||
from app.extensions import db, bcrypt
|
||||
from app.models import User
|
||||
|
||||
app = create_app()
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
hashed = bcrypt.generate_password_hash('admin123').decode('utf-8')
|
||||
admin = User(username='admin', password=hashed, role='admin')
|
||||
db.session.add(admin)
|
||||
db.session.commit()
|
||||
print('Admin user created')
|
||||
"
|
||||
|
||||
# Run development server
|
||||
./run_dev.sh
|
||||
```
|
||||
|
||||
Access at: `http://localhost:5000`
|
||||
|
||||
## Deployment
|
||||
|
||||
### Docker Deployment
|
||||
|
||||
```bash
|
||||
# Build and run with Docker Compose
|
||||
docker-compose up -d
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Stop
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
### Production Deployment
|
||||
|
||||
For production, use:
|
||||
- Gunicorn or uWSGI as WSGI server
|
||||
- Nginx as reverse proxy
|
||||
- Redis for caching (optional)
|
||||
- PostgreSQL for larger deployments (optional)
|
||||
|
||||
See [DOCKER.md](DOCKER.md) for detailed deployment instructions.
|
||||
|
||||
## Usage
|
||||
|
||||
### 1. Create a Playlist
|
||||
|
||||
1. Navigate to **Playlist Management**
|
||||
2. Fill in playlist details (name, orientation, description)
|
||||
3. Click **Create Playlist**
|
||||
|
||||
### 2. Upload Media
|
||||
|
||||
1. Go to **Upload Media** page
|
||||
2. Select files (images, videos, PDFs, PPTX)
|
||||
3. Choose media type and duration
|
||||
4. Select target playlist (optional)
|
||||
5. Click **Upload**
|
||||
|
||||
**Supported Formats:**
|
||||
- Images: JPG, PNG, GIF, BMP, WEBP
|
||||
- Videos: MP4, AVI, MOV, MKV, WEBM
|
||||
- Documents: PDF, PPT, PPTX
|
||||
|
||||
### 3. Manage Playlists
|
||||
|
||||
1. Open playlist management
|
||||
2. Drag and drop to reorder content
|
||||
3. Edit duration for each item
|
||||
4. Remove unwanted items
|
||||
5. Changes sync automatically to players
|
||||
|
||||
### 4. Assign to Players
|
||||
|
||||
1. Go to **Player Assignments**
|
||||
2. Select playlist from dropdown for each player
|
||||
3. View live preview to verify content
|
||||
|
||||
### 5. Clean Up Media
|
||||
|
||||
1. Navigate to **Admin** → **Manage Leftover Media**
|
||||
2. Review unused files
|
||||
3. Delete individual files or bulk delete by type
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Create a `.env` file:
|
||||
|
||||
```env
|
||||
FLASK_ENV=production
|
||||
SECRET_KEY=your-random-secret-key
|
||||
DATABASE_URL=sqlite:///instance/digiserver.db
|
||||
```
|
||||
|
||||
### Upload Settings
|
||||
|
||||
Edit `app/config.py` to adjust:
|
||||
- Upload folder location
|
||||
- Maximum file size
|
||||
- Allowed file extensions
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
digiserver-v2/
|
||||
├── app/
|
||||
│ ├── blueprints/ # Route handlers
|
||||
│ │ ├── admin.py # Admin panel routes
|
||||
│ │ ├── content.py # Content management
|
||||
│ │ ├── playlist.py # Playlist operations
|
||||
│ │ └── players.py # Player management
|
||||
│ ├── models/ # Database models
|
||||
│ ├── templates/ # HTML templates
|
||||
│ ├── static/ # CSS, JS, uploads
|
||||
│ └── utils/ # Helper functions
|
||||
├── instance/ # Database storage
|
||||
├── Dockerfile # Docker configuration
|
||||
├── docker-compose.yml # Docker Compose config
|
||||
└── requirements.txt # Python dependencies
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Player API
|
||||
- `GET /api/playlist/<player_id>` - Get player playlist
|
||||
- `POST /api/players/<player_id>/heartbeat` - Send heartbeat
|
||||
|
||||
### Admin API
|
||||
- `POST /playlist/<player_id>/update-duration/<content_id>` - Update content duration
|
||||
- `POST /playlist/<player_id>/reorder` - Reorder playlist items
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### PDF Conversion Fails
|
||||
Ensure poppler-utils is installed:
|
||||
```bash
|
||||
sudo apt-get install poppler-utils
|
||||
```
|
||||
|
||||
### PPTX Conversion Fails
|
||||
**Method 1: Via Web UI (Recommended)**
|
||||
1. Go to Admin Panel → System Dependencies
|
||||
2. Click "Install LibreOffice"
|
||||
3. Wait 2-5 minutes for installation
|
||||
|
||||
**Method 2: Manual Install**
|
||||
```bash
|
||||
sudo apt-get install libreoffice
|
||||
# OR use the provided script
|
||||
sudo ./install_libreoffice.sh
|
||||
```
|
||||
|
||||
See [OPTIONAL_DEPENDENCIES.md](OPTIONAL_DEPENDENCIES.md) for details.
|
||||
|
||||
### Upload Fails
|
||||
Check folder permissions:
|
||||
```bash
|
||||
chmod -R 755 app/static/uploads
|
||||
```
|
||||
|
||||
### Database Issues
|
||||
Reset database:
|
||||
```bash
|
||||
rm instance/*.db
|
||||
# Then reinitialize (see Installation)
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Running Tests
|
||||
```bash
|
||||
pytest
|
||||
```
|
||||
|
||||
### Code Formatting
|
||||
```bash
|
||||
black app/
|
||||
flake8 app/
|
||||
```
|
||||
|
||||
### Database Migrations
|
||||
```bash
|
||||
flask db migrate -m "Description"
|
||||
flask db upgrade
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Test thoroughly
|
||||
5. Submit a pull request
|
||||
|
||||
## License
|
||||
|
||||
This project is proprietary software. All rights reserved.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [DOCKER.md](DOCKER.md) - Docker deployment guide
|
||||
- [OPTIONAL_DEPENDENCIES.md](OPTIONAL_DEPENDENCIES.md) - Optional dependency installation
|
||||
- [PROGRESS.md](PROGRESS.md) - Development progress tracker
|
||||
- [KIVY_PLAYER_COMPATIBILITY.md](KIVY_PLAYER_COMPATIBILITY.md) - Player integration guide
|
||||
|
||||
## Support
|
||||
|
||||
For issues and questions:
|
||||
- Check [DOCKER.md](DOCKER.md) for deployment help
|
||||
- Review [OPTIONAL_DEPENDENCIES.md](OPTIONAL_DEPENDENCIES.md) for LibreOffice setup
|
||||
- Review troubleshooting section
|
||||
- Check application logs
|
||||
|
||||
## Version History
|
||||
|
||||
- **v2.1** - Optional LibreOffice installation
|
||||
- Reduced base Docker image by 56% (~900MB → ~400MB)
|
||||
- On-demand LibreOffice installation via Admin Panel
|
||||
- System Dependencies management page
|
||||
- Enhanced error messages for PPTX without LibreOffice
|
||||
|
||||
- **v2.0** - Complete rewrite with playlist-centric architecture
|
||||
- PDF to image conversion (300 DPI)
|
||||
- PPTX slide conversion
|
||||
- Leftover media management
|
||||
- Enhanced dark mode
|
||||
- Duration editing for all content types
|
||||
|
||||
---
|
||||
|
||||
Built with ❤️ using Flask, SQLAlchemy, and modern web technologies
|
||||
Reference in New Issue
Block a user