Enhance network resilience features in HMAC File Server 3.2

This commit is contained in:
2025-07-20 15:21:27 +00:00
parent 3c8a96c14e
commit f8e4d8fcba
11 changed files with 162 additions and 16 deletions

View File

@ -29,13 +29,14 @@ RUN apk add --no-cache \
tzdata \
curl \
shadow \
iputils \
&& adduser -D -s /bin/sh -u 1011 appuser \
&& rm -rf /var/cache/apk/*
# Create application directories with proper ownership
# Create application directories with proper ownership and secure permissions
RUN mkdir -p /app /data /deduplication /iso /logs /tmp && \
chown -R appuser:appuser /app /data /deduplication /iso /logs /tmp && \
chmod 755 /app /data /deduplication /iso /logs && \
chmod 750 /app /data /deduplication /iso /logs && \
chmod 1777 /tmp
# Copy binary from builder stage
@ -59,8 +60,8 @@ LABEL org.opencontainers.image.title="HMAC File Server" \
org.opencontainers.image.source="https://github.com/PlusOne/hmac-file-server" \
org.opencontainers.image.licenses="MIT"
# Health check for container orchestration
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
# Health check for container orchestration with network resilience awareness
HEALTHCHECK --interval=30s --timeout=15s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8888/health || exit 1
# Expose default port (configurable via config)

View File

@ -48,13 +48,22 @@ max_upload_retries = 3
# Enhanced Network Resilience (NEW)
[network_resilience]
enabled = true
fast_detection = true # 1-second network change detection
quality_monitoring = true # Monitor RTT and packet loss
predictive_switching = true # Proactive network switching
mobile_optimizations = true # Mobile-friendly thresholds
upload_resilience = true # Resume uploads across network changes
detection_interval = "1s"
quality_check_interval = "5s"
max_detection_interval = "10s"
network_change_threshold = 3 # Switches required to trigger network change
interface_stability_time = "10s" # Mobile-appropriate stability time
upload_pause_timeout = "10m" # Mobile-friendly upload pause timeout
upload_retry_timeout = "20m" # Extended retry for mobile scenarios
rtt_warning_threshold = "500ms" # Cellular network warning threshold
rtt_critical_threshold = "2000ms" # Cellular network critical threshold
packet_loss_warning_threshold = 5.0 # 5% packet loss warning
packet_loss_critical_threshold = 15.0 # 15% packet loss critical
[downloads]
resumable_downloads_enabled = true

View File

@ -94,6 +94,7 @@ worker_scale_down_thresh = 10
deduplication_enabled = true
min_free_bytes = "1GB"
file_naming = "original"
networkevents = true # Enable network monitoring for resilience
[uploads]
# XMPP-compatible file extensions for maximum client support
@ -113,6 +114,16 @@ upload_slot_ttl = "3600s"
retry_failed_uploads = true
max_upload_retries = 3
# Enhanced Network Resilience (NEW)
[network_resilience]
fast_detection = true # 1-second network change detection
quality_monitoring = true # Monitor RTT and packet loss
predictive_switching = true # Proactive network switching
mobile_optimizations = true # Mobile-friendly thresholds
detection_interval = "1s"
quality_check_interval = "5s"
max_detection_interval = "10s"
[downloads]
resumable_downloads_enabled = true
chunked_downloads_enabled = true

View File

@ -38,9 +38,9 @@ ExecStart=/usr/bin/podman run \
--volume /opt/podman/hmac-file-server/logs:/logs:rw,Z \
--health-cmd="curl -f http://localhost:8888/health || exit 1" \
--health-interval=30s \
--health-timeout=10s \
--health-timeout=15s \
--health-retries=3 \
--health-start-period=40s \
--health-start-period=60s \
localhost/hmac-file-server:latest -config /app/config.toml
# Stop and cleanup