🔥 Tremora del Terra: ultimate hmac-file-server fix – final push before the drop 💾🔐

This commit is contained in:
2025-07-18 16:14:24 +00:00
parent e57a3bbe27
commit 2ec4891c1f
2 changed files with 109 additions and 76 deletions

View File

@ -1,4 +1,4 @@
# HMAC File Server 3.2 Tremora del Terra # HMAC File Server 3.2 - Tremora del Terra
[![Version](https://img.shields.io/badge/version-3.2-blue.svg)](https://github.com/PlusOne/hmac-file-server) [![Version](https://img.shields.io/badge/version-3.2-blue.svg)](https://github.com/PlusOne/hmac-file-server)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
@ -19,7 +19,7 @@ A high-performance, secure file server implementing XEP-0363 (HTTP File Upload)
### Enhanced Performance ### Enhanced Performance
- **Fixed Deduplication**: Existing files return success instead of "file not found" - **Fixed Deduplication**: Existing files return success instead of "file not found"
- **Queue Optimization**: Doubled capacity (50100), faster scaling (80%40% threshold) - **Queue Optimization**: Doubled capacity (50 to 100), faster scaling (80% to 40% threshold)
- **Extended Timeouts**: 4800s defaults for large file reliability - **Extended Timeouts**: 4800s defaults for large file reliability
- **Session Persistence**: 60-minute timeouts for enterprise transfers - **Session Persistence**: 60-minute timeouts for enterprise transfers
@ -61,23 +61,23 @@ chmod +x hmac-file-server-linux-amd64
## Table of Contents ## Table of Contents
- [Release Information](#-release-information) - [Release Information](#release-information)
- [Configuration Generation](#-configuration-generation) - [Configuration Generation](#configuration-generation)
- [Configuration Documentation](#-configuration-documentation) - [Configuration Documentation](#configuration-documentation)
- [Build Options](#-build-options) - [Build Options](#build-options)
- [Docker Compose Examples](#-docker-compose-examples) - [Docker Compose Examples](#docker-compose-examples)
- [Nginx Reverse Proxy](#-nginx-reverse-proxy) - [Nginx Reverse Proxy](#nginx-reverse-proxy)
- [Apache2 Reverse Proxy](#-apache2-reverse-proxy) - [Apache2 Reverse Proxy](#apache2-reverse-proxy)
- [Prosody XMPP Integration](#-prosody-xmpp-integration) - [Prosody XMPP Integration](#prosody-xmpp-integration)
- [Ejabberd XMPP Integration](#-ejabberd-xmpp-integration) - [Ejabberd XMPP Integration](#ejabberd-xmpp-integration)
- [XEP-0363 Implementation](#-xep-0363-implementation) - [XEP-0363 Implementation](#xep-0363-implementation)
- [API Versions (V1, V2, V3)](#-api-versions) - [API Versions (V1, V2, V3)](#api-versions)
--- ---
## Release Information ## Release Information
### HMAC File Server 3.2 Tremora del Terra ### HMAC File Server 3.2 - Tremora del Terra
**Release Date**: July 18, 2025 **Release Date**: July 18, 2025
**Codename**: Tremora del Terra (powerful, balanced, ready to shake the ground) **Codename**: Tremora del Terra (powerful, balanced, ready to shake the ground)
@ -1541,4 +1541,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
--- ---
*HMAC File Server 3.2 "Tremora del Terra" Where enterprise power meets user simplicity* *HMAC File Server 3.2 "Tremora del Terra" - Where enterprise power meets user simplicity*

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# HMAC File Server Installer Script # HMAC File Server Installer Script
# Version: 3.2 # Version: 3.2 "Tremora del Terra"
# Compatible with systemd Linux distributions # Compatible with systemd Linux distributions
set -e set -e
@ -36,7 +36,7 @@ DEFAULT_METRICS_PORT="9090"
# Help function # Help function
show_help() { show_help() {
echo -e "${BLUE}HMAC File Server 3.2 Installer${NC}" echo -e "${BLUE}HMAC File Server 3.2 'Tremora del Terra' Installer${NC}"
echo "" echo ""
echo "Usage: $0 [OPTION]" echo "Usage: $0 [OPTION]"
echo "" echo ""
@ -62,6 +62,12 @@ show_help() {
echo " - Native: Traditional systemd service installation" echo " - Native: Traditional systemd service installation"
echo " - Docker: Container-based deployment with docker-compose" echo " - Docker: Container-based deployment with docker-compose"
echo "" echo ""
echo "New in 3.2 'Tremora del Terra':"
echo " - 93% Configuration Reduction: Simplified setup with intelligent defaults"
echo " - Enhanced Worker Scaling: Optimized 40%/10% thresholds"
echo " - Extended Timeouts: 4800s defaults for large file reliability"
echo " - Multi-Architecture Support: Native AMD64, ARM64, ARM32v7 builds"
echo ""
echo "For XMPP operators: This installer is optimized for easy integration" echo "For XMPP operators: This installer is optimized for easy integration"
echo "with Prosody, Ejabberd, and other XMPP servers." echo "with Prosody, Ejabberd, and other XMPP servers."
echo "" echo ""
@ -81,13 +87,14 @@ echo -e "${BLUE} / __ \\/ __ \`__ \\/ __ \`/ ___/_____/ /_/ / / _ \\______/ ___
echo -e "${BLUE} / / / / / / / / / /_/ / /__/_____/ __/ / / __/_____(__ ) __/ / | |/ / __/ / ${NC}" echo -e "${BLUE} / / / / / / / / / /_/ / /__/_____/ __/ / / __/_____(__ ) __/ / | |/ / __/ / ${NC}"
echo -e "${BLUE}/_/ /_/_/ /_/ /_/\\__,_/\\___/ /_/ /_/_/\\___/ /____/\\___/_/ |___/\\___/_/ ${NC}" echo -e "${BLUE}/_/ /_/_/ /_/ /_/\\__,_/\\___/ /_/ /_/_/\\___/ /____/\\___/_/ |___/\\___/_/ ${NC}"
echo "" echo ""
echo -e "${BLUE} HMAC File Server 3.2 Installer${NC}" echo -e "${BLUE} HMAC File Server 3.2 'Tremora del Terra' Installer${NC}"
echo -e "${BLUE} Professional XMPP Integration${NC}" echo -e "${BLUE} Professional XMPP Integration${NC}"
echo "" echo ""
echo -e "${YELLOW}--------------------------------------------------------------------------------${NC}" echo -e "${YELLOW}--------------------------------------------------------------------------------${NC}"
echo -e "${GREEN} Secure File Uploads & Downloads JWT & HMAC Authentication${NC}" echo -e "${GREEN} 93% Config Reduction Extended 4800s Timeouts${NC}"
echo -e "${GREEN} Enhanced Worker Scaling (40/10) Multi-Architecture Support${NC}"
echo -e "${GREEN} Prometheus Metrics Integration ClamAV Virus Scanning${NC}" echo -e "${GREEN} Prometheus Metrics Integration ClamAV Virus Scanning${NC}"
echo -e "${GREEN} Redis Cache & Session Management Chunked Upload/Download Support${NC}" echo -e "${GREEN} Redis Cache & Session Management JWT & HMAC Authentication${NC}"
echo -e "${YELLOW}--------------------------------------------------------------------------------${NC}" echo -e "${YELLOW}--------------------------------------------------------------------------------${NC}"
echo "" echo ""
@ -512,34 +519,45 @@ build_server() {
# Generate configuration file # Generate configuration file
generate_config() { generate_config() {
echo -e "${YELLOW}Generating configuration file...${NC}" echo -e "${YELLOW}Generating configuration file...${NC}"
echo -e "${BLUE}Note: This installer creates a comprehensive config. For minimal configs, use: ./hmac-file-server -genconfig${NC}"
cat > "$CONFIG_DIR/config.toml" << EOF cat > "$CONFIG_DIR/config.toml" << EOF
# HMAC File Server Configuration # HMAC File Server 3.2 "Tremora del Terra" Configuration
# Generated by installer on $(date) # Generated by installer on $(date)
[server] [server]
bind_ip = "0.0.0.0" listen_address = "$SERVER_PORT"
listenport = "$SERVER_PORT" storage_path = "$DATA_DIR/uploads"
unixsocket = false metrics_enabled = true
storagepath = "$DATA_DIR/uploads" metrics_port = "$METRICS_PORT"
metricsenabled = true deduplication_enabled = true
metricsport = "$METRICS_PORT" file_naming = "original"
deduplicationenabled = true force_protocol = ""
deduplicationpath = "$DATA_DIR/deduplication" pid_file = "$DATA_DIR/runtime/hmac-file-server.pid"
filenaming = "HMAC" max_upload_size = "10GB"
force_protocol = "auto" max_header_bytes = 1048576
pidfilepath = "$DATA_DIR/runtime/hmac-file-server.pid" cleanup_interval = "24h"
max_file_age = "720h"
# Enhanced Worker Scaling (3.2 features)
enable_dynamic_workers = true
worker_scale_up_thresh = 40
worker_scale_down_thresh = 10
# Caching and performance
pre_cache = true
pre_cache_workers = 4
pre_cache_interval = "1h"
min_free_bytes = "1GB"
EOF EOF
if [[ $ENABLE_TLS == "true" ]]; then if [[ $ENABLE_TLS == "true" ]]; then
cat >> "$CONFIG_DIR/config.toml" << EOF cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = true
sslcert = "$SSL_CERT" [tls]
sslkey = "$SSL_KEY" enabled = true
EOF cert_file = "$SSL_CERT"
else key_file = "$SSL_KEY"
cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = false
EOF EOF
fi fi
@ -561,35 +579,44 @@ EOF
cat >> "$CONFIG_DIR/config.toml" << EOF cat >> "$CONFIG_DIR/config.toml" << EOF
[uploads] [uploads]
allowedextensions = [".txt", ".pdf", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".zip", ".tar", ".gz", ".7z", ".mp4", ".webm", ".ogg", ".mp3", ".wav", ".flac", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".ods", ".odp"] allowed_extensions = [".txt", ".pdf", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".zip", ".tar", ".gz", ".7z", ".mp4", ".webm", ".ogg", ".mp3", ".wav", ".flac", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".ods", ".odp"]
maxfilesize = "100MB" chunked_uploads_enabled = true
chunkeduploadsenabled = true chunk_size = "10MB"
chunksize = "10MB" resumable_uploads_enabled = true
ttlenabled = false max_resumable_age = "48h"
ttl = "168h" sessiontimeout = "60m"
maxretries = 3
[downloads] [downloads]
chunkeddownloadsenabled = true chunked_downloads_enabled = true
chunksize = "10MB" chunk_size = "10MB"
resumable_downloads_enabled = true
[deduplication]
enabled = true
directory = "$DATA_DIR/deduplication"
maxsize = "1GB"
[logging] [logging]
level = "INFO" level = "info"
file = "$DEFAULT_LOG_DIR/hmac-file-server.log" file = "$DEFAULT_LOG_DIR/hmac-file-server.log"
max_size = 100 max_size = 100
max_backups = 3 max_backups = 7
max_age = 30 max_age = 30
compress = true compress = true
[workers] [workers]
numworkers = 10 numworkers = 4
uploadqueuesize = 1000 uploadqueuesize = 100
autoscaling = true
[timeouts] [timeouts]
readtimeout = "30s" readtimeout = "4800s"
writetimeout = "30s" writetimeout = "4800s"
idletimeout = "120s" idletimeout = "4800s"
shutdown = "30s" shutdown = "30s"
[build]
version = "3.2"
EOF EOF
if [[ $ENABLE_CLAMAV == "true" ]]; then if [[ $ENABLE_CLAMAV == "true" ]]; then
@ -817,32 +844,38 @@ generate_docker_config() {
echo -e "${YELLOW}Generating Docker configuration file...${NC}" echo -e "${YELLOW}Generating Docker configuration file...${NC}"
cat > "$CONFIG_DIR/config.toml" << EOF cat > "$CONFIG_DIR/config.toml" << EOF
# HMAC File Server Configuration for Docker # HMAC File Server 3.2 "Tremora del Terra" Configuration for Docker
# Generated by installer on $(date) # Generated by installer on $(date)
[server] [server]
bind_ip = "0.0.0.0" listen_address = "$SERVER_PORT"
listenport = "$SERVER_PORT" storage_path = "/var/lib/hmac-file-server/uploads"
unixsocket = false metrics_enabled = true
storagepath = "/var/lib/hmac-file-server/uploads" metrics_port = "$METRICS_PORT"
metricsenabled = true deduplication_enabled = true
metricsport = "$METRICS_PORT" file_naming = "original"
deduplicationenabled = true force_protocol = ""
deduplicationpath = "/var/lib/hmac-file-server/deduplication" pid_file = "/tmp/hmac-file-server/hmac-file-server.pid"
filenaming = "HMAC" max_upload_size = "10GB"
force_protocol = "auto"
pidfilepath = "/tmp/hmac-file-server/hmac-file-server.pid" # Enhanced Worker Scaling (3.2 features)
enable_dynamic_workers = true
worker_scale_up_thresh = 40
worker_scale_down_thresh = 10
# Caching and performance
pre_cache = true
pre_cache_workers = 4
min_free_bytes = "1GB"
EOF EOF
if [[ $ENABLE_TLS == "true" ]]; then if [[ $ENABLE_TLS == "true" ]]; then
cat >> "$CONFIG_DIR/config.toml" << EOF cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = true
sslcert = "$SSL_CERT" [tls]
sslkey = "$SSL_KEY" enabled = true
EOF cert_file = "$SSL_CERT"
else key_file = "$SSL_KEY"
cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = false
EOF EOF
fi fi
@ -1431,7 +1464,7 @@ uninstall() {
# Find upload directory from config if it exists # Find upload directory from config if it exists
if [[ -f "$DEFAULT_CONFIG_DIR/config.toml" ]]; then if [[ -f "$DEFAULT_CONFIG_DIR/config.toml" ]]; then
UPLOAD_DIR=$(grep -E "^storagepath\s*=" "$DEFAULT_CONFIG_DIR/config.toml" 2>/dev/null | sed 's/.*=\s*"*\([^"]*\)"*.*/\1/' | xargs) UPLOAD_DIR=$(grep -E "^storage_path\s*=" "$DEFAULT_CONFIG_DIR/config.toml" 2>/dev/null | sed 's/.*=\s*"*\([^"]*\)"*.*/\1/' | xargs)
DEDUP_DIR=$(grep -E "^directory\s*=" "$DEFAULT_CONFIG_DIR/config.toml" 2>/dev/null | sed 's/.*=\s*"*\([^"]*\)"*.*/\1/' | xargs) DEDUP_DIR=$(grep -E "^directory\s*=" "$DEFAULT_CONFIG_DIR/config.toml" 2>/dev/null | sed 's/.*=\s*"*\([^"]*\)"*.*/\1/' | xargs)
fi fi