Update production scripts with optimized settings

- VM creation: Updated for vmbr1 network and pve-main NVMe storage
- VM specs: 6 CPU cores, 16GB RAM, 150GB disk
- Added NUMA optimization for dual-socket Xeon
- Backup manager: Updated backup path to TrueNAS mount
- Added validation checks for storage and network
- Added TRIM support for SSD optimization
This commit is contained in:
devmatrix 2026-02-18 13:25:20 +00:00
parent f037b852f5
commit fc4d6c3204
2 changed files with 72 additions and 27 deletions

View File

@ -6,7 +6,7 @@
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKUP_ROOT="/mnt/nas/backups/mission-control"
BACKUP_ROOT="/mnt/truenas/backups/mission-control"
DB_SOURCE="/home/devmatrix/mission-control/data/mission-control.db"
CONFIG_SOURCE="/home/devmatrix/mission-control"
LOG_FILE="/var/log/mission-control/backup.log"

View File

@ -1,20 +1,20 @@
#!/bin/bash
# Proxmox Production VM Creator
# Proxmox Production VM Creator - Optimized for DevMatrix
# Run this on the Proxmox host as root
# Source: https://git.lemonlink.eu/devmatrix/devmatrix-scripts
set -e
# Configuration
VM_ID=101
# Configuration - EDIT THESE FOR YOUR ENVIRONMENT
VM_ID=201 # Changed from 101 (already exists)
VM_NAME="DevMatrix-Prod"
VM_IP="192.168.5.211/24"
VM_GW="192.168.5.1"
VM_CPU=4
VM_RAM=8192 # 8GB
VM_DISK=100 # GB
STORAGE="local-lvm" # Change to your storage
BRIDGE="vmbr0"
VM_CPU=6 # 6 cores (plenty for production)
VM_RAM=16384 # 16GB RAM (you have 94GB available)
VM_DISK=150 # 150GB on NVMe (pve-main)
STORAGE="pve-main" # Your NVMe storage
BRIDGE="vmbr1" # Your network bridge
# Colors
RED='\033[0;31m'
@ -38,15 +38,30 @@ if qm status $VM_ID > /dev/null 2>&1; then
error "VM $VM_ID already exists!"
fi
# Check if storage exists
if ! pvesm status | grep -q "$STORAGE"; then
error "Storage '$STORAGE' not found! Available storages:"
pvesm status
exit 1
fi
# Check if bridge exists
if ! ip link show "$BRIDGE" > /dev/null 2>&1; then
error "Bridge '$BRIDGE' not found! Available bridges:"
ip link show | grep "vmbr"
exit 1
fi
log "🚀 Creating DevMatrix Production VM"
log "===================================="
log ""
log "Configuration:"
log " VM ID: $VM_ID"
log " Name: $VM_NAME"
log " CPU: $VM_CPU cores"
log " CPU: $VM_CPU cores (Intel Xeon E5645)"
log " RAM: $((VM_RAM / 1024))GB"
log " Disk: ${VM_DISK}GB"
log " Disk: ${VM_DISK}GB ($STORAGE NVMe)"
log " Network: $BRIDGE"
log " IP: $VM_IP"
log ""
@ -66,49 +81,68 @@ if [ ! -f "$CLOUD_IMAGE" ]; then
success "Downloaded Ubuntu cloud image"
fi
# Create VM
log "Creating VM..."
# Create VM with optimized settings
log "Creating VM with optimized settings..."
qm create $VM_ID \
--name "$VM_NAME" \
--memory $VM_RAM \
--balloon 0 \
--cores $VM_CPU \
--cpu cputype=host \
--net0 virtio,bridge=$BRIDGE \
--sockets 2 \
--numa 1 \
--net0 virtio,bridge=$BRIDGE,firewall=1 \
--scsihw virtio-scsi-single \
--ostype l26 \
--agent enabled=1
--agent enabled=1,fstrim_cloned_disks=1 \
--cpuunits 2048 \
--onboot 1
# Import disk
log "Importing disk..."
# Import disk to NVMe storage
log "Importing disk to $STORAGE..."
qm importdisk $VM_ID "$CLOUD_IMAGE" $STORAGE --format qcow2
# Attach disk
qm set $VM_ID --scsi0 ${STORAGE}:vm-${VM_ID}-disk-0
# Attach disk with discard for TRIM support
qm set $VM_ID --scsi0 ${STORAGE}:vm-${VM_ID}-disk-0,discard=on,iothread=1
# Resize disk
log "Resizing disk to ${VM_DISK}GB..."
qm disk resize $VM_ID scsi0 ${VM_DISK}G
# Create CloudInit drive
# Create CloudInit drive on same storage
log "Configuring CloudInit..."
qm set $VM_ID --ide2 ${STORAGE}:cloudinit
# Set boot order
qm set $VM_ID --boot order=scsi0
# Configure serial
# Configure serial for console
qm set $VM_ID --serial0 socket --vga serial0
# Set IP configuration
qm set $VM_ID --ipconfig0 ip=$VM_IP,gw=$VM_GW
# Set user/password (change these!)
# Set user/password
qm set $VM_ID --ciuser devmatrix
qm set $VM_ID --cipassword $(openssl rand -base64 16)
qm set $VM_ID --cipassword $(openssl rand -base64 24)
# Enable QEMU agent
qm set $VM_ID --agent enabled=1
# Configure SSH keys if available
if [ -f "/root/.ssh/authorized_keys" ]; then
log "Adding SSH keys from host..."
qm set $VM_ID --sshkeys < /root/.ssh/authorized_keys
fi
# Enable QEMU agent with full features
qm set $VM_ID --agent enabled=1,fstrim_cloned_disks=1,type=virtio
# Add tags for organization
qm set $VM_ID --tags production,mission-control,devmatrix
# Set start at boot
qm set $VM_ID --onboot 1
# Configure backups (will use Proxmox backup settings)
log "Configuring backup options..."
# Start VM
log "Starting VM..."
@ -125,13 +159,24 @@ log " ID: $VM_ID"
log " Name: $VM_NAME"
log " IP: $VM_IP"
log " Console: https://$(hostname -I | awk '{print $1}'):8006/#v1:0:=$VM_ID"
log " Storage: $STORAGE (NVMe)"
log " Network: $BRIDGE"
log ""
log "Next steps:"
log "1. Open console and get IP: qm console $VM_ID"
log "1. Open console: qm console $VM_ID"
log "2. SSH into VM: ssh devmatrix@192.168.5.211"
log "3. Run setup: curl -fsSL https://git.lemonlink.eu/devmatrix/devmatrix-scripts/raw/branch/main/proxmox/setup-production-vm.sh | sudo bash"
log "3. Run setup script"
log ""
log "To view VM status:"
log " qm status $VM_ID"
log " qm list"
log ""
log "Optimization notes:"
log " ✓ 6 CPU cores (NUMA optimized)"
log " ✓ 16GB RAM (dedicated, no ballooning)"
log " ✓ 150GB NVMe storage (TRIM enabled)"
log " ✓ 2 sockets for better NUMA performance"
log " ✓ High CPU priority (2048)"
log " ✓ Auto-start on boot"
log " ✓ QEMU guest agent enabled"
log ""