Setup Site on Staging

Steps for NON-DOCKERIZED SITE

Proxy


  GNU nano 5.6.1                                site.shawns-machine.com.conf
# Proxy nginx site.shawns-machine.com
server {
    server_name site.shawns-machine.com;
    location / {
        proxy_pass http://192.168.1.9:8080;  # matomo runs on 80 others moved
        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;
    }
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/site.shawns-machine.com/fullchain.pem;  # FIXED: vault cert
    ssl_certificate_key /etc/letsencrypt/live/site.shawns-machine.com/privkey.pem;  # FIXED: vault cert
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
    if ($host = site.shawns-machine.com) {
        return 301 https://$host$request_uri;
    }
    listen 80;
    server_name site.shawns-machine.com;
    return 404;
}

Staging (192.168.1.9)

Step 1: Add nginx config


sudo nano /etc/nginx/sites-available/site.shawns-machine.com
## Paste nginx config:
server {
    listen 8080;
    server_name site.shawns-machine.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        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_connect_timeout 300;
        proxy_send_timeout 300;
        proxy_read_timeout 300;
        
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    access_log /var/log/nginx/site.shawns-machine.com.access.log;
    error_log /var/log/nginx/site.shawns-machine.com.error.log;
}

Enable and test

sudo ln -s /etc/nginx/sites-available/site.shawns-machine.com /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx

Copy PENPOT files and run setup_start


DESKTOP:
scp -r /Users/shawneee/Desktop/sitefolder spiffy-root@192.168.1.9:/home/spiffy-root/penpot
On Staging:
sudo mkdir /var/www/site.shawns-machine.com
cp -r /home/spiffy-root/penpot/*  /var/www/site.shawns-machine.com

Start Services

(can we use / repuporse this one?)


# Create simple installer or install manually
## SETUP-START
#!/bin/bash
# ACCID Vault - Setup and Start
cd /var/www/site.shawns-machine.com

echo "🔐 Checking ACCID Vault setup..."
echo ""

# Test if venv exists and works
if [ -d "venv" ] && ./venv/bin/python -c "import fastapi" 2>/dev/null; then
    echo "✅ venv works! Starting Vault..."
    echo ""
    ./venv/bin/python vault_enhanced.py
    exit 0
fi

# If we get here, venv is broken or missing
echo "⚙️  venv broken or missing - rebuilding..."
echo ""

# Fix permissions and remove old venv
sudo chown -R $USER:$USER venv 2>/dev/null || true
sudo rm -rf venv

# Install system packages if needed
echo "📦 Installing system packages..."
sudo apt install -y python3-venv python3-full

# Create fresh venv
echo "📦 Creating virtual environment..."
python3 -m venv venv

# Install packages
echo "📦 Upgrading pip..."
./venv/bin/pip install --upgrade pip

echo "📦 Installing packages..."
./venv/bin/pip install fastapi uvicorn sqlalchemy python-multipart pydantic

# Test it
echo "📦 Testing installation..."
if ./venv/bin/python -c "import fastapi" 2>/dev/null; then
    echo "✅ venv ready!"
    echo ""
    echo "🚀 Starting Vault..."
    echo ""
    ./venv/bin/python vault_enhanced.py
else
    echo "❌ Installation failed!"
    exit 1
fi
````



#### permissions issues?
# On staging:
ls -la /var/www/site.shawns-machine.com/ | head -20
ls -la /var/www/site.shawns-machine.com/venv/ 2>/dev/null | head -10
whoami
## fix to your user
sudo chown -R spiffy-root:spiffy-root /var/www/site.shawns-machine.com