Files
Sankofa/scripts/reinitialize-ceph-cluster.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

104 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Reinitialize Ceph cluster after reinstall
set -e
FSID="5fb968ae-12ab-405f-b05f-0df29a168328"
PUBLIC_NETWORK="192.168.11.0/24"
CLUSTER_NETWORK="192.168.11.0/24"
echo "=== Reinitializing Ceph Cluster ==="
# Check if we're on a Proxmox node
if [ ! -d "/etc/pve" ]; then
echo "ERROR: This script must be run on a Proxmox node"
exit 1
fi
echo ""
echo "=== Step 1: Creating Ceph configuration ==="
cat > /etc/pve/ceph.conf <<EOF
[global]
auth_client_required = cephx
auth_cluster_required = cephx
auth_service_required = cephx
cluster_network = $CLUSTER_NETWORK
fsid = $FSID
mon_allow_pool_delete = true
mon_host = 192.168.11.10 192.168.11.11
ms_bind_ipv4 = true
ms_bind_ipv6 = false
osd_pool_default_min_size = 2
osd_pool_default_size = 3
public_network = $PUBLIC_NETWORK
[client]
keyring = /etc/pve/priv/\$cluster.\$name.keyring
[client.crash]
keyring = /etc/pve/ceph/\$cluster.\$name.keyring
[mds]
keyring = /var/lib/ceph/mds/ceph-\$id/keyring
[mds.ml110-01]
host = ml110-01
mds_standby_for_name = pve
[mds.r630-01]
host = r630-01
mds_standby_for_name = pve
[mon.ml110-01]
public_addr = 192.168.11.10
[mon.r630-01]
public_addr = 192.168.11.11
EOF
# Create symlink (Proxmox uses /etc/pve/ceph.conf which is symlinked to /etc/ceph/ceph.conf)
if [ ! -L /etc/ceph/ceph.conf ]; then
ln -sf /etc/pve/ceph.conf /etc/ceph/ceph.conf 2>/dev/null || true
fi
echo "Configuration created"
echo ""
echo "=== Step 2: Initializing Ceph cluster ==="
HOSTNAME=$(hostname)
if [ "$HOSTNAME" = "ml110-01" ]; then
echo "Initializing cluster on ml110-01..."
pveceph init --network $PUBLIC_NETWORK --cluster-network $CLUSTER_NETWORK 2>&1 || echo "Init may have already been done"
fi
echo ""
echo "=== Step 3: Creating monitors ==="
if [ "$HOSTNAME" = "ml110-01" ]; then
echo "Creating monitor on ml110-01..."
pveceph mon create ml110-01 2>&1 || echo "Monitor may already exist"
fi
if [ "$HOSTNAME" = "r630-01" ]; then
echo "Creating monitor on r630-01..."
pveceph mon create r630-01 2>&1 || echo "Monitor may already exist"
fi
echo ""
echo "=== Step 4: Starting monitor services ==="
systemctl enable ceph-mon@$HOSTNAME
systemctl start ceph-mon@$HOSTNAME
sleep 5
systemctl status ceph-mon@$HOSTNAME --no-pager | head -15
echo ""
echo "=== Step 5: Verifying quorum ==="
sleep 10
ceph quorum_status 2>&1 | head -20 || echo "Quorum not yet established, may take a few minutes"
echo ""
echo "=== COMPLETE ==="
echo "Ceph cluster reinitialized. Next:"
echo "1. Verify quorum: ceph quorum_status"
echo "2. Create OSDs: ceph-volume lvm create --data /dev/<disk>"
echo "3. Check cluster health: ceph -s"