deploy
This commit is contained in:
parent
a7cf6d62ac
commit
352c0b97c0
4 changed files with 20 additions and 21 deletions
|
|
@ -17,19 +17,17 @@ get_log_info() {
|
||||||
ls -1t ${LOG_DIR}/components/nostrMiddleware_*.log 2>/dev/null | head -n 1
|
ls -1t ${LOG_DIR}/components/nostrMiddleware_*.log 2>/dev/null | head -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Echo "Waiting for build..." every 10 seconds until the unlocker log is available, with a 3-minute timeout
|
|
||||||
TIMEOUT=180
|
TIMEOUT=180
|
||||||
while [ ! -f ${LOG_DIR}/components/unlocker_*.log ] && [ $TIMEOUT -gt 0 ]; do
|
while [ ! -f ${LOG_DIR}/components/unlocker_*.log ] && [ $TIMEOUT -gt 0 ]; do
|
||||||
echo "Waiting for build..."
|
log "Waiting for build..."
|
||||||
sleep 10
|
sleep 10
|
||||||
TIMEOUT=$((TIMEOUT - 10))
|
TIMEOUT=$((TIMEOUT - 10))
|
||||||
done
|
done
|
||||||
if [ $TIMEOUT -le 0 ]; then
|
if [ $TIMEOUT -le 0 ]; then
|
||||||
echo "Timeout waiting for unlocker log file."
|
log "Timeout waiting for unlocker log file."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wait for wallet status messages with a 45s timeout
|
|
||||||
TIMEOUT=45
|
TIMEOUT=45
|
||||||
while [ $TIMEOUT -gt 0 ]; do
|
while [ $TIMEOUT -gt 0 ]; do
|
||||||
if grep -q -e "unlocker >> macaroon not found, creating wallet..." -e "unlocker >> the wallet is already unlocked" -e "unlocker >> wallet is locked, unlocking" ${LOG_DIR}/components/unlocker_*.log; then
|
if grep -q -e "unlocker >> macaroon not found, creating wallet..." -e "unlocker >> the wallet is already unlocked" -e "unlocker >> wallet is locked, unlocking" ${LOG_DIR}/components/unlocker_*.log; then
|
||||||
|
|
@ -39,43 +37,42 @@ get_log_info() {
|
||||||
TIMEOUT=$((TIMEOUT - 1))
|
TIMEOUT=$((TIMEOUT - 1))
|
||||||
done
|
done
|
||||||
if [ $TIMEOUT -le 0 ]; then
|
if [ $TIMEOUT -le 0 ]; then
|
||||||
echo "Timeout waiting for wallet status message."
|
log "Timeout waiting for wallet status message."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q "unlocker >> macaroon not found, creating wallet..." ${LOG_DIR}/components/unlocker_*.log; then
|
if grep -q "unlocker >> macaroon not found, creating wallet..." ${LOG_DIR}/components/unlocker_*.log; then
|
||||||
echo "Creating wallet..."
|
log "Creating wallet..."
|
||||||
elif grep -q "unlocker >> wallet is locked, unlocking" ${LOG_DIR}/components/unlocker_*.log; then
|
elif grep -q "unlocker >> wallet is locked, unlocking" ${LOG_DIR}/components/unlocker_*.log; then
|
||||||
echo "Unlocking wallet..."
|
log "Unlocking wallet..."
|
||||||
else
|
else
|
||||||
echo "Wallet is already unlocked."
|
log "Wallet is already unlocked."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Proceeding to nprofile attempts..."
|
log "Proceeding to nprofile attempts..."
|
||||||
|
|
||||||
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
||||||
LATEST_LOG=$(find_latest_log)
|
LATEST_LOG=$(find_latest_log)
|
||||||
if [ -n "$LATEST_LOG" ]; then
|
if [ -n "$LATEST_LOG" ]; then
|
||||||
echo "Found latest log: $LATEST_LOG"
|
log "Found latest log: $LATEST_LOG"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo "Awaiting nostr information..."
|
log "Awaiting nostr information..."
|
||||||
sleep 4
|
sleep 4
|
||||||
ATTEMPT=$((ATTEMPT + 1))
|
ATTEMPT=$((ATTEMPT + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$LATEST_LOG" ]; then
|
if [ -z "$LATEST_LOG" ]; then
|
||||||
echo "Failed to find the log file, check service status"
|
log "Failed to find the log file, check service status"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nprofile_key=$(grep -oP 'nprofile: \K\w+' "$LATEST_LOG")
|
nprofile_key=$(grep -oP 'nprofile: \K\w+' "$LATEST_LOG")
|
||||||
|
|
||||||
if [ -z "$nprofile_key" ]; then
|
if [ -z "$nprofile_key" ]; then
|
||||||
echo "No nprofile key found in the log."
|
log "No nprofile key found in the log."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print the extracted key
|
log "Paste this string into ShockWallet to connect to the node: $nprofile_key"
|
||||||
echo "Paste this string into ShockWallet to connect to the node: $nprofile_key"
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
BASE_URL="https://raw.githubusercontent.com/shocknet/Lightning.Pub/fix/bootstrap/scripts/"
|
BASE_URL="https://bolt12.info/deploy/"
|
||||||
modules=(
|
modules=(
|
||||||
"utils"
|
"utils"
|
||||||
"check_homebrew"
|
"check_homebrew"
|
||||||
|
|
@ -12,7 +12,7 @@ modules=(
|
||||||
"install_nodejs"
|
"install_nodejs"
|
||||||
"install_lightning_pub"
|
"install_lightning_pub"
|
||||||
"start_services"
|
"start_services"
|
||||||
"extract_nprofile" # Add extract_nprofile to the modules array
|
"extract_nprofile"
|
||||||
)
|
)
|
||||||
|
|
||||||
for module in "${modules[@]}"; do
|
for module in "${modules[@]}"; do
|
||||||
|
|
|
||||||
|
|
@ -98,3 +98,5 @@ EOF
|
||||||
chmod +x start.sh
|
chmod +x start.sh
|
||||||
log "systemctl not available. Created start.sh. Please use this script to start the services manually."
|
log "systemctl not available. Created start.sh. Please use this script to start the services manually."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_services
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PRIMARY_COLOR="\e[38;5;208m" # #f59322
|
PRIMARY_COLOR="\e[38;5;208m"
|
||||||
SECONDARY_COLOR="\e[38;5;165m" # #c740c7
|
SECONDARY_COLOR="\e[38;5;165m"
|
||||||
RESET_COLOR="\e[0m"
|
RESET_COLOR="\e[0m"
|
||||||
LOG_FILE="/var/log/deploy.log"
|
LOG_FILE="/var/log/pubdeploy.log"
|
||||||
|
|
||||||
touch $LOG_FILE
|
touch $LOG_FILE
|
||||||
chmod 644 $LOG_FILE
|
chmod 644 $LOG_FILE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue