mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 20:54:11 +00:00
- Add comprehensive staging deployment documentation (docs/STAGING-DEPLOYMENT.md) - Add Proxmox swap setup script for ZFS-based LXC containers - Update CLAUDE.md with staging deployment docs reference - Mark staging-deployment and memory/swap TODOs as complete Swap configuration: - 4GB ZFS ZVOL on Proxmox host (rpool/swap) - Container swap limit: 4096MB (pct set 700 -swap 4096) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
94 lines
3 KiB
Bash
Executable file
94 lines
3 KiB
Bash
Executable file
#!/bin/bash
|
|
# =============================================================================
|
|
# Swap Setup für Proxmox LXC Container
|
|
# =============================================================================
|
|
#
|
|
# WICHTIG: Dieses Script muss auf dem PROXMOX HOST ausgeführt werden,
|
|
# NICHT im LXC Container selbst!
|
|
#
|
|
# Swap auf ZFS-basierten LXC Containern funktioniert nicht direkt im Container.
|
|
# Stattdessen muss Swap auf Host-Ebene konfiguriert werden.
|
|
#
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
echo "=============================================="
|
|
echo " Swap Setup für Proxmox LXC Container"
|
|
echo "=============================================="
|
|
echo ""
|
|
echo "WICHTIG: Dieses Script muss auf dem PROXMOX HOST ausgeführt werden!"
|
|
echo ""
|
|
|
|
# Prüfen ob wir auf dem Host sind
|
|
if [ -f /etc/pve/local/qemu-server ] || pveversion &>/dev/null; then
|
|
echo "✓ Proxmox Host erkannt"
|
|
else
|
|
echo "✗ FEHLER: Dieses Script muss auf dem Proxmox Host ausgeführt werden!"
|
|
echo ""
|
|
echo "Optionen für LXC Container auf ZFS:"
|
|
echo ""
|
|
echo "Option 1: Swap ZVOL auf Host erstellen (empfohlen)"
|
|
echo " Auf dem Proxmox Host ausführen:"
|
|
echo " zfs create -V 4G -b 4096 -o compression=zle \\"
|
|
echo " -o logbias=throughput -o sync=standard \\"
|
|
echo " -o primarycache=metadata -o secondarycache=none \\"
|
|
echo " zfs_ssd2/swap"
|
|
echo " mkswap /dev/zvol/zfs_ssd2/swap"
|
|
echo " swapon /dev/zvol/zfs_ssd2/swap"
|
|
echo " echo '/dev/zvol/zfs_ssd2/swap none swap defaults 0 0' >> /etc/fstab"
|
|
echo ""
|
|
echo "Option 2: Container Memory Limit erhöhen"
|
|
echo " In Proxmox GUI oder via CLI:"
|
|
echo " pct set 700 -memory 12288 # 12GB RAM"
|
|
echo ""
|
|
echo "Option 3: Build auf separatem Server"
|
|
echo " GitHub Actions Runner für Builds nutzen"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
# Für Proxmox Host: ZVOL für Swap erstellen
|
|
POOL="zfs_ssd2"
|
|
ZVOL_NAME="swap"
|
|
ZVOL_SIZE="4G"
|
|
ZVOL_PATH="/dev/zvol/${POOL}/${ZVOL_NAME}"
|
|
|
|
echo "Erstelle Swap ZVOL: ${POOL}/${ZVOL_NAME} (${ZVOL_SIZE})"
|
|
|
|
# Prüfen ob ZVOL bereits existiert
|
|
if zfs list "${POOL}/${ZVOL_NAME}" &>/dev/null; then
|
|
echo "ZVOL ${POOL}/${ZVOL_NAME} existiert bereits"
|
|
else
|
|
zfs create -V ${ZVOL_SIZE} -b 4096 \
|
|
-o compression=zle \
|
|
-o logbias=throughput \
|
|
-o sync=standard \
|
|
-o primarycache=metadata \
|
|
-o secondarycache=none \
|
|
"${POOL}/${ZVOL_NAME}"
|
|
echo "✓ ZVOL erstellt"
|
|
fi
|
|
|
|
# Swap formatieren und aktivieren
|
|
if ! swapon --show | grep -q "${ZVOL_PATH}"; then
|
|
mkswap "${ZVOL_PATH}"
|
|
swapon "${ZVOL_PATH}"
|
|
echo "✓ Swap aktiviert"
|
|
else
|
|
echo "Swap bereits aktiv"
|
|
fi
|
|
|
|
# Zu fstab hinzufügen
|
|
if ! grep -q "${ZVOL_PATH}" /etc/fstab; then
|
|
echo "${ZVOL_PATH} none swap defaults 0 0" >> /etc/fstab
|
|
echo "✓ Zu /etc/fstab hinzugefügt"
|
|
else
|
|
echo "Bereits in /etc/fstab"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=============================================="
|
|
echo " Swap Setup abgeschlossen"
|
|
echo "=============================================="
|
|
free -h
|