Initial commit
This commit is contained in:
54
scripts/optimize-alpine.sh
Executable file
54
scripts/optimize-alpine.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# Alpine Linux optimization script for Archipelago
|
||||
# Optimizes system settings for container workloads
|
||||
|
||||
set -e
|
||||
|
||||
echo "⚡ Optimizing Alpine Linux for container workloads..."
|
||||
|
||||
# CPU Governor - set to performance for better container performance
|
||||
if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
|
||||
echo "performance" > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# I/O Scheduler - use deadline or none for SSDs
|
||||
if command -v lsblk >/dev/null 2>&1; then
|
||||
for disk in $(lsblk -d -o NAME -n); do
|
||||
if [ -f "/sys/block/$disk/queue/scheduler" ]; then
|
||||
# Prefer none (for NVMe) or deadline (for SATA SSD)
|
||||
if grep -q "none" "/sys/block/$disk/queue/scheduler"; then
|
||||
echo none > "/sys/block/$disk/queue/scheduler" 2>/dev/null || true
|
||||
elif grep -q "deadline" "/sys/block/$disk/queue/scheduler"; then
|
||||
echo deadline > "/sys/block/$disk/queue/scheduler" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Increase file descriptor limits
|
||||
cat >> /etc/security/limits.conf <<EOF
|
||||
* soft nofile 65536
|
||||
* hard nofile 65536
|
||||
root soft nofile 65536
|
||||
root hard nofile 65536
|
||||
EOF
|
||||
|
||||
# Optimize network settings for container networking
|
||||
cat >> /etc/sysctl.conf <<EOF
|
||||
|
||||
# Container networking optimizations
|
||||
net.core.somaxconn = 4096
|
||||
net.ipv4.tcp_max_syn_backlog = 4096
|
||||
net.core.netdev_max_backlog = 5000
|
||||
net.ipv4.ip_local_port_range = 1024 65535
|
||||
|
||||
# Container storage optimizations
|
||||
vm.swappiness = 10
|
||||
vm.dirty_ratio = 15
|
||||
vm.dirty_background_ratio = 5
|
||||
EOF
|
||||
|
||||
# Apply sysctl settings
|
||||
sysctl -p >/dev/null 2>&1 || true
|
||||
|
||||
echo "✅ Alpine optimization complete!"
|
||||
38
scripts/parmanode-wrapper.sh
Executable file
38
scripts/parmanode-wrapper.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# Parmanode compatibility wrapper
|
||||
# Allows running Parmanode scripts directly while wrapping them in container isolation
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_PATH="$1"
|
||||
MODULE_NAME="${2:-$(basename "$SCRIPT_PATH" .sh)}"
|
||||
|
||||
if [ -z "$SCRIPT_PATH" ]; then
|
||||
echo "Usage: $0 <script-path> [module-name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$SCRIPT_PATH" ]; then
|
||||
echo "Error: Script not found: $SCRIPT_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🔧 Running Parmanode script in container: $SCRIPT_PATH"
|
||||
|
||||
# Create temporary container to run the script
|
||||
CONTAINER_NAME="parmanode-${MODULE_NAME}-$$"
|
||||
|
||||
# Run script in Alpine container with necessary volumes
|
||||
podman run --rm \
|
||||
--name "$CONTAINER_NAME" \
|
||||
--volume "$SCRIPT_PATH:/script.sh:ro" \
|
||||
--volume "/var/lib/archipelago:/data:rw" \
|
||||
--network host \
|
||||
alpine:latest \
|
||||
sh -c "
|
||||
apk add --no-cache bash curl wget || true
|
||||
chmod +x /script.sh
|
||||
/script.sh
|
||||
"
|
||||
|
||||
echo "✅ Parmanode script completed"
|
||||
Reference in New Issue
Block a user