Files
proxmox/scripts/npmplus/install-npmplus-alltra-hybx.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

107 lines
3.4 KiB
Bash

#!/usr/bin/env bash
# Install NPMplus (Docker + NPM) in container 10235 (NPMplus Alltra/HYBX)
# See: docs/04-configuration/NPMPLUS_ALLTRA_HYBX_MASTER_PLAN.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_ALLTRA_HYBX_VMID:-10235}"
HOST="${PROXMOX_HOST_R630_01:-192.168.11.11}"
TZ="${TZ:-America/New_York}"
ACME_EMAIL="${NPM_EMAIL:-admin@example.org}"
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"; }
error() { echo -e "${RED}[ERROR]${NC} $1"; }
log "Installing NPMplus in container $VMID on $HOST..."
if ! ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@"$HOST" "pct status $VMID" >/dev/null 2>&1; then
error "Container $VMID not found or not running. Create it first: bash scripts/npmplus/create-npmplus-alltra-hybx-container.sh"
exit 1
fi
ssh -o StrictHostKeyChecking=no root@"$HOST" "pct exec $VMID -- bash -s" << INSTALL_EOF
set -e
export TZ="$TZ"
export ACME_EMAIL="$ACME_EMAIL"
echo "Installing Docker and NPMplus (Debian)..."
# Debian: install Docker
apt-get update -qq
apt-get install -y -qq ca-certificates curl gnupg lsb-release
if ! command -v docker >/dev/null 2>&1; then
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=\$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \$(. /etc/os-release && echo \$VERSION_CODENAME) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -qq
apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
fi
systemctl start docker 2>/dev/null || true
systemctl enable docker 2>/dev/null || true
sleep 3
# Fetch minimal compose (upstream has YAML indentation issues)
mkdir -p /opt /opt/npmplus
cd /opt
cat > compose.yaml << COMPOSE_EOF
name: npmplus
services:
npmplus:
container_name: npmplus
image: docker.io/zoeyvid/npmplus:latest
restart: unless-stopped
network_mode: host
volumes:
- "/opt/npmplus:/data"
environment:
- "TZ=$TZ"
- "ACME_EMAIL=$ACME_EMAIL"
COMPOSE_EOF
# Start
docker compose up -d
# Wait
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30; do
if docker ps --filter "name=npmplus" --format "{{.Status}}" | grep -qE "healthy|Up"; then
echo "NPMplus ready"
break
fi
sleep 2
done
# Save password if found
CID=\$(docker ps --filter "name=npmplus" --format "{{.ID}}" | head -1)
if [ -n "\$CID" ]; then
PWD=\$(docker logs "\$CID" 2>&1 | grep -i "Creating a new user" | tail -1 | grep -oP "password: \\K[^\\s]+" || echo "")
if [ -n "\$PWD" ]; then
echo "username: admin@example.org" > /opt/.npm_pwd
echo "password: \$PWD" >> /opt/.npm_pwd
fi
fi
echo "Install complete"
INSTALL_EOF
if [ $? -eq 0 ]; then
success "NPMplus installed in container $VMID"
log "Admin UI: https://192.168.11.169:81"
log "Get password: ssh root@$HOST \"pct exec $VMID -- cat /opt/.npm_pwd 2>/dev/null\""
else
error "Installation failed"
exit 1
fi