vf
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# Run on the server after V2/app/ files are present in /home/ubuntu/demo
|
||||
# Prerequisites: .env already created (see deploy instructions)
|
||||
set -euo pipefail
|
||||
|
||||
DEMO_DIR=/home/ubuntu/demo
|
||||
V1_DB=/home/ubuntu/site/database.sqlite
|
||||
|
||||
echo ""
|
||||
echo "╔══════════════════════════════════════════╗"
|
||||
echo "║ VitFit V2 Demo Setup ║"
|
||||
echo "╚══════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
cd "$DEMO_DIR"
|
||||
|
||||
# ── .env guard ─────────────────────────────────────────────────────────────────
|
||||
if [ ! -f "$DEMO_DIR/.env" ]; then
|
||||
echo "ERROR: $DEMO_DIR/.env not found."
|
||||
echo "Create it before running this script (see deploy instructions)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ── Dependencies ───────────────────────────────────────────────────────────────
|
||||
echo "Step 1/4 Installing Node dependencies..."
|
||||
npm ci --omit=dev
|
||||
echo " Done."
|
||||
echo ""
|
||||
|
||||
# ── Runtime directories ────────────────────────────────────────────────────────
|
||||
echo "Step 2/4 Creating runtime directories..."
|
||||
mkdir -p "$DEMO_DIR/tmp"
|
||||
echo " Done."
|
||||
echo ""
|
||||
|
||||
# ── Copy V1 database ───────────────────────────────────────────────────────────
|
||||
echo "Step 3/4 Database setup..."
|
||||
if [ -f "$DEMO_DIR/vitfit.sqlite" ]; then
|
||||
echo " vitfit.sqlite already exists — skipping copy."
|
||||
else
|
||||
echo " Copying V1 database from $V1_DB..."
|
||||
cp "$V1_DB" "$DEMO_DIR/vitfit.sqlite"
|
||||
echo " Copied."
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# ── V1 → V2 migration ─────────────────────────────────────────────────────────
|
||||
echo "Step 4/4 Running V1 → V2 data migration (interactive)..."
|
||||
echo ""
|
||||
node "$DEMO_DIR/scripts/migrate-v1-to-v2.js"
|
||||
|
||||
echo ""
|
||||
echo "╔══════════════════════════════════════════╗"
|
||||
echo "║ Setup complete. ║"
|
||||
echo "║ ║"
|
||||
echo "║ Start the app: ║"
|
||||
echo "║ pm2 start app.js --name vitfit-demo ║"
|
||||
echo "║ pm2 save ║"
|
||||
echo "╚══════════════════════════════════════════╝"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user