Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- 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>
168 lines
5.4 KiB
Bash
Executable File
168 lines
5.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Load IP configuration
|
|
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
|
|
|
|
|
|
# Direct NPMplus installation - creates container and installs NPMplus
|
|
# This bypasses the interactive Proxmox helper script
|
|
|
|
set -e
|
|
|
|
PROXMOX_HOST="${1:-192.168.11.11}"
|
|
TZ="${2:-America/New_York}"
|
|
ACME_EMAIL="${3:-nsatoshi2007@hotmail.com}"
|
|
CTID="${4}" # Optional: specify container ID
|
|
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "🚀 Direct NPMplus Installation"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
# Get next available CTID if not specified
|
|
if [ -z "$CTID" ]; then
|
|
echo "📋 Finding next available container ID..."
|
|
CTID=$(ssh root@"$PROXMOX_HOST" "pct list | tail -n +2 | awk '{print \$1}' | sort -n | tail -1")
|
|
CTID=$((CTID + 1))
|
|
echo " ✅ Using container ID: $CTID"
|
|
else
|
|
echo " ✅ Using specified container ID: $CTID"
|
|
fi
|
|
|
|
# Check and download template if needed
|
|
echo ""
|
|
echo "📦 Checking Alpine template..."
|
|
TEMPLATE="alpine-3.22-default_20250617_amd64.tar.xz"
|
|
TEMPLATE_EXISTS=$(ssh root@"$PROXMOX_HOST" "pveam list local | grep -q '$TEMPLATE' && echo 'yes' || echo 'no'")
|
|
|
|
if [ "$TEMPLATE_EXISTS" = "no" ]; then
|
|
echo " 📥 Downloading template (this may take a few minutes)..."
|
|
ssh root@"$PROXMOX_HOST" "pveam download local $TEMPLATE" || {
|
|
echo " ❌ Failed to download template"
|
|
exit 1
|
|
}
|
|
echo " ✅ Template downloaded"
|
|
else
|
|
echo " ✅ Template already exists"
|
|
fi
|
|
|
|
# Create the container using pct
|
|
echo ""
|
|
echo "📦 Creating Alpine container..."
|
|
ssh root@"$PROXMOX_HOST" "pct create $CTID \\
|
|
local:vztmpl/$TEMPLATE \\
|
|
--hostname npmplus \\
|
|
--memory 512 \\
|
|
--cores 1 \\
|
|
--rootfs local-lvm:3 \\
|
|
--net0 name=eth0,bridge=vmbr0,ip=dhcp \\
|
|
--unprivileged 1 \\
|
|
--features nesting=1" || {
|
|
echo " ❌ Failed to create container"
|
|
exit 1
|
|
}
|
|
|
|
echo " ✅ Container created"
|
|
|
|
# Start container
|
|
echo ""
|
|
echo "🚀 Starting container..."
|
|
ssh root@"$PROXMOX_HOST" "pct start $CTID" || {
|
|
echo " ❌ Failed to start container"
|
|
exit 1
|
|
}
|
|
|
|
# Wait for container to be ready
|
|
echo " ⏳ Waiting for container to be ready..."
|
|
sleep 5
|
|
|
|
# Install NPMplus inside container
|
|
echo ""
|
|
echo "📦 Installing NPMplus inside container..."
|
|
ssh root@"$PROXMOX_HOST" "pct exec $CTID -- bash" << INSTALL_EOF
|
|
set -e
|
|
|
|
# Install dependencies
|
|
apk update
|
|
apk add --no-cache tzdata gawk yq docker docker-compose curl bash
|
|
|
|
# Start Docker
|
|
rc-service docker start
|
|
rc-update add docker default
|
|
|
|
# Wait for Docker
|
|
sleep 5
|
|
|
|
# Fetch NPMplus compose file
|
|
cd /opt
|
|
curl -fsSL "https://raw.githubusercontent.com/ZoeyVid/NPMplus/refs/heads/develop/compose.yaml" -o compose.yaml
|
|
|
|
# Update compose file with timezone and email
|
|
yq -i "
|
|
.services.npmplus.environment |=
|
|
(map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\")) +
|
|
[\"TZ=$TZ\", \"ACME_EMAIL=$ACME_EMAIL\"])
|
|
" compose.yaml
|
|
|
|
# Start NPMplus
|
|
echo "🚀 Starting NPMplus (this may take 1-2 minutes)..."
|
|
docker compose up -d
|
|
|
|
# Wait for NPMplus to be ready
|
|
CONTAINER_ID=""
|
|
for i in {1..60}; do
|
|
CONTAINER_ID=\$(docker ps --filter "name=npmplus" --format "{{.ID}}")
|
|
if [ -n "\$CONTAINER_ID" ]; then
|
|
STATUS=\$(docker inspect --format '{{.State.Health.Status}}' "\$CONTAINER_ID" 2>/dev/null || echo "starting")
|
|
if [ "\$STATUS" = "healthy" ]; then
|
|
echo "✅ NPMplus is running and healthy"
|
|
break
|
|
fi
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
# Get admin password
|
|
PASSWORD_LINE=\$(docker logs "\$CONTAINER_ID" 2>&1 | grep -i "Creating a new user" | tail -1 || echo "")
|
|
if [ -n "\$PASSWORD_LINE" ]; then
|
|
PASSWORD=\$(echo "\$PASSWORD_LINE" | grep -oP "password: \K[^\s]+" || echo "")
|
|
if [ -n "\$PASSWORD" ]; then
|
|
echo "username: admin@example.org" > /opt/.npm_pwd
|
|
echo "password: \$PASSWORD" >> /opt/.npm_pwd
|
|
echo "✅ Admin password saved to /opt/.npm_pwd"
|
|
fi
|
|
fi
|
|
|
|
echo "✅ NPMplus installation complete!"
|
|
INSTALL_EOF
|
|
|
|
if [ $? -eq 0 ]; then
|
|
# Get container IP
|
|
CONTAINER_IP=$(ssh root@"$PROXMOX_HOST" "pct exec $CTID -- hostname -I | awk '{print \$1}'")
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "✅ NPMplus Installation Complete!"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
echo "📋 Container Information:"
|
|
echo " • Container ID: $CTID"
|
|
echo " • Container IP: $CONTAINER_IP"
|
|
echo " • Access URL: https://$CONTAINER_IP:81"
|
|
echo " • Admin Email: admin@example.org"
|
|
echo ""
|
|
echo "🔑 To get admin password:"
|
|
echo " ssh root@$PROXMOX_HOST \"pct exec $CTID -- cat /opt/.npm_pwd\""
|
|
echo ""
|
|
echo "📋 Next step: Run configuration migration:"
|
|
echo " bash scripts/nginx-proxy-manager/migrate-configs-to-npmplus.sh $PROXMOX_HOST $CTID https://$CONTAINER_IP:81"
|
|
echo ""
|
|
else
|
|
echo ""
|
|
echo "❌ Installation failed. Check the output above."
|
|
exit 1
|
|
fi
|