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 ""
|
||||
@@ -0,0 +1,62 @@
|
||||
# demo.vitalityfitnessva.com → VitFit V2 (port 3001)
|
||||
#
|
||||
# Deploy:
|
||||
# sudo cp this file /etc/nginx/sites-available/demo.vitalityfitnessva.com
|
||||
# sudo ln -s /etc/nginx/sites-available/demo.vitalityfitnessva.com /etc/nginx/sites-enabled/
|
||||
# sudo nginx -t
|
||||
# sudo certbot --nginx -d demo.vitalityfitnessva.com
|
||||
# sudo nginx -s reload
|
||||
#
|
||||
# Requires the $connection_upgrade map from nginx-http-snippet.conf
|
||||
# to already be present in your main nginx.conf http{} block.
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name demo.vitalityfitnessva.com;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
server_name demo.vitalityfitnessva.com;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/demo.vitalityfitnessva.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/demo.vitalityfitnessva.com/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
|
||||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||
|
||||
client_max_body_size 2100m;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
|
||||
proxy_buffering off;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user