Files
proxmox/scripts/npmplus/create-npmplus-fourth-container.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

84 lines
3.1 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Create NPMplus Fourth container (VMID 10236) for dev/Codespaces at 192.168.11.170
# See: docs/04-configuration/DEV_CODESPACES_76_53_10_40.md, DEV_CODESPACES_NEXT_STEPS_CHECKLIST.md
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
source "$PROJECT_ROOT/config/ip-addresses.conf" 2>/dev/null || true
[ -f "$PROJECT_ROOT/.env" ] && set +u && source "$PROJECT_ROOT/.env" 2>/dev/null || true && set -u
VMID="${NPMPLUS_FOURTH_VMID:-10236}"
HOST="${PROXMOX_HOST_R630_01:-192.168.11.11}"
IP="${IP_NPMPLUS_FOURTH:-192.168.11.170}"
TEMPLATE="${TEMPLATE:-local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst}"
STORAGE="${STORAGE:-local-lvm}"
NETWORK="${NETWORK:-vmbr0}"
GATEWAY="${NETWORK_GATEWAY:-192.168.11.1}"
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
log() { echo -e "${BLUE}[INFO]${NC} $1"; }
success() { echo -e "${GREEN}[✓]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
error() { echo -e "${RED}[ERROR]${NC} $1"; }
log "Creating NPMplus Fourth (dev/Codespaces) container (VMID $VMID) on $HOST at $IP..."
exists() {
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@"$HOST" "pct list 2>/dev/null | grep -q '^[[:space:]]*$VMID[[:space:]]' && echo yes || echo no" 2>/dev/null || echo "no"
}
if [[ "$(exists)" == "yes" ]]; then
warn "Container $VMID already exists. Skipping creation."
success "Container $VMID is ready. Next: install NPMplus and cloudflared (see DEV_CODESPACES_NEXT_STEPS_CHECKLIST.md Phase 1.31.5)."
exit 0
fi
# Check SSH
if ! ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@"$HOST" "echo ok" >/dev/null 2>&1; then
error "Cannot SSH to $HOST. Ensure you can reach root@$HOST."
exit 1
fi
# Check template exists on host
if ! ssh -o StrictHostKeyChecking=no root@"$HOST" "pveam list local 2>/dev/null | grep -q 'debian-12-standard'"; then
warn "Debian 12 template may not exist. Checking..."
TEMPLATE_ALT=$(ssh -o StrictHostKeyChecking=no root@"$HOST" "pveam list local 2>/dev/null | grep -E 'debian|ubuntu' | head -1 | awk '{print \$1}'" || echo "")
if [ -n "$TEMPLATE_ALT" ]; then
TEMPLATE="$TEMPLATE_ALT"
log "Using template: $TEMPLATE"
else
error "No Debian/Ubuntu template found. Download one: pveam download local debian-12-standard_12.12-1_amd64.tar.zst"
exit 1
fi
fi
log "Creating container..."
ssh -o StrictHostKeyChecking=no root@"$HOST" "pct create $VMID $TEMPLATE \
--hostname npmplus-fourth \
--memory 2048 \
--cores 2 \
--rootfs $STORAGE:20 \
--net0 name=eth0,bridge=$NETWORK,ip=$IP/24,gw=$GATEWAY \
--description 'NPMplus Fourth - dev/Codespaces, Gitea, Proxmox admin (76.53.10.40)' \
--start 1 \
--onboot 1 \
--unprivileged 1 \
--features nesting=1" 2>&1 || {
error "Failed to create container"
exit 1
}
sleep 5
if [[ "$(exists)" == "yes" ]]; then
success "Container $VMID created and started at $IP"
log "Next: Install NPMplus (Docker + NPM) in container; then cloudflared. See docs/04-configuration/DEV_CODESPACES_NEXT_STEPS_CHECKLIST.md"
else
error "Container creation may have failed. Check: ssh root@$HOST 'pct list'"
exit 1
fi