mirror of
https://github.com/myronblair/ProxMailcow
synced 2026-06-30 17:50:40 -05:00
b60db8a0d0
- VM 200: Nginx Proxy Manager (10.48.200.80) - VM 201: Mailcow email server (10.48.200.82) - Cloud-init automation for both VMs - FortiGate VIP/policy documentation - DNS records for web.orbishosting.com - NPM proxy host setup guide - Mailcow post-install checklist - Cert sync script (NPM → Mailcow) External IP: 97.176.15.26
84 lines
2.3 KiB
Bash
84 lines
2.3 KiB
Bash
#!/bin/bash
|
|
# Create and configure Mailcow VM 201
|
|
# Run on Proxmox host: bash proxmox/02-create-mailcow-vm.sh
|
|
|
|
set -euo pipefail
|
|
|
|
VMID=201
|
|
VMNAME="Mailcow"
|
|
IP="10.48.200.82"
|
|
GW="10.48.200.1"
|
|
DNS="8.8.8.8,1.1.1.1"
|
|
DISK_SIZE="80G"
|
|
RAM=8192
|
|
CORES=4
|
|
CLOUD_IMAGE="/var/lib/vz/template/iso/noble-server-cloudimg-amd64.img"
|
|
SNIPPETS_DIR="/var/lib/vz/snippets"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
echo "=== Creating VM ${VMID}: ${VMNAME} ==="
|
|
|
|
# Create VM
|
|
echo "[1/8] Creating VM..."
|
|
qm create ${VMID} \
|
|
--name "${VMNAME}" \
|
|
--memory ${RAM} \
|
|
--cores ${CORES} \
|
|
--sockets 1 \
|
|
--cpu x86-64-v2-AES \
|
|
--net0 virtio,bridge=vmbr0 \
|
|
--ostype l26 \
|
|
--scsihw virtio-scsi-pci \
|
|
--boot order=scsi0 \
|
|
--serial0 socket \
|
|
--vga serial0 \
|
|
--agent enabled=1 \
|
|
--onboot 1 \
|
|
--description "Mailcow Email Server - mail.web.orbishosting.com"
|
|
|
|
# Import cloud image
|
|
echo "[2/8] Importing cloud image (this takes ~2 minutes)..."
|
|
qm importdisk ${VMID} "${CLOUD_IMAGE}" local-lvm --format raw
|
|
|
|
# Attach disk
|
|
echo "[3/8] Attaching disk..."
|
|
qm set ${VMID} --scsi0 local-lvm:vm-${VMID}-disk-0,discard=on,ssd=1
|
|
|
|
# Add cloud-init CD-ROM
|
|
echo "[4/8] Adding cloud-init drive..."
|
|
qm set ${VMID} --ide2 local-lvm:cloudinit
|
|
|
|
# Upload cloud-init snippet
|
|
echo "[5/8] Uploading cloud-init snippet..."
|
|
mkdir -p ${SNIPPETS_DIR}
|
|
cp "${SCRIPT_DIR}/snippets/mailcow-cloud-init.yaml" "${SNIPPETS_DIR}/mailcow-cloud-init.yaml"
|
|
|
|
# Configure cloud-init
|
|
echo "[6/8] Configuring cloud-init..."
|
|
qm set ${VMID} \
|
|
--ciuser ubuntu \
|
|
--cipassword 'mailstack2024!' \
|
|
--ipconfig0 ip=${IP}/24,gw=${GW} \
|
|
--nameserver "${DNS}" \
|
|
--searchdomain web.orbishosting.com \
|
|
--cicustom "vendor=local:snippets/mailcow-cloud-init.yaml"
|
|
|
|
# Resize disk
|
|
echo "[7/8] Resizing disk to ${DISK_SIZE}..."
|
|
qm resize ${VMID} scsi0 ${DISK_SIZE}
|
|
|
|
# Start VM
|
|
echo "[8/8] Starting VM ${VMID}..."
|
|
qm start ${VMID}
|
|
|
|
echo ""
|
|
echo "=== VM ${VMID} started ==="
|
|
echo "IP: ${IP}"
|
|
echo "SSH: ssh ubuntu@${IP} (password: mailstack2024!)"
|
|
echo "Mailcow Web: http://${IP}:8080 (internal only until NPM proxy is set up)"
|
|
echo ""
|
|
echo "Mailcow cloud-init takes ~10-15 minutes (Docker pull + image downloads)."
|
|
echo "Monitor with: ssh ubuntu@${IP} 'sudo tail -f /var/log/cloud-init-output.log'"
|
|
echo ""
|
|
echo "NEXT: Configure NPM proxy hosts — see nginx-proxy-manager/ directory."
|