55 lines
1.7 KiB
Bash
Executable File
55 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Upload the Nostr Quantum Preparation web app to the TEST endpoint.
|
|
#
|
|
# Usage: ./upload-test.sh
|
|
#
|
|
# Uploads the contents of www/ to ubuntu@laantungir.net:html/quantum-prep-test/
|
|
# The site will be accessible at https://laantungir.net/quantum-prep-test/
|
|
#
|
|
# This is the staging deployment for the v2 hardened derivation scheme.
|
|
# The production site (https://laantungir.net/quantum-prep/) is NOT touched.
|
|
# Once the v2 flow is confirmed working here, run ./upload.sh to promote it.
|
|
#
|
|
|
|
set -e
|
|
|
|
SERVER="ubuntu@laantungir.net"
|
|
REMOTE_DIR="html/quantum-prep-test"
|
|
LOCAL_DIR="$(dirname "$0")/www"
|
|
|
|
echo "🔒 Nostr Quantum Preparation — Upload (TEST endpoint)"
|
|
echo "====================================================="
|
|
echo "Server: $SERVER"
|
|
echo "Remote: $REMOTE_DIR"
|
|
echo "Local: $LOCAL_DIR"
|
|
echo ""
|
|
echo "⚠️ This deploys to the TEST endpoint only."
|
|
echo " Production (quantum-prep) is NOT modified."
|
|
echo ""
|
|
|
|
# Ensure the bundle is up to date
|
|
echo "📦 Building PQ crypto bundle..."
|
|
node "$(dirname "$0")/build-pq-bundle.js"
|
|
echo ""
|
|
|
|
# Create the remote directory if it doesn't exist.
|
|
# /var/www/html is root-owned, so creating a NEW top-level directory needs
|
|
# sudo; we then chown it to ubuntu so subsequent rsyncs work normally.
|
|
echo "📁 Ensuring remote directory exists..."
|
|
ssh "$SERVER" "sudo mkdir -p $REMOTE_DIR && sudo chown ubuntu:ubuntu $REMOTE_DIR"
|
|
echo ""
|
|
|
|
# Upload files using rsync
|
|
echo "📤 Uploading files..."
|
|
rsync -avz --delete \
|
|
--exclude='*.map' \
|
|
"$LOCAL_DIR/" \
|
|
"$SERVER:$REMOTE_DIR/"
|
|
echo ""
|
|
|
|
echo "✅ Upload complete!"
|
|
echo "🧪 Test site: https://laantungir.net/quantum-prep-test"
|
|
echo ""
|
|
echo "To promote to production after confirmation: ./upload.sh"
|