Files
proxmox/scripts/npmplus/create-npmplus-mifos-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

67 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Create NPMplus Mifos container (VMID 10237) on r630-02 at 192.168.11.171.
# Tunnel points to this NPMplus; NPMplus proxies mifos.d-bis.org to VMID 5800 (192.168.11.85:80).
# See: docs/04-configuration/MIFOS_NPMPLUS_TUNNEL.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_MIFOS_VMID:-10237}"
HOST="${PROXMOX_HOST_R630_02:-192.168.11.12}"
IP="${IP_NPMPLUS_MIFOS:-192.168.11.171}"
TEMPLATE="${TEMPLATE:-local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst}"
STORAGE="${STORAGE_R630_02_NPMPLUS_MIFOS:-thin3}"
NETWORK="${NETWORK:-vmbr0}"
GATEWAY="${NETWORK_GATEWAY:-192.168.11.1}"
log() { echo "[INFO] $1"; }
success() { echo "[OK] $1"; }
warn() { echo "[WARN] $1"; }
error() { echo "[ERROR] $1"; exit 1; }
log "Creating NPMplus Mifos container (VMID $VMID) on $HOST at $IP (tunnel origin to 5800)..."
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 "Next: install NPMplus, add proxy mifos.d-bis.org to http://192.168.11.85:80, install cloudflared. See docs/04-configuration/MIFOS_NPMPLUS_TUNNEL.md"
exit 0
fi
if ! ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@"$HOST" "echo ok" >/dev/null 2>&1; then
error "Cannot SSH to $HOST"
fi
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" ] && ! echo "$TEMPLATE" | grep -q "debian-12-standard"; then
TEMPLATE="local:$TEMPLATE_ALT"
log "Using template: $TEMPLATE"
fi
log "Creating container..."
ssh -o StrictHostKeyChecking=no root@"$HOST" "pct create $VMID $TEMPLATE \
--hostname npmplus-mifos \
--memory 2048 \
--cores 2 \
--rootfs $STORAGE:20 \
--net0 name=eth0,bridge=$NETWORK,ip=$IP/24,gw=$GATEWAY \
--description 'NPMplus Mifos - tunnel origin; proxies mifos.d-bis.org to 5800' \
--start 1 \
--onboot 1 \
--unprivileged 1 \
--features nesting=1" 2>&1 || error "Failed to create container"
sleep 5
if [[ "$(exists)" == "yes" ]]; then
success "Container $VMID created and started at $IP"
log "Next: Install NPMplus, add proxy mifos.d-bis.org to http://${MIFOS_IP:-192.168.11.85}:80, install cloudflared. See docs/04-configuration/MIFOS_NPMPLUS_TUNNEL.md"
else
error "Container creation may have failed. Check: ssh root@$HOST 'pct list'"
fi