# Deployment Guide

## Server Requirements
- Ubuntu 22.04 LTS
- 4 vCPU, 8GB RAM minimum
- 100GB SSD storage

## Stack
- Node.js 20.x
- PostgreSQL 16
- Redis 7
- Nginx
- PM2

## Installation
1. Run `./scripts/setup.sh` as root
2. Copy application files to `/var/www/livebeauty`
3. Update `.env` with production secrets
4. Run `./scripts/migrate.sh`
5. Run `./scripts/seed-database.js`
6. Configure Nginx using `server-config/nginx.conf`
7. Obtain SSL via `server-config/ssl-renew.sh`
8. Start services via `pm2 start server-config/pm2-ecosystem.config.js`

## Updates
Run `./scripts/deploy.sh` to pull changes, rebuild, and restart services.

## Monitoring
- PM2: `pm2 monit`
- Logs: `pm2 logs`
- Database: `pg_stat_activity`