Files
Sankofa/scripts/create-cephfs-storage-r630.sh
defiQUG 33d50fb91e
Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped
chore: consolidate local WIP (repo cleanup 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 09:41:34 -07:00

140 lines
6.0 KiB
Bash
Executable File

#!/bin/bash
# Create ceph-fs storage pool on r630-01
# This script must be run on r630-01 or via SSH
set -e
echo "═══════════════════════════════════════════════════════════════════════════════"
echo " CREATE CEPHFS STORAGE POOL ON r630-01"
echo "═══════════════════════════════════════════════════════════════════════════════"
echo ""
# Check if running on r630-01
HOSTNAME=$(hostname)
if [ "$HOSTNAME" != "r630-01" ]; then
echo "⚠️ WARNING: This script should be run on r630-01"
echo " Current hostname: $HOSTNAME"
echo ""
echo "To run remotely via SSH:"
echo " ssh root@r630-01.sankofa.nexus 'bash -s' < $0"
echo ""
read -p "Continue anyway? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
echo "Step 1: Checking Ceph cluster status..."
if ! command -v ceph &> /dev/null; then
echo "❌ ERROR: ceph command not found. Ceph packages may not be installed."
exit 1
fi
CEPH_STATUS=$(ceph -s 2>&1 | head -5)
echo "$CEPH_STATUS"
echo ""
echo "Step 2: Checking if MDS (Metadata Server) exists..."
MDS_COUNT=$(ceph mds stat 2>/dev/null | grep -c "up:" || echo "0")
if [ "$MDS_COUNT" = "0" ]; then
echo "⚠️ No MDS running. Creating MDS..."
pveceph mds create 2>&1 || {
echo "⚠️ MDS creation failed or already exists"
echo "Checking MDS status..."
ceph mds stat 2>&1 | head -3
}
else
echo "✅ MDS is running"
ceph mds stat 2>&1 | head -3
fi
echo ""
echo "Step 3: Checking if CephFS filesystem exists..."
CEPHFS_EXISTS=$(ceph fs ls 2>/dev/null | grep -c "ceph-fs" || echo "0")
if [ "$CEPHFS_EXISTS" = "0" ]; then
echo "⚠️ CephFS filesystem 'ceph-fs' does not exist"
echo ""
echo "Step 4: Creating CephFS using pveceph (recommended method)..."
echo "This will create the CephFS and add it to Proxmox storage automatically."
pveceph fs create --name ceph-fs --pg_num 128 --add-storage 2>&1 || {
echo "⚠️ pveceph fs create failed. Trying manual method..."
echo ""
echo "Step 4a: Checking if required pools exist..."
DATA_POOL_EXISTS=$(ceph osd pool ls 2>/dev/null | grep -c "cephfs_data" || echo "0")
META_POOL_EXISTS=$(ceph osd pool ls 2>/dev/null | grep -c "cephfs_metadata" || echo "0")
if [ "$DATA_POOL_EXISTS" = "0" ] || [ "$META_POOL_EXISTS" = "0" ]; then
echo "Creating required pools..."
[ "$DATA_POOL_EXISTS" = "0" ] && ceph osd pool create cephfs_data 32 32
[ "$META_POOL_EXISTS" = "0" ] && ceph osd pool create cephfs_metadata 16 16
fi
echo "Step 4b: Creating CephFS filesystem..."
ceph fs new ceph-fs cephfs_metadata cephfs_data 2>&1 || {
echo "⚠️ CephFS may already exist"
}
echo "Step 4c: Adding to Proxmox storage..."
pvesm add cephfs ceph-fs \
--nodes r630-01 \
--content images,rootdir \
--fs-name ceph-fs \
--monhost 192.168.11.10:6789,192.168.11.11:6789 \
--username admin 2>&1 || {
echo "⚠️ Failed to add via pvesm. Try Web UI:"
echo " Datacenter → Storage → Add → CephFS"
echo " ID: ceph-fs, FS Name: ceph-fs, Nodes: r630-01"
}
}
else
echo "✅ CephFS filesystem 'ceph-fs' already exists"
# Check if it's added to Proxmox storage
if ! pvesm status 2>/dev/null | grep -q "ceph-fs"; then
echo ""
echo "Step 4: Adding existing CephFS to Proxmox storage..."
echo "Note: CephFS may not support 'images' content type for VM disks."
echo "Trying without content types first..."
# Try without content types (Proxmox will use defaults)
pvesm add cephfs ceph-fs \
--nodes r630-01 \
--fs-name ceph-fs \
--monhost 192.168.11.10:6789,192.168.11.11:6789 \
--username admin 2>&1 || {
echo "⚠️ Failed to add via pvesm without content types."
echo "Trying with only rootdir (for containers)..."
pvesm add cephfs ceph-fs \
--nodes r630-01 \
--content rootdir \
--fs-name ceph-fs \
--monhost 192.168.11.10:6789,192.168.11.11:6789 \
--username admin 2>&1 || {
echo "⚠️ Failed to add via pvesm. Use Web UI or API:"
echo " Web UI: Datacenter → Storage → Add → CephFS"
echo " ID: ceph-fs, FS Name: ceph-fs, Nodes: r630-01"
echo ""
echo " Or via API (from your workstation):"
echo " curl -k -X POST -H \"Authorization: PVEAPIToken=...\" \\"
echo " \"https://192.168.11.11:8006/api2/json/storage\" \\"
echo " -d \"storage=ceph-fs&type=cephfs&nodes=r630-01&monhost=192.168.11.10:6789,192.168.11.11:6789&username=admin\""
}
}
else
echo "✅ Storage 'ceph-fs' already exists in Proxmox"
fi
fi
echo ""
echo "═══════════════════════════════════════════════════════════════════════════════"
echo " VERIFICATION"
echo "═══════════════════════════════════════════════════════════════════════════════"
echo ""
echo "Checking storage status..."
pvesm status | grep -E "ceph-fs|NAME" || echo "Storage not found in pvesm status"
echo ""
echo "✅ Setup complete! Storage 'ceph-fs' should now be available for VM deployment."