🔥 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,7 +1,7 @@
#!/bin/bash
# HMAC File Server Installer Script
# Version: 3.2
# Version: 3.2 "Tremora del Terra"
# Compatible with systemd Linux distributions
set -e
@ -36,7 +36,7 @@ DEFAULT_METRICS_PORT="9090"
# Help function
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 "Usage: $0 [OPTION]"
echo ""
@ -62,6 +62,12 @@ show_help() {
echo " - Native: Traditional systemd service installation"
echo " - Docker: Container-based deployment with docker-compose"
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 "with Prosody, Ejabberd, and other XMPP servers."
echo ""
@ -81,13 +87,14 @@ echo -e "${BLUE} / __ \\/ __ \`__ \\/ __ \`/ ___/_____/ /_/ / / _ \\______/ ___
echo -e "${BLUE} / / / / / / / / / /_/ / /__/_____/ __/ / / __/_____(__ ) __/ / | |/ / __/ / ${NC}"
echo -e "${BLUE}/_/ /_/_/ /_/ /_/\\__,_/\\___/ /_/ /_/_/\\___/ /____/\\___/_/ |___/\\___/_/ ${NC}"
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 ""
echo -e "${YELLOW}--------------------------------------------------------------------------------${NC}"
echo -e "${GREEN} Secure File Uploads & Downloads JWT & HMAC Authentication${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} 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} Redis Cache & Session Management JWT & HMAC Authentication${NC}"
echo -e "${YELLOW}--------------------------------------------------------------------------------${NC}"
echo ""
@ -512,34 +519,45 @@ build_server() {
# Generate configuration file
generate_config() {
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
# HMAC File Server Configuration
# HMAC File Server 3.2 "Tremora del Terra" Configuration
# Generated by installer on $(date)
[server]
bind_ip = "0.0.0.0"
listenport = "$SERVER_PORT"
unixsocket = false
storagepath = "$DATA_DIR/uploads"
metricsenabled = true
metricsport = "$METRICS_PORT"
deduplicationenabled = true
deduplicationpath = "$DATA_DIR/deduplication"
filenaming = "HMAC"
force_protocol = "auto"
pidfilepath = "$DATA_DIR/runtime/hmac-file-server.pid"
listen_address = "$SERVER_PORT"
storage_path = "$DATA_DIR/uploads"
metrics_enabled = true
metrics_port = "$METRICS_PORT"
deduplication_enabled = true
file_naming = "original"
force_protocol = ""
pid_file = "$DATA_DIR/runtime/hmac-file-server.pid"
max_upload_size = "10GB"
max_header_bytes = 1048576
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
if [[ $ENABLE_TLS == "true" ]]; then
cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = true
sslcert = "$SSL_CERT"
sslkey = "$SSL_KEY"
EOF
else
cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = false
[tls]
enabled = true
cert_file = "$SSL_CERT"
key_file = "$SSL_KEY"
EOF
fi
@ -561,35 +579,44 @@ EOF
cat >> "$CONFIG_DIR/config.toml" << EOF
[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"]
maxfilesize = "100MB"
chunkeduploadsenabled = true
chunksize = "10MB"
ttlenabled = false
ttl = "168h"
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"]
chunked_uploads_enabled = true
chunk_size = "10MB"
resumable_uploads_enabled = true
max_resumable_age = "48h"
sessiontimeout = "60m"
maxretries = 3
[downloads]
chunkeddownloadsenabled = true
chunksize = "10MB"
chunked_downloads_enabled = true
chunk_size = "10MB"
resumable_downloads_enabled = true
[deduplication]
enabled = true
directory = "$DATA_DIR/deduplication"
maxsize = "1GB"
[logging]
level = "INFO"
level = "info"
file = "$DEFAULT_LOG_DIR/hmac-file-server.log"
max_size = 100
max_backups = 3
max_backups = 7
max_age = 30
compress = true
[workers]
numworkers = 10
uploadqueuesize = 1000
autoscaling = true
numworkers = 4
uploadqueuesize = 100
[timeouts]
readtimeout = "30s"
writetimeout = "30s"
idletimeout = "120s"
readtimeout = "4800s"
writetimeout = "4800s"
idletimeout = "4800s"
shutdown = "30s"
[build]
version = "3.2"
EOF
if [[ $ENABLE_CLAMAV == "true" ]]; then
@ -817,32 +844,38 @@ generate_docker_config() {
echo -e "${YELLOW}Generating Docker configuration file...${NC}"
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)
[server]
bind_ip = "0.0.0.0"
listenport = "$SERVER_PORT"
unixsocket = false
storagepath = "/var/lib/hmac-file-server/uploads"
metricsenabled = true
metricsport = "$METRICS_PORT"
deduplicationenabled = true
deduplicationpath = "/var/lib/hmac-file-server/deduplication"
filenaming = "HMAC"
force_protocol = "auto"
pidfilepath = "/tmp/hmac-file-server/hmac-file-server.pid"
listen_address = "$SERVER_PORT"
storage_path = "/var/lib/hmac-file-server/uploads"
metrics_enabled = true
metrics_port = "$METRICS_PORT"
deduplication_enabled = true
file_naming = "original"
force_protocol = ""
pid_file = "/tmp/hmac-file-server/hmac-file-server.pid"
max_upload_size = "10GB"
# 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
if [[ $ENABLE_TLS == "true" ]]; then
cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = true
sslcert = "$SSL_CERT"
sslkey = "$SSL_KEY"
EOF
else
cat >> "$CONFIG_DIR/config.toml" << EOF
sslenabled = false
[tls]
enabled = true
cert_file = "$SSL_CERT"
key_file = "$SSL_KEY"
EOF
fi
@ -1431,7 +1464,7 @@ uninstall() {
# Find upload directory from config if it exists
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)
fi