#!/bin/bash

# My-Weekly-ToDo-List LXC Setup Script
# Run this inside your Ubuntu/Debian LXC container

set -e

echo "Updating system..."
apt update && apt upgrade -y

echo "Installing dependencies..."
apt install -y curl openssl git build-essential ufw

# Install Node.js 18
echo "Installing Node.js 18..."
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs

# Configure Firewall
echo "Configuring firewall..."
ufw allow 22/tcp
ufw allow 3000/tcp
ufw --force enable

echo "Installing PM2..."
npm install -g pm2

echo "Setup complete!"
echo "Next steps:"
echo "1. git clone <your-repo-url>"
echo "2. cd My-Weekly-ToDo-List"
echo "3. npm install"
echo "4. Create .env.production with your Supabase credentials"
echo "5. npm run build"
echo "6. pm2 start npm --name 'my-weekly-todo' -- start"
